5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 2013 Gary Mills
24 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
25 */
26
27 #include <sys/types.h>
28 #include <sys/param.h>
29 #include <sys/varargs.h>
30 #include <sys/systm.h>
31 #include <sys/cmn_err.h>
32 #include <sys/stream.h>
33 #include <sys/strsubr.h>
34 #include <sys/strsun.h>
35 #include <sys/sysmacros.h>
36 #include <sys/kmem.h>
37 #include <sys/log.h>
38 #include <sys/spl.h>
39 #include <sys/syslog.h>
40 #include <sys/console.h>
41 #include <sys/debug.h>
42 #include <sys/utsname.h>
43 #include <sys/id_space.h>
44 #include <sys/zone.h>
228 */
229 zone_key_create(&log_zone_key, log_zoneinit, NULL, log_zonefree);
230
231 /*
232 * Initialize backlog structure.
233 */
234 log_backlog.log_zoneid = GLOBAL_ZONEID;
235 log_backlog.log_minor = LOG_BACKLOG;
236
237 /* Allocate kmem cache for conslog's log structures */
238 log_cons_cache = kmem_cache_create("log_cons_cache",
239 sizeof (struct log), 0, log_cons_constructor, log_cons_destructor,
240 NULL, NULL, NULL, 0);
241
242 /*
243 * Let the logging begin.
244 */
245 log_update(&log_backlog, log_backlogq, SL_CONSOLE, log_console);
246
247 /*
248 * Now that logging is enabled, emit the SunOS banner.
249 */
250 printf("\rSunOS Release %s Version %s %u-bit\n",
251 utsname.release, utsname.version, NBBY * (uint_t)sizeof (void *));
252 printf("Copyright (c) 1983, 2010, Oracle and/or its affiliates. "
253 "All rights reserved.\n");
254 #ifdef DEBUG
255 printf("DEBUG enabled\n");
256 #endif
257 }
258
259 /*
260 * Allocate a log device corresponding to supplied device type.
261 * Both devices are clonable. /dev/log devices are allocated per zone.
262 * /dev/conslog devices are allocated from kmem cache.
263 */
264 log_t *
265 log_alloc(minor_t type)
266 {
267 zone_t *zptr = curproc->p_zone;
268 log_zone_t *lzp;
269 log_t *lp;
270 int i;
271 minor_t minor;
272
273 if (type == LOG_CONSMIN) {
|
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 2013 Gary Mills
24 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
25 * Copyright 2019 Nexenta Systems, Inc.
26 */
27
28 #include <sys/types.h>
29 #include <sys/param.h>
30 #include <sys/varargs.h>
31 #include <sys/systm.h>
32 #include <sys/cmn_err.h>
33 #include <sys/stream.h>
34 #include <sys/strsubr.h>
35 #include <sys/strsun.h>
36 #include <sys/sysmacros.h>
37 #include <sys/kmem.h>
38 #include <sys/log.h>
39 #include <sys/spl.h>
40 #include <sys/syslog.h>
41 #include <sys/console.h>
42 #include <sys/debug.h>
43 #include <sys/utsname.h>
44 #include <sys/id_space.h>
45 #include <sys/zone.h>
229 */
230 zone_key_create(&log_zone_key, log_zoneinit, NULL, log_zonefree);
231
232 /*
233 * Initialize backlog structure.
234 */
235 log_backlog.log_zoneid = GLOBAL_ZONEID;
236 log_backlog.log_minor = LOG_BACKLOG;
237
238 /* Allocate kmem cache for conslog's log structures */
239 log_cons_cache = kmem_cache_create("log_cons_cache",
240 sizeof (struct log), 0, log_cons_constructor, log_cons_destructor,
241 NULL, NULL, NULL, 0);
242
243 /*
244 * Let the logging begin.
245 */
246 log_update(&log_backlog, log_backlogq, SL_CONSOLE, log_console);
247
248 /*
249 * Now that logging is enabled, emit the OS banner.
250 */
251 printf("\rSunOS Release %s Version %s %u-bit\n",
252 utsname.release, utsname.version, NBBY * (uint_t)sizeof (void *));
253 printf("Copyright (c) 1983, 2010, Oracle and/or its affiliates. "
254 "All rights reserved.\n");
255 printf("Copyright 2019 Nexenta Systems, Inc.\n");
256 #ifdef DEBUG
257 printf("DEBUG enabled\n");
258 #endif
259 }
260
261 /*
262 * Allocate a log device corresponding to supplied device type.
263 * Both devices are clonable. /dev/log devices are allocated per zone.
264 * /dev/conslog devices are allocated from kmem cache.
265 */
266 log_t *
267 log_alloc(minor_t type)
268 {
269 zone_t *zptr = curproc->p_zone;
270 log_zone_t *lzp;
271 log_t *lp;
272 int i;
273 minor_t minor;
274
275 if (type == LOG_CONSMIN) {
|