summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSergey Kandaurov <pluknet@nginx.com>2018-01-24 15:16:33 +0300
committerSergey Kandaurov <pluknet@nginx.com>2018-01-24 15:16:33 +0300
commit771e9d3cc3a59585a3d8a6ae2baddb18f335c3dd (patch)
treee50d2d18f95dec00f7f643dcf6251c1baa44e7b8
parent67c64a99fb78f48c3deacc7d89e73de72522806b (diff)
downloadunit-771e9d3cc3a59585a3d8a6ae2baddb18f335c3dd.tar.gz
unit-771e9d3cc3a59585a3d8a6ae2baddb18f335c3dd.tar.bz2
Fixed formatting in nxt_sprintf() and logging.
-rw-r--r--src/nxt_application.c2
-rw-r--r--src/nxt_conn_connect.c2
-rw-r--r--src/nxt_conn_write.c6
-rw-r--r--src/nxt_event_engine.c3
-rw-r--r--src/nxt_file.c2
-rw-r--r--src/nxt_h1proto.c2
-rw-r--r--src/nxt_linux_sendfile.c4
-rw-r--r--src/nxt_listen_socket.c2
-rw-r--r--src/nxt_main_process.c2
-rw-r--r--src/nxt_poll_engine.c2
-rw-r--r--src/nxt_port_memory.c10
-rw-r--r--src/nxt_port_rpc.c2
-rw-r--r--src/nxt_process.c2
-rw-r--r--src/nxt_router.c6
-rw-r--r--src/nxt_runtime.c2
-rw-r--r--src/nxt_socket.c2
-rw-r--r--src/nxt_thread_pool.c2
-rw-r--r--src/nxt_timer.c2
-rw-r--r--src/test/nxt_http_parse_test.c2
19 files changed, 29 insertions, 28 deletions
diff --git a/src/nxt_application.c b/src/nxt_application.c
index 462767f3..c9d577cc 100644
--- a/src/nxt_application.c
+++ b/src/nxt_application.c
@@ -218,7 +218,7 @@ nxt_discovery_module(nxt_task_t *task, nxt_mp_t *mp, nxt_array_t *modules,
type = nxt_app_parse_type(app->type.start, app->type.length);
if (type == NXT_APP_UNKNOWN) {
- nxt_log(task, NXT_LOG_NOTICE, "unknown module type %V", app->type);
+ nxt_log(task, NXT_LOG_NOTICE, "unknown module type %V", &app->type);
goto done;
}
diff --git a/src/nxt_conn_connect.c b/src/nxt_conn_connect.c
index a5736226..12b6c80c 100644
--- a/src/nxt_conn_connect.c
+++ b/src/nxt_conn_connect.c
@@ -156,7 +156,7 @@ nxt_conn_connect_test(nxt_task_t *task, void *obj, void *data)
nxt_log(task, nxt_socket_error_level(err), "connect(%d, %*s) failed %E",
c->socket.fd, (size_t) c->remote->length,
- nxt_sockaddr_start(c->remote));
+ nxt_sockaddr_start(c->remote), err);
nxt_conn_connect_error(task, c, data);
}
diff --git a/src/nxt_conn_write.c b/src/nxt_conn_write.c
index a2a5737b..f40f9c2f 100644
--- a/src/nxt_conn_write.c
+++ b/src/nxt_conn_write.c
@@ -74,7 +74,7 @@ nxt_conn_io_write(nxt_task_t *task, void *obj, void *data)
} while (sb.limit != 0);
- nxt_debug(task, "event conn: %i sent:%z", ret, sb.sent);
+ nxt_debug(task, "event conn: %z sent:%O", ret, sb.sent);
if (sb.sent != 0) {
if (c->write_state->timer_autoreset) {
@@ -178,7 +178,7 @@ nxt_conn_io_writev(nxt_task_t *task, nxt_sendbuf_t *sb, struct iovec *iov,
err = (n == -1) ? nxt_socket_errno : 0;
- nxt_debug(task, "writev(%d, %ui): %d", sb->socket, niov, n);
+ nxt_debug(task, "writev(%d, %ui): %z", sb->socket, niov, n);
if (n > 0) {
return n;
@@ -351,7 +351,7 @@ nxt_event_conn_io_writev(nxt_conn_t *c, nxt_iobuf_t *iob, nxt_uint_t niob)
err = (n == -1) ? nxt_socket_errno : 0;
- nxt_debug(c->socket.task, "writev(%d, %ui): %d", c->socket.fd, niob, n);
+ nxt_debug(c->socket.task, "writev(%d, %ui): %z", c->socket.fd, niob, n);
if (n > 0) {
return n;
diff --git a/src/nxt_event_engine.c b/src/nxt_event_engine.c
index 0b40d552..5a52e368 100644
--- a/src/nxt_event_engine.c
+++ b/src/nxt_event_engine.c
@@ -375,7 +375,8 @@ nxt_event_engine_signal_handler(nxt_task_t *task, void *obj, void *data)
}
}
- nxt_log(task, NXT_LOG_CRIT, "signal %ui handler not found", signo);
+ nxt_log(task, NXT_LOG_CRIT, "signal %ui handler not found",
+ (nxt_uint_t) signo);
}
diff --git a/src/nxt_file.c b/src/nxt_file.c
index 8381dc74..4c2a8783 100644
--- a/src/nxt_file.c
+++ b/src/nxt_file.c
@@ -503,7 +503,7 @@ nxt_file_stderr(nxt_file_t *file)
}
nxt_thread_log_error(NXT_LOG_CRIT, "dup2(%FD, %FD, \"%FN\") failed %E",
- file->fd, STDERR_FILENO, file->name);
+ file->fd, STDERR_FILENO, file->name, nxt_errno);
return NXT_ERROR;
}
diff --git a/src/nxt_h1proto.c b/src/nxt_h1proto.c
index 4057b082..56b8b3aa 100644
--- a/src/nxt_h1proto.c
+++ b/src/nxt_h1proto.c
@@ -441,7 +441,7 @@ nxt_h1p_request_body_read(nxt_task_t *task, nxt_http_request_t *r)
in->mem.pos += size;
}
- nxt_debug(task, "h1p body rest: %O", rest_length);
+ nxt_debug(task, "h1p body rest: %uz", rest_length);
r->rest_length = rest_length;
diff --git a/src/nxt_linux_sendfile.c b/src/nxt_linux_sendfile.c
index f5a7dccf..0e772ffb 100644
--- a/src/nxt_linux_sendfile.c
+++ b/src/nxt_linux_sendfile.c
@@ -104,7 +104,7 @@ nxt_linux_event_conn_io_sendfile(nxt_event_conn_t *c, nxt_buf_t *b,
err = (n == -1) ? nxt_errno : 0;
- nxt_debug(c->socket.task, "sendfile(): %d", n);
+ nxt_debug(c->socket.task, "sendfile(): %z", n);
if (n == -1) {
switch (err) {
@@ -204,7 +204,7 @@ nxt_linux_sendmsg(nxt_event_conn_t *c, nxt_sendbuf_coalesce_t *sb,
err = (n == -1) ? nxt_errno : 0;
- nxt_debug(c->socket.task, "sendmsg(%d, %ui, 0x%uXi): %d",
+ nxt_debug(c->socket.task, "sendmsg(%d, %ui, 0x%uXi): %z",
c->socket.fd, niov, flags, n);
if (n == -1) {
diff --git a/src/nxt_listen_socket.c b/src/nxt_listen_socket.c
index 6e8ea586..70c57746 100644
--- a/src/nxt_listen_socket.c
+++ b/src/nxt_listen_socket.c
@@ -305,5 +305,5 @@ nxt_listen_socket_log_handler(void *ctx, u_char *pos, u_char *end)
sa = ctx;
return nxt_sprintf(pos, end, " while creating listening socket on %*s",
- (size_t) sa->length, sa->start);
+ (size_t) sa->length, nxt_sockaddr_start(sa));
}
diff --git a/src/nxt_main_process.c b/src/nxt_main_process.c
index af72c111..f50475ed 100644
--- a/src/nxt_main_process.c
+++ b/src/nxt_main_process.c
@@ -1011,7 +1011,7 @@ next:
if (chmod(filename, access) != 0) {
ls->end = nxt_sprintf(ls->start, ls->end,
- "chmod(\\\"%*s\\\") failed %E",
+ "chmod(\\\"%s\\\") failed %E",
filename, nxt_errno);
goto fail;
}
diff --git a/src/nxt_poll_engine.c b/src/nxt_poll_engine.c
index faf245b3..cb41d182 100644
--- a/src/nxt_poll_engine.c
+++ b/src/nxt_poll_engine.c
@@ -557,7 +557,7 @@ nxt_poll(nxt_event_engine_t *engine, nxt_msec_t timeout)
ev = phe->event;
- nxt_debug(ev->task, "poll: fd:%d ev:%04uXi rd:%d %wr:%d",
+ nxt_debug(ev->task, "poll: fd:%d ev:%04uXi rd:%d wr:%d",
fd, events, ev->read, ev->write);
if (nxt_slow_path((events & POLLNVAL) != 0)) {
diff --git a/src/nxt_port_memory.c b/src/nxt_port_memory.c
index b3bfb7e2..87e7c1bc 100644
--- a/src/nxt_port_memory.c
+++ b/src/nxt_port_memory.c
@@ -158,7 +158,7 @@ nxt_port_mmap_buf_completion(nxt_task_t *task, void *obj, void *data)
nxt_port_mmap_free_junk(p, b->mem.end - p);
- nxt_debug(task, "mmap buf completion: %p [%p,%d] (sent=%d), "
+ nxt_debug(task, "mmap buf completion: %p [%p,%uz] (sent=%d), "
"%PI->%PI,%d,%d", b, b->mem.start, b->mem.end - b->mem.start,
b->is_port_mmap_sent, hdr->src_pid, hdr->dst_pid, hdr->id, c);
@@ -555,7 +555,7 @@ nxt_port_mmap_tracking_read(nxt_task_t *task, nxt_port_recv_msg_t *msg)
b = msg->buf;
if (nxt_buf_used_size(b) < (int)sizeof(nxt_port_mmap_tracking_msg_t)) {
- nxt_debug(task, "too small message %u", nxt_buf_used_size(b));
+ nxt_debug(task, "too small message %O", nxt_buf_used_size(b));
return 0;
}
@@ -629,7 +629,7 @@ nxt_port_mmap_get_buf(nxt_task_t *task, nxt_port_t *port, size_t size)
nchunks++;
}
- nxt_debug(task, "outgoing mmap buf allocation: %p [%p,%d] %PI->%PI,%d,%d",
+ nxt_debug(task, "outgoing mmap buf allocation: %p [%p,%uz] %PI->%PI,%d,%d",
b, b->mem.start, b->mem.end - b->mem.start,
hdr->src_pid, hdr->dst_pid, hdr->id, c);
@@ -709,7 +709,7 @@ nxt_port_mmap_increase_buf(nxt_task_t *task, nxt_buf_t *b, size_t size,
c--;
}
- nxt_debug(task, "failed to increase, %d chunks busy", nchunks);
+ nxt_debug(task, "failed to increase, %uz chunks busy", nchunks);
return NXT_ERROR;
@@ -760,7 +760,7 @@ nxt_port_mmap_get_incoming_buf(nxt_task_t *task, nxt_port_t *port,
b->parent = mmap_handler;
nxt_port_mmap_handler_use(mmap_handler, 1);
- nxt_debug(task, "incoming mmap buf allocation: %p [%p,%d] %PI->%PI,%d,%d",
+ nxt_debug(task, "incoming mmap buf allocation: %p [%p,%uz] %PI->%PI,%d,%d",
b, b->mem.start, b->mem.end - b->mem.start,
hdr->src_pid, hdr->dst_pid, hdr->id, mmap_msg->chunk_id);
diff --git a/src/nxt_port_rpc.c b/src/nxt_port_rpc.c
index b041256a..792bf55f 100644
--- a/src/nxt_port_rpc.c
+++ b/src/nxt_port_rpc.c
@@ -216,7 +216,7 @@ nxt_port_rpc_ex_set_peer(nxt_task_t *task, nxt_port_t *port,
break;
default:
- nxt_log_error(NXT_LOG_ERR, task->log, "rpc: stream #%uD failed to add "
+ nxt_log_error(NXT_LOG_ERR, task->log, "rpc: failed to add "
"peer for stream #%uD (%d)", reg->stream, ret);
reg->peer = -1;
diff --git a/src/nxt_process.c b/src/nxt_process.c
index f1c00e4e..04c5f745 100644
--- a/src/nxt_process.c
+++ b/src/nxt_process.c
@@ -588,7 +588,7 @@ nxt_int_t
nxt_user_cred_set(nxt_task_t *task, nxt_user_cred_t *uc)
{
nxt_debug(task, "user cred set: \"%s\" uid:%uL base gid:%uL",
- uc->user, (uint64_t) uc->uid, uc->base_gid);
+ uc->user, (uint64_t) uc->uid, (uint64_t) uc->base_gid);
if (setgid(uc->base_gid) != 0) {
nxt_log(task, NXT_LOG_CRIT, "setgid(%d) failed %E",
diff --git a/src/nxt_router.c b/src/nxt_router.c
index a2effb57..1ba7072d 100644
--- a/src/nxt_router.c
+++ b/src/nxt_router.c
@@ -711,7 +711,7 @@ nxt_router_conf_data_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg)
return;
}
- nxt_debug(task, "nxt_router_conf_data_handler(%d): %*s",
+ nxt_debug(task, "nxt_router_conf_data_handler(%O): %*s",
nxt_buf_used_size(msg->buf),
(size_t) nxt_buf_used_size(msg->buf), msg->buf->mem.pos);
@@ -2391,7 +2391,7 @@ nxt_router_response_ready_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg,
dump_size = 300;
}
- nxt_debug(task, "%srouter app data (%z): %*s",
+ nxt_debug(task, "%srouter app data (%uz): %*s",
msg->port_msg.last ? "last " : "", msg->size, dump_size,
b->mem.pos);
@@ -3227,7 +3227,7 @@ nxt_router_app_prepare_request(nxt_task_t *task, nxt_req_app_link_t *ra)
goto release_port;
}
- nxt_debug(task, "about to send %d bytes buffer to worker port %d",
+ nxt_debug(task, "about to send %O bytes buffer to worker port %d",
nxt_buf_used_size(wmsg.write),
wmsg.port->socket.fd);
diff --git a/src/nxt_runtime.c b/src/nxt_runtime.c
index d07a1b3b..d60c0713 100644
--- a/src/nxt_runtime.c
+++ b/src/nxt_runtime.c
@@ -239,7 +239,7 @@ nxt_runtime_systemd_listen_sockets(nxt_task_t *task, nxt_runtime_t *rt)
return NXT_OK;
}
- nxt_log(task, NXT_LOG_INFO, "using %s systemd listen sockets", n);
+ nxt_log(task, NXT_LOG_INFO, "using %i systemd listen sockets", n);
inherited_sockets = nxt_array_create(rt->mem_pool,
n, sizeof(nxt_listen_socket_t));
diff --git a/src/nxt_socket.c b/src/nxt_socket.c
index 529d7f7d..d7cdd600 100644
--- a/src/nxt_socket.c
+++ b/src/nxt_socket.c
@@ -101,7 +101,7 @@ nxt_socket_getsockopt(nxt_task_t *task, nxt_socket_t s, nxt_uint_t level,
nxt_log(task, NXT_LOG_CRIT, "getsockopt(%d, %ui, %s) failed %E",
s, level, nxt_socket_sockopt_name(level, sockopt),
- val, nxt_socket_errno);
+ nxt_socket_errno);
return -1;
}
diff --git a/src/nxt_thread_pool.c b/src/nxt_thread_pool.c
index 56efa1a0..0be2ddc0 100644
--- a/src/nxt_thread_pool.c
+++ b/src/nxt_thread_pool.c
@@ -233,7 +233,7 @@ nxt_thread_pool_destroy(nxt_thread_pool_t *tp)
thr = nxt_thread();
- nxt_log_debug(thr->log, "thread pool destroy: %d", tp->ready);
+ nxt_log_debug(thr->log, "thread pool destroy: %A", tp->ready);
if (!tp->ready) {
nxt_work_queue_add(&thr->engine->fast_work_queue, tp->exit,
diff --git a/src/nxt_timer.c b/src/nxt_timer.c
index 399f261b..c1a26b86 100644
--- a/src/nxt_timer.c
+++ b/src/nxt_timer.c
@@ -273,7 +273,7 @@ nxt_timer_find(nxt_event_engine_t *engine)
time = timer->time;
timers->minimum = time;
- nxt_debug(timer->task, "timer found minimum: %M:%M",
+ nxt_debug(timer->task, "timer found minimum: %D:%M",
time, timers->now);
time = nxt_msec_diff(time, timers->now);
diff --git a/src/test/nxt_http_parse_test.c b/src/test/nxt_http_parse_test.c
index 3b924614..adf35168 100644
--- a/src/test/nxt_http_parse_test.c
+++ b/src/test/nxt_http_parse_test.c
@@ -535,7 +535,7 @@ nxt_http_parse_test(nxt_thread_t *thr)
1);
nxt_log_error(NXT_LOG_NOTICE, thr->log,
- "http parse test hash collisions %ui out of %ui, level: %ui",
+ "http parse test hash collisions %ui out of %uz, level: %ui",
colls, nxt_nitems(nxt_http_test_bench_fields), lvl_colls);
nxt_memzero(&hash, sizeof(nxt_lvlhsh_t));