diff options
author | Max Romanov <max.romanov@nginx.com> | 2017-07-07 16:01:34 +0300 |
---|---|---|
committer | Max Romanov <max.romanov@nginx.com> | 2017-07-07 16:01:34 +0300 |
commit | 61008a7c0b45fe55f3f611c61f81e569e6baee30 (patch) | |
tree | 4625f1c9ee946a0222f16dfe0ad7a298b3d91812 /src | |
parent | 264ae98d49c15e068e5ace88578856bbeb901b82 (diff) | |
download | unit-61008a7c0b45fe55f3f611c61f81e569e6baee30.tar.gz unit-61008a7c0b45fe55f3f611c61f81e569e6baee30.tar.bz2 |
Cosmetic changes to remove some annoying valgrind messages.
Diffstat (limited to '')
-rw-r--r-- | src/nxt_clang.h | 2 | ||||
-rw-r--r-- | src/nxt_port.h | 4 | ||||
-rw-r--r-- | src/nxt_socketpair.c | 8 |
3 files changed, 12 insertions, 2 deletions
diff --git a/src/nxt_clang.h b/src/nxt_clang.h index b69dd6af..65bd7940 100644 --- a/src/nxt_clang.h +++ b/src/nxt_clang.h @@ -230,4 +230,6 @@ nxt_trunc_ptr(p, a) \ (u_char *) ((uintptr_t) (p) & ~((uintptr_t) (a) - 1)) +#define NXT_PACKED __attribute__((packed)) + #endif /* _NXT_CLANG_H_INCLUDED_ */ diff --git a/src/nxt_port.h b/src/nxt_port.h index 927e0e2e..109071aa 100644 --- a/src/nxt_port.h +++ b/src/nxt_port.h @@ -30,7 +30,7 @@ typedef struct { /* Message data send using mmap, next chunk is a nxt_port_mmap_msg_t. */ uint8_t mmap; /* 1 bit */ -} nxt_port_msg_t; +} NXT_PACKED nxt_port_msg_t; typedef struct { @@ -91,7 +91,7 @@ typedef struct { size_t max_size; size_t max_share; nxt_process_type_t type:8; -} nxt_port_msg_new_port_t; +} NXT_PACKED nxt_port_msg_new_port_t; /* diff --git a/src/nxt_socketpair.c b/src/nxt_socketpair.c index e1c303dd..efa0f486 100644 --- a/src/nxt_socketpair.c +++ b/src/nxt_socketpair.c @@ -188,6 +188,10 @@ nxt_sendmsg(nxt_socket_t s, nxt_fd_t fd, nxt_iobuf_t *iob, nxt_uint_t niob) msg.msg_control = (caddr_t) &cmsg; msg.msg_controllen = sizeof(cmsg); +#if (NXT_VALGRIND) + nxt_memzero(&cmsg, sizeof(cmsg)); +#endif + cmsg.cm.cmsg_len = CMSG_LEN(sizeof(int)); cmsg.cm.cmsg_level = SOL_SOCKET; cmsg.cm.cmsg_type = SCM_RIGHTS; @@ -231,6 +235,10 @@ nxt_recvmsg(nxt_socket_t s, nxt_fd_t *fd, nxt_iobuf_t *iob, nxt_uint_t niob) *fd = -1; +#if (NXT_VALGRIND) + nxt_memzero(&cmsg, sizeof(cmsg)); +#endif + n = recvmsg(s, &msg, 0); if (n > 0 |