subr_prf.c (59588a546f55523d6fd37ab42eb08b719311d7d6) subr_prf.c (9d6ae1e3c26a0c3334a268b587f17dccb9a503d7)
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 1986, 1988, 1991, 1993
5 * The Regents of the University of California. All rights reserved.
6 * (c) UNIX System Laboratories, Inc.
7 * All or some portions of this file are derived from material licensed
8 * to the University of California by American Telephone and Telegraph

--- 44 unchanged lines hidden (view full) ---

53#include <sys/sx.h>
54#include <sys/kernel.h>
55#include <sys/msgbuf.h>
56#include <sys/malloc.h>
57#include <sys/priv.h>
58#include <sys/proc.h>
59#include <sys/stddef.h>
60#include <sys/sysctl.h>
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 1986, 1988, 1991, 1993
5 * The Regents of the University of California. All rights reserved.
6 * (c) UNIX System Laboratories, Inc.
7 * All or some portions of this file are derived from material licensed
8 * to the University of California by American Telephone and Telegraph

--- 44 unchanged lines hidden (view full) ---

53#include <sys/sx.h>
54#include <sys/kernel.h>
55#include <sys/msgbuf.h>
56#include <sys/malloc.h>
57#include <sys/priv.h>
58#include <sys/proc.h>
59#include <sys/stddef.h>
60#include <sys/sysctl.h>
61#include <sys/tslog.h>
61#include <sys/tty.h>
62#include <sys/syslog.h>
63#include <sys/cons.h>
64#include <sys/uio.h>
65#else /* !_KERNEL */
66#include <errno.h>
67#endif
68#include <sys/ctype.h>

--- 963 unchanged lines hidden (view full) ---

1032
1033void
1034msgbufinit(void *ptr, int size)
1035{
1036 char *cp;
1037 static struct msgbuf *oldp = NULL;
1038 bool print_boot_tag;
1039
62#include <sys/tty.h>
63#include <sys/syslog.h>
64#include <sys/cons.h>
65#include <sys/uio.h>
66#else /* !_KERNEL */
67#include <errno.h>
68#endif
69#include <sys/ctype.h>

--- 963 unchanged lines hidden (view full) ---

1033
1034void
1035msgbufinit(void *ptr, int size)
1036{
1037 char *cp;
1038 static struct msgbuf *oldp = NULL;
1039 bool print_boot_tag;
1040
1041 TSENTER();
1040 size -= sizeof(*msgbufp);
1041 cp = (char *)ptr;
1042 print_boot_tag = !msgbufmapped;
1043 /* Attempt to fetch kern.boot_tag tunable on first mapping */
1044 if (!msgbufmapped)
1045 TUNABLE_STR_FETCH("kern.boot_tag", current_boot_tag,
1046 sizeof(current_boot_tag));
1047 msgbufp = (struct msgbuf *)(cp + size);
1048 msgbuf_reinit(msgbufp, cp, size);
1049 if (msgbufmapped && oldp != msgbufp)
1050 msgbuf_copy(oldp, msgbufp);
1051 msgbufmapped = true;
1052 if (print_boot_tag && *current_boot_tag != '\0')
1053 printf("%s\n", current_boot_tag);
1054 oldp = msgbufp;
1042 size -= sizeof(*msgbufp);
1043 cp = (char *)ptr;
1044 print_boot_tag = !msgbufmapped;
1045 /* Attempt to fetch kern.boot_tag tunable on first mapping */
1046 if (!msgbufmapped)
1047 TUNABLE_STR_FETCH("kern.boot_tag", current_boot_tag,
1048 sizeof(current_boot_tag));
1049 msgbufp = (struct msgbuf *)(cp + size);
1050 msgbuf_reinit(msgbufp, cp, size);
1051 if (msgbufmapped && oldp != msgbufp)
1052 msgbuf_copy(oldp, msgbufp);
1053 msgbufmapped = true;
1054 if (print_boot_tag && *current_boot_tag != '\0')
1055 printf("%s\n", current_boot_tag);
1056 oldp = msgbufp;
1057 TSEXIT();
1055}
1056
1057/* Sysctls for accessing/clearing the msgbuf */
1058static int
1059sysctl_kern_msgbuf(SYSCTL_HANDLER_ARGS)
1060{
1061 char buf[128], *bp;
1062 u_int seq;

--- 272 unchanged lines hidden ---
1058}
1059
1060/* Sysctls for accessing/clearing the msgbuf */
1061static int
1062sysctl_kern_msgbuf(SYSCTL_HANDLER_ARGS)
1063{
1064 char buf[128], *bp;
1065 u_int seq;

--- 272 unchanged lines hidden ---