#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); } git.cgi/linux/net-next.git/'>net-next.git
net-next plumbingsTobias Klauser
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-12-30 09:32:26 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2016-12-30 09:32:26 -0800
commit238d1d0f79f619d75c2cc741d6770fb0986aef24 (patch)
treeed11bb89c3c61cba7aff3ebc90647f83758a982d /Documentation/i2c/fault-codes
parentf3de082c12e5e9ff43c58a7561f6ec3272d03a48 (diff)
parent36f671be1db1b17d3d4ab0c8b47f81ccb1efcb75 (diff)
Merge tag 'docs-4.10-rc1-fix' of git://git.lwn.net/linux
Pull documentation fixes from Jonathan Corbet: "Two small fixes: - A merge error on my part broke the DocBook build. I've requisitioned one of tglx's frozen sharks for appropriate disciplinary action and resolved to be more careful about testing the DocBook stuff as long as it's still around. - Fix an error in unaligned-memory-access.txt" * tag 'docs-4.10-rc1-fix' of git://git.lwn.net/linux: Documentation/unaligned-memory-access.txt: fix incorrect comparison operator docs: Fix build failure
Diffstat (limited to 'Documentation/i2c/fault-codes')