#define _GNU_SOURCE #include #include #include #include "cookie.h" static char const *priov[] = { [LOG_EMERG] = "EMERG:", [LOG_ALERT] = "ALERT:", [LOG_CRIT] = "CRIT:", [LOG_ERR] = "ERR:", [LOG_WARNING] = "WARNING:", [LOG_NOTICE] = "NOTICE:", [LOG_INFO] = "INFO:", [LOG_DEBUG] = "DEBUG:", }; static ssize_t cookie_writer(void *cookie, char const *data, size_t leng) { int prio = LOG_DEBUG, len; do { len = strlen(priov[prio]); } while (memcmp(data, priov[prio], len) && --prio >= 0); if (prio < 0) { prio = LOG_INFO; } else { data += len; leng -= len; } while (*data == ' ') { ++data; --leng; } syslog(prio, "%.*s", (int) leng, data); return leng; } static cookie_io_functions_t cookie_log = { .write = cookie_writer, }; void to_std_log(FILE **fp) { setvbuf(*fp = fopencookie(NULL, "w", cookie_log), NULL, _IOLBF, 0); } next.git/'>net-next.git
net-next plumbingsTobias Klauser
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-08-21 14:28:24 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2016-08-21 14:28:24 -0700
commit46097f27180c7dd371c2b0391d40bb1fa36007af (patch)
tree55a202d3ba3fd24e5d4afa286cefa72ec01ebcd1
parent4ec656bdf43a13a655a8259b79dd63bc1f0b1e41 (diff)
parent3eb53b20d7bd1374598cfb1feaa081fcac0e76cd (diff)
Merge branch 'parisc-4.8-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux
Pull two parisc fixes from Helge Deller: "The first patch ensures that the high-res cr16 clocksource (which was added in kernel 4.7) gets choosen as default clocksource for parisc. The second patch moves the #define of EREFUSED down inside errno.h and thus unbreaks building the gccgo compiler" * 'parisc-4.8-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux: parisc: Fix order of EREFUSED define in errno.h parisc: Fix automatic selection of cr16 clocksource