summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJavier Martinez Canillas <martinez.javier@gmail.com>2010-11-27 08:25:49 +0100
committerJavier Martinez Canillas <martinez.javier@gmail.com>2010-11-27 08:25:49 +0100
commit582de48e5a3bbb36af30d6358d526b787da57fc1 (patch)
tree1dcaffab78c3af2767c12f5c0a90bd45a133d0b7
parentab121f379a3cff458c90e6f480ba4bb68c8733dd (diff)
downloadldd3-582de48e5a3bbb36af30d6358d526b787da57fc1.tar.gz
misc-progs: setlevel: Removes deprecated macros, use klogctl syscall and clean coding style issues
-rw-r--r--misc-progs/setlevel.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/misc-progs/setlevel.c b/misc-progs/setlevel.c
index fec666d..8055210 100644
--- a/misc-progs/setlevel.c
+++ b/misc-progs/setlevel.c
@@ -2,7 +2,7 @@
* setlevel.c -- choose a console_loglevel for the kernel
*
* Copyright (C) 1998,2000,2001 Alessandro Rubini
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -23,25 +23,23 @@
#include <string.h>
#include <errno.h>
/* #include <unistd.h> */ /* conflicting on the alpha */
-#define __LIBRARY__ /* _syscall3 and friends are only available through this */
#include <linux/unistd.h>
-
-/* define the system call, to override the library function */
-_syscall3(int, syslog, int, type, char *, bufp, int, len);
+#include <sys/klog.h>
int main(int argc, char **argv)
{
- int level;
+ int level;
+
+ if (argc == 2) {
+ level = atoi(argv[1]); /* the chosen console */
+ } else {
+ fprintf(stderr, "%s: need a single arg\n", argv[0]); exit(1);
+ }
- if (argc==2) {
- level = atoi(argv[1]); /* the chosen console */
- } else {
- fprintf(stderr, "%s: need a single arg\n",argv[0]); exit(1);
- }
- if (syslog(8,NULL,level) < 0) {
- fprintf(stderr,"%s: syslog(setlevel): %s\n",
- argv[0],strerror(errno));
- exit(1);
- }
- exit(0);
+ if (klogctl(8, NULL, level) < 0) {
+ fprintf(stderr, "%s: syslog(setlevel): %s\n",
+ argv[0], strerror(errno));
+ exit(1);
+ }
+ exit(0);
}