Checkout http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/utils/pice/ just for kicks
On Apr 5, 2011 8:11 PM, "Minas Abrahamyan" <minas.subs@gmail.com> wrote:
>
> Hi all,
>
> I'm going to implement dmesg.exe, a ROS application to read dmesg/kmsg
> buffer (debug messages in kernel buffer),
> which is filled in by appropriate patch 6018
> (here: http://www.reactos.org/bugzilla/show_bug.cgi?id=6018 ) (BTW,
> it's not yet reviewed and not applied!).
>
> So I'm requesting advice on:
> What would be the better way for user-mode code to get the contents of
> kmsg buffer in kernel-space (kdbg)?
>
> Shortly:
> Linux has special system call "syslog" (man 2 syslog)
> FreeBSD uses its special sysctl interface to kernel along with
> 'kern.msgbuf' parameter.
>
> My questions:
> Do we need special system call like Linux, or even more, the whole
> family of them (sysctl('*')) as in BSD?
> How to implement simple system call for it, now?
>
> ---
> Now detailed info for unices:
>
> Linux case:
> * syslog(2) - read and/or clear kernel message ring buffer; set console_loglevel
> int syslog(int type, char *bufp, int len);
>
> * also /proc/kmsg virtual file, which when being read returns buffer contents
> ==excerpt from man proc ==
> /proc/kmsg
> This file can be used instead of the syslog(2) system
> call to read kernel messages. A
> process must have superuser privileges to read this
> file, and only one process should read
> this file. This file should not be read if a syslog
> process is running which uses the sys‐
> log(2) system call facility to log kernel messages.
>
> Information in this file is retrieved with the dmesg(1) program.
> ==eo exerpt==
>
> dmesg in FreeBSD:
> Parameter 'kern.msgbuf' given to sysctl(3) returns contents of kernel
> message buffer.
> There is also 'kern.msgbuf_clear' to clean the buffer.
> ---
>
> WBR,
> Minas Abrahamyan
>
> _______________________________________________
> Ros-dev mailing list
> Ros-dev@reactos.org
> http://www.reactos.org/mailman/listinfo/ros-dev