Attributing libunit logging function for arguments validation.

This commit is contained in:
Max Romanov
2020-03-30 14:08:20 +03:00
parent f94e31b294
commit 82b899b136
4 changed files with 31 additions and 10 deletions

View File

@@ -104,7 +104,7 @@ nxt_java_InputStream_readLine(JNIEnv *env, jclass cls,
res = nxt_unit_request_read(req, data + off, res);
}
nxt_unit_req_debug(req, "readLine '%.*s'", res, (char *) data + off);
nxt_unit_req_debug(req, "readLine '%.*s'", (int) res, (char *) data + off);
(*env)->ReleasePrimitiveArrayCritical(env, out, data, 0);
@@ -152,7 +152,7 @@ nxt_java_InputStream_read(JNIEnv *env, jclass cls, jlong req_info_ptr,
res = nxt_unit_request_read(req, data + off, len);
nxt_unit_req_debug(req, "read '%.*s'", res, (char *) data + off);
nxt_unit_req_debug(req, "read '%.*s'", (int) res, (char *) data + off);
(*env)->ReleasePrimitiveArrayCritical(env, b, data, 0);

View File

@@ -971,8 +971,10 @@ nxt_unit_process_req_headers(nxt_unit_ctx_t *ctx, nxt_unit_recv_msg_t *recv_msg)
req_impl->websocket = 0;
nxt_unit_debug(ctx, "#%"PRIu32": %.*s %.*s (%d)", recv_msg->stream,
(int) r->method_length, nxt_unit_sptr_get(&r->method),
(int) r->target_length, nxt_unit_sptr_get(&r->target),
(int) r->method_length,
(char *) nxt_unit_sptr_get(&r->method),
(int) r->target_length,
(char *) nxt_unit_sptr_get(&r->target),
(int) r->content_length);
lib = nxt_container_of(ctx->unit, nxt_unit_impl_t, unit);
@@ -2084,7 +2086,7 @@ nxt_unit_mmap_buf_send(nxt_unit_ctx_t *ctx, uint32_t stream,
nxt_unit_debug(ctx, "process %d allocated_chunks %d",
mmap_buf->process->pid,
mmap_buf->process->outgoing.allocated_chunks);
(int) mmap_buf->process->outgoing.allocated_chunks);
} else {
if (nxt_slow_path(mmap_buf->plain_ptr == NULL
@@ -2972,7 +2974,7 @@ unlock:
nxt_unit_debug(ctx, "process %d allocated_chunks %d",
process->pid,
process->outgoing.allocated_chunks);
(int) process->outgoing.allocated_chunks);
pthread_mutex_unlock(&process->outgoing.mutex);
@@ -3691,7 +3693,7 @@ nxt_unit_mmap_release(nxt_unit_ctx_t *ctx,
nxt_unit_debug(ctx, "process %d allocated_chunks %d",
process->pid,
process->outgoing.allocated_chunks);
(int) process->outgoing.allocated_chunks);
}
if (hdr->dst_pid == lib->pid

View File

@@ -356,10 +356,29 @@ int nxt_unit_websocket_retain(nxt_unit_websocket_frame_t *ws);
void nxt_unit_websocket_done(nxt_unit_websocket_frame_t *ws);
void nxt_unit_log(nxt_unit_ctx_t *ctx, int level, const char* fmt, ...);
#if defined __has_attribute
#if __has_attribute(format)
#define NXT_ATTR_FORMAT __attribute__((format(printf, 3, 4)))
#endif
#endif
#if !defined(NXT_ATTR_FORMAT)
#define NXT_ATTR_FORMAT
#endif
void nxt_unit_log(nxt_unit_ctx_t *ctx, int level, const char* fmt, ...)
NXT_ATTR_FORMAT;
void nxt_unit_req_log(nxt_unit_request_info_t *req, int level,
const char* fmt, ...);
const char* fmt, ...) NXT_ATTR_FORMAT;
#if (NXT_DEBUG)

View File

@@ -166,7 +166,7 @@ nxt_perl_psgi_io_error_write(PerlInterpreter *my_perl,
nxt_perl_psgi_input_t *input;
input = (nxt_perl_psgi_input_t *) arg->ctx;
nxt_unit_req_error(input->req, "Perl: %s", vbuf);
nxt_unit_req_error(input->req, "Perl: %s", (const char*) vbuf);
return (long) length;
}