X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flogger.c;h=5c7e4ee42b9cd4554450a210ade8f5e55d8d584b;hb=2f198e2f36a4acc05171cc2169bc58887c42d350;hp=c486a8acd1d854a83e0915b44f6de15f1f91d23a;hpb=7c394faa38de389638e19b19212ed50aca870e3c;p=elogind.git diff --git a/src/logger.c b/src/logger.c index c486a8acd..5c7e4ee42 100644 --- a/src/logger.c +++ b/src/logger.c @@ -89,7 +89,7 @@ struct Stream { LIST_FIELDS(Stream, stream); }; -static int stream_log(Stream *s, char *p, usec_t timestamp) { +static int stream_log(Stream *s, char *p, usec_t ts) { char header_priority[16], header_time[64], header_pid[16]; struct iovec iovec[5]; @@ -134,7 +134,7 @@ static int stream_log(Stream *s, char *p, usec_t timestamp) { time_t t; struct tm *tm; - t = (time_t) (timestamp / USEC_PER_SEC); + t = (time_t) (ts / USEC_PER_SEC); if (!(tm = localtime(&t))) return -EINVAL; @@ -177,7 +177,7 @@ static int stream_log(Stream *s, char *p, usec_t timestamp) { return 0; } -static int stream_line(Stream *s, char *p, usec_t timestamp) { +static int stream_line(Stream *s, char *p, usec_t ts) { int r; assert(s); @@ -236,13 +236,13 @@ static int stream_line(Stream *s, char *p, usec_t timestamp) { return 0; case STREAM_RUNNING: - return stream_log(s, p, timestamp); + return stream_log(s, p, ts); } assert_not_reached("Unknown stream state"); } -static int stream_scan(Stream *s, usec_t timestamp) { +static int stream_scan(Stream *s, usec_t ts) { char *p; size_t remaining; int r = 0; @@ -259,7 +259,7 @@ static int stream_scan(Stream *s, usec_t timestamp) { *newline = 0; - if ((r = stream_line(s, p, timestamp)) >= 0) { + if ((r = stream_line(s, p, ts)) >= 0) { remaining -= newline-p+1; p = newline+1; } @@ -273,7 +273,7 @@ static int stream_scan(Stream *s, usec_t timestamp) { return r; } -static int stream_process(Stream *s, usec_t timestamp) { +static int stream_process(Stream *s, usec_t ts) { ssize_t l; int r; assert(s); @@ -292,7 +292,7 @@ static int stream_process(Stream *s, usec_t timestamp) { return 0; s->length += l; - r = stream_scan(s, timestamp); + r = stream_scan(s, ts); if (r < 0) return r; @@ -428,7 +428,7 @@ static int server_init(Server *s, unsigned n_sockets) { fd = SD_LISTEN_FDS_START+i; - if ((r = sd_is_socket(fd, SOCK_STREAM, 1)) < 0) { + if ((r = sd_is_socket(fd, AF_UNSPEC, SOCK_STREAM, 1)) < 0) { log_error("Failed to determine file descriptor type: %s", strerror(-r)); goto fail; } @@ -501,10 +501,10 @@ static int process_event(Server *s, struct epoll_event *ev) { } } else { - usec_t timestamp; + usec_t ts; Stream *stream = ev->data.ptr; - timestamp = now(CLOCK_REALTIME); + ts = now(CLOCK_REALTIME); if (!(ev->events & EPOLLIN)) { log_info("Got invalid event from epoll. (2)"); @@ -512,7 +512,7 @@ static int process_event(Server *s, struct epoll_event *ev) { return 0; } - if ((r = stream_process(stream, timestamp)) <= 0) { + if ((r = stream_process(stream, ts)) <= 0) { if (r < 0) log_info("Got error on stream: %s", strerror(-r));