[ale] kernel info?
Chris Fowler
cfowler at outpostsentinel.com
Sun Mar 3 20:38:15 EST 2002
This will get it
#include <stdio.h>
#include <stdlib.h>
#include <sys/klog.h>
#define VIEWKLOG 3
#define CLEARKLOG 5
#define KLOGSIZE 16485
/* Taken from printk.c
* 0 -- Close the log. Currently a NOP.
* 1 -- Open the log. Currently a NOP.
* 2 -- Read from the log.
* 3 -- Read all messages remaining in the ring buffer.
* 4 -- Read and clear all messages remaining in the ring buffer
* 5 -- Clear ring buffer.
* 6 -- Disable printk's to console
* 7 -- Enable printk's to console
* 8 -- Set level of messages printed to console
* 9 -- Return number of unread characters in the log buffer
*/
int
klog(int argc, char *argv[])
{
char buf[KLOGSIZE];
int n = 0;
int i = 0;
int lastc;
if(argc > 1)
if(strcmp(argv[1], "clear") == 0)
{
if(getuid())
msgquit("only admin can clear klog");
if ((n = klogctl(CLEARKLOG, NULL, 0)) < 0)
err_quit("klogctl");
printf("klog cleared\n");
return 0;
}
if ((n = klogctl(VIEWKLOG, buf, KLOGSIZE)) < 0)
err_quit("klogctl");
if(n == 0)
msgquit("klog empty");
lastc = '\n';
for (i = 0; i < n; i++)
{
if (lastc == '\n' && buf[i] == '<')
{
i++;
while (buf[i] >= '0' && buf[i] <= '9')
i++;
if (buf[i] == '>')
i++;
}
lastc = buf[i];
putchar(lastc);
}
if (lastc != '\n')
putchar('\n');
return 0;
}
-----Original Message-----
From: Jeff Hubbs [mailto:hbbs at attbi.com]
To: ale at ale.org
Sent: Sunday, March 03, 2002 8:30 PM
To: James P. Kinney III
Cc: Stephen Turner; Atlanta Linux User Group (E-mail)
Subject: Re: [ale] kernel info?
"dmesg | less" will enhance the readability...
- Jeff
James P. Kinney III wrote:
>dmesg will show what was done by the kernel up to the start of a
>runlevel.
>
>On Sun, 2002-03-03 at 18:37, Stephen Turner wrote:
>
>>there is a lot of info and things flying by the screen
>>at boot up that i dont get to see, is there a log
>>where i can read that? or is there a way i can log
>>it??
>>im using gentoo linux
>>
>>__________________________________________________
>>Do You Yahoo!?
>>Yahoo! Sports - sign up for Fantasy Baseball
>>http://sports.yahoo.com
>>
>>---
>>This message has been sent through the ALE general discussion list.
>>See http://www.ale.org/mailing-lists.shtml for more info. Problems should
be
>>sent to listmaster at ale dot org.
>>
---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be
sent to listmaster at ale dot org.
---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be
sent to listmaster at ale dot org.
More information about the Ale
mailing list