diff options
-rw-r--r-- | initscripts.spec | 1 | ||||
-rw-r--r-- | src/loglevel.c | 26 | ||||
-rw-r--r-- | sysconfig.txt | 6 |
3 files changed, 32 insertions, 1 deletions
diff --git a/initscripts.spec b/initscripts.spec index ea2ac97a..45e8c47e 100644 --- a/initscripts.spec +++ b/initscripts.spec @@ -145,6 +145,7 @@ rm -rf $RPM_BUILD_ROOT %attr(4755,root,root) /usr/sbin/usernetctl /sbin/netreport /sbin/initlog +/sbin/loglevel /sbin/minilogd /usr/man/man1/doexec.1 /usr/man/man1/initlog.1 diff --git a/src/loglevel.c b/src/loglevel.c new file mode 100644 index 00000000..04de2e46 --- /dev/null +++ b/src/loglevel.c @@ -0,0 +1,26 @@ + +/* Change the default console loglevel */ + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <linux/unistd.h> + +_syscall3(int,syslog,int,type,char *,bufp,int,len); + +int main(int argc, char **argv) { + int level; + + if (!argv[1]) exit(0); + level=atoi(argv[1]); + if ( (level<1) || (level>8) ) { + fprintf(stderr,"invalid log level %d\n",level); + exit(-1); + } + if (!syslog(8,NULL,level)) { + exit(0); + } else { + perror("syslog"); + exit(-1); + } +} diff --git a/sysconfig.txt b/sysconfig.txt index b385eefa..f5c79adb 100644 --- a/sysconfig.txt +++ b/sysconfig.txt @@ -23,7 +23,11 @@ Files in /etc/sysconfig BOOTUP=<some bootup mode> BOOTUP=color means new (as of RH6.0) boot display. Anything else means old-style display - + LOGLEVEL=<a number> + Sets the initial console logging level for the kernel. + The default is 7. 8 means everything (including debugging); + 1 means nothing except kernel panics. syslogd will override + this once it starts. /etc/sysconfig/keyboard: |