[PATCH] klogd: support /dev/klog in addition to klogctl()
Denys Vlasenko
vda.linux at googlemail.com
Sun Aug 1 01:02:57 UTC 2010
On Friday 30 July 2010 22:07, Jeremie Koenig wrote:
> The klogctl() interface allows changing the console loglevel, but is
> Linux-specific. The more portable method of reading from _PATH_KLOG is
> added as an alternative.
+static void klogd_setloglevel(int lvl UNUSED_PARAM)
+{
+ FILE *f;
+
+ f = fopen("/proc/sys/kernel/printk", "w");
+ if (f != NULL) {
+ fprintf(f, "%d", lvl);
Apparently lvl is no longer UNUSED_PARAM :)
- n = klogctl(2, start, KLOGD_LOGBUF_SIZE-1 - used);
+ n = klogd_read(start, KLOGD_LOGBUF_SIZE-1 - used);
if (n < 0) {
if (errno == EINTR)
continue;
You needed to change the message as well:
syslog(LOG_ERR, "klogd: error %d in klogctl(2): %m",
errno);
I am applying it with some changes. Please test current git.
--
vda
More information about the busybox
mailing list