summaryrefslogtreecommitdiffstats
path: root/sys-utils/dmesg.c
diff options
context:
space:
mode:
authorKarel Zak2006-12-07 00:25:34 +0100
committerKarel Zak2006-12-07 00:25:34 +0100
commitfd6b7a7ffc50400704beb41d5a23af5f9edb1eed (patch)
tree997c0ca2abc018369babd7da59bcd0afe492068e /sys-utils/dmesg.c
parentImported from util-linux-2.5 tarball. (diff)
downloadkernel-qcow2-util-linux-fd6b7a7ffc50400704beb41d5a23af5f9edb1eed.tar.gz
kernel-qcow2-util-linux-fd6b7a7ffc50400704beb41d5a23af5f9edb1eed.tar.xz
kernel-qcow2-util-linux-fd6b7a7ffc50400704beb41d5a23af5f9edb1eed.zip
Imported from util-linux-2.7.1 tarball.
Diffstat (limited to 'sys-utils/dmesg.c')
-rw-r--r--sys-utils/dmesg.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/sys-utils/dmesg.c b/sys-utils/dmesg.c
index 880528531..56beb3fea 100644
--- a/sys-utils/dmesg.c
+++ b/sys-utils/dmesg.c
@@ -9,13 +9,24 @@
#include <linux/unistd.h>
#include <stdio.h>
#include <getopt.h>
+#include <stdlib.h>
-#define __NR_klog __NR_syslog
+#if __GNU_LIBRARY__ < 5
-static inline _syscall3(int,klog,int,type,char *,b,int,len)
+#ifndef __alpha__
+# define __NR_klogctl __NR_syslog
+ static inline _syscall3(int, klogctl, int, type, char *, b, int, len);
+#else /* __alpha__ */
+#define klogctl syslog
+#endif
+
+#else
+# include <sys/klog.h>
+#endif
static char *progname;
+void
usage()
{
fprintf( stderr, "Usage: %s [-c] [-n level]\n", progname );
@@ -27,7 +38,7 @@ int main( int argc, char *argv[] )
int i;
int n;
int c;
- int level;
+ int level = 0;
int lastc;
int cmd = 3;
@@ -56,17 +67,17 @@ int main( int argc, char *argv[] )
}
if (cmd == 8) {
- n = klog( cmd, NULL, level );
+ n = klogctl( cmd, NULL, level );
if (n < 0) {
- perror( "klog" );
+ perror( "klogctl" );
exit( 1 );
}
exit( 0 );
}
- n = klog( cmd, buf, sizeof( buf ) );
+ n = klogctl( cmd, buf, sizeof( buf ) );
if (n < 0) {
- perror( "klog" );
+ perror( "klogctl" );
exit( 1 );
}