diff options
author | abial <abial@FreeBSD.org> | 1998-09-14 11:47:40 +0000 |
---|---|---|
committer | abial <abial@FreeBSD.org> | 1998-09-14 11:47:40 +0000 |
commit | 5a678e68e9c40af9bc521e7132a670a64dc11cd7 (patch) | |
tree | 5b62cf9e4d3edab4d176489b231a29ee12165692 | |
parent | 043007b72ddd8e82f6d66203a8195c173f205718 (diff) | |
download | FreeBSD-src-5a678e68e9c40af9bc521e7132a670a64dc11cd7.zip FreeBSD-src-5a678e68e9c40af9bc521e7132a670a64dc11cd7.tar.gz |
This implements retrieving the contents of message buffer via sysctl(3)
as "machdep.msgbuf". It's needed in case of using stripped kernels, where
normal dmesg (which has to use kvm) doesn't work.
The buffer is unwound, meaning that the data will be linear, possibly
with some leading NULLs.
Reviewed by: Jordan K. Hubbard <jkh@freebsd.org>
-rw-r--r-- | sys/amd64/amd64/machdep.c | 23 | ||||
-rw-r--r-- | sys/i386/i386/machdep.c | 23 |
2 files changed, 44 insertions, 2 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 97c01e9..69ad611 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.306 1998/08/31 16:18:45 luoqi Exp $ + * $Id: machdep.c,v 1.307 1998/09/01 02:04:12 kato Exp $ */ #include "apm.h" @@ -211,6 +211,27 @@ sysctl_hw_availpages SYSCTL_HANDLER_ARGS SYSCTL_PROC(_hw, OID_AUTO, availpages, CTLTYPE_INT|CTLFLAG_RD, 0, 0, sysctl_hw_availpages, "I", ""); +static int +sysctl_machdep_msgbuf SYSCTL_HANDLER_ARGS +{ + int error; + + /* Unwind the buffer, so that is linear (possibly starting with + * some initial nulls. + */ + error=sysctl_handle_opaque(oidp,msgbufp->msg_ptr+msgbufp->msg_bufr, + msgbufp->msg_size-msgbufp->msg_bufr,req); + if(error) return(error); + if(msgbufp->msg_bufr>0) { + error=sysctl_handle_opaque(oidp,msgbufp->msg_ptr, + msgbufp->msg_bufr,req); + } + return(error); +} + +SYSCTL_PROC(_machdep, OID_AUTO, msgbuf, CTLTYPE_STRING|CTLFLAG_RD, + 0, 0, sysctl_machdep_msgbuf, "A",""); + int bootverbose = 0, Maxmem = 0; long dumplo; diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 97c01e9..69ad611 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.306 1998/08/31 16:18:45 luoqi Exp $ + * $Id: machdep.c,v 1.307 1998/09/01 02:04:12 kato Exp $ */ #include "apm.h" @@ -211,6 +211,27 @@ sysctl_hw_availpages SYSCTL_HANDLER_ARGS SYSCTL_PROC(_hw, OID_AUTO, availpages, CTLTYPE_INT|CTLFLAG_RD, 0, 0, sysctl_hw_availpages, "I", ""); +static int +sysctl_machdep_msgbuf SYSCTL_HANDLER_ARGS +{ + int error; + + /* Unwind the buffer, so that is linear (possibly starting with + * some initial nulls. + */ + error=sysctl_handle_opaque(oidp,msgbufp->msg_ptr+msgbufp->msg_bufr, + msgbufp->msg_size-msgbufp->msg_bufr,req); + if(error) return(error); + if(msgbufp->msg_bufr>0) { + error=sysctl_handle_opaque(oidp,msgbufp->msg_ptr, + msgbufp->msg_bufr,req); + } + return(error); +} + +SYSCTL_PROC(_machdep, OID_AUTO, msgbuf, CTLTYPE_STRING|CTLFLAG_RD, + 0, 0, sysctl_machdep_msgbuf, "A",""); + int bootverbose = 0, Maxmem = 0; long dumplo; |