chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
manager: fix serialization counter
[elogind.git]
/
src
/
logger.c
diff --git
a/src/logger.c
b/src/logger.c
index 342c30789921d1245250c608f6842f5149cd8cb1..81196dbe00cd0e0734989d22149439bd5e040d14 100644
(file)
--- a/
src/logger.c
+++ b/
src/logger.c
@@
-37,10
+37,11
@@
#include "list.h"
#include "sd-daemon.h"
#include "tcpwrap.h"
#include "list.h"
#include "sd-daemon.h"
#include "tcpwrap.h"
+#include "def.h"
-#define STREAMS_MAX
25
6
+#define STREAMS_MAX
409
6
#define SERVER_FD_MAX 16
#define SERVER_FD_MAX 16
-#define TIMEOUT
((int) (10*MSEC_PER_
SEC))
+#define TIMEOUT
_MSEC ((int) (DEFAULT_EXIT_USEC/USEC_PER_M
SEC))
typedef struct Stream Stream;
typedef struct Stream Stream;
@@
-104,20
+105,16
@@
static int stream_log(Stream *s, char *p, usec_t ts) {
priority = s->priority;
priority = s->priority;
- if (s->prefix &&
- p[0] == '<' &&
- p[1] >= '0' && p[1] <= '7' &&
- p[2] == '>') {
-
- /* Detected priority prefix */
- priority = LOG_MAKEPRI(LOG_FAC(priority), (p[1] - '0'));
-
- p += 3;
- }
+ if (s->prefix)
+ parse_syslog_priority(&p, &priority);
if (*p == 0)
return 0;
if (*p == 0)
return 0;
+ /* Patch in LOG_USER facility if necessary */
+ if ((priority & LOG_FACMASK) == 0)
+ priority = LOG_USER | LOG_PRI(priority);
+
/*
* The format glibc uses to talk to the syslog daemon is:
*
/*
* The format glibc uses to talk to the syslog daemon is:
*
@@
-130,8
+127,7
@@
static int stream_log(Stream *s, char *p, usec_t ts) {
* We extend the latter to include the process name and pid.
*/
* We extend the latter to include the process name and pid.
*/
- snprintf(header_priority, sizeof(header_priority), "<%i>",
- s->target == STREAM_SYSLOG ? priority : LOG_PRI(priority));
+ snprintf(header_priority, sizeof(header_priority), "<%i>", priority);
char_array_0(header_priority);
if (s->target == STREAM_SYSLOG) {
char_array_0(header_priority);
if (s->target == STREAM_SYSLOG) {
@@
-520,7
+516,7
@@
static int server_init(Server *s, unsigned n_sockets) {
/* We use ev.data.ptr instead of ev.data.fd here,
* since on 64bit archs fd is 32bit while a pointer is
/* We use ev.data.ptr instead of ev.data.fd here,
* since on 64bit archs fd is 32bit while a pointer is
- * 64bit. To make sure we can easily dist
uing
ish fd
+ * 64bit. To make sure we can easily dist
ingu
ish fd
* values and pointer values we want to make sure to
* write the full field unconditionally. */
* values and pointer values we want to make sure to
* write the full field unconditionally. */
@@
-666,7
+662,7
@@
int main(int argc, char *argv[]) {
if ((k = epoll_wait(server.epoll_fd,
&event, 1,
if ((k = epoll_wait(server.epoll_fd,
&event, 1,
- server.n_streams <= 0 ? TIMEOUT : -1)) < 0) {
+ server.n_streams <= 0 ? TIMEOUT
_MSEC
: -1)) < 0) {
if (errno == EINTR)
continue;
if (errno == EINTR)
continue;