projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove all remaining sessiond kernel command
[lttng-tools.git]
/
liblttsessiondcomm
/
liblttsessiondcomm.c
diff --git
a/liblttsessiondcomm/liblttsessiondcomm.c
b/liblttsessiondcomm/liblttsessiondcomm.c
index 449a1fbed179045f51d5472ced2bf1bb054928ee..9313a34c5d57eba26190e0b07075dea2d7c1ab1b 100644
(file)
--- a/
liblttsessiondcomm/liblttsessiondcomm.c
+++ b/
liblttsessiondcomm/liblttsessiondcomm.c
@@
-3,8
+3,8
@@
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation;
either
version 2
- * of the License
, or (at your option) any later version
.
+ * as published by the Free Software Foundation;
only
version 2
+ * of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@
-26,6
+26,7
@@
#include <sys/types.h>
#include <sys/un.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/un.h>
#include <unistd.h>
+#include <assert.h>
#include "liblttsessiondcomm.h"
#include "liblttsessiondcomm.h"
@@
-223,12
+224,10
@@
int lttcomm_listen_unix_sock(int sock)
*/
ssize_t lttcomm_recv_unix_sock(int sock, void *buf, size_t len)
{
*/
ssize_t lttcomm_recv_unix_sock(int sock, void *buf, size_t len)
{
- struct msghdr msg;
+ struct msghdr msg
= { 0 }
;
struct iovec iov[1];
ssize_t ret = -1;
struct iovec iov[1];
ssize_t ret = -1;
- memset(&msg, 0, sizeof(msg));
-
iov[0].iov_base = buf;
iov[0].iov_len = len;
msg.msg_iov = iov;
iov[0].iov_base = buf;
iov[0].iov_len = len;
msg.msg_iov = iov;
@@
-250,12
+249,10
@@
ssize_t lttcomm_recv_unix_sock(int sock, void *buf, size_t len)
*/
ssize_t lttcomm_send_unix_sock(int sock, void *buf, size_t len)
{
*/
ssize_t lttcomm_send_unix_sock(int sock, void *buf, size_t len)
{
- struct msghdr msg;
+ struct msghdr msg
= { 0 }
;
struct iovec iov[1];
ssize_t ret = -1;
struct iovec iov[1];
ssize_t ret = -1;
- memset(&msg, 0, sizeof(msg));
-
iov[0].iov_base = buf;
iov[0].iov_len = len;
msg.msg_iov = iov;
iov[0].iov_base = buf;
iov[0].iov_len = len;
msg.msg_iov = iov;
@@
-294,23
+291,29
@@
int lttcomm_close_unix_sock(int sock)
*/
ssize_t lttcomm_send_fds_unix_sock(int sock, void *buf, int *fds, size_t nb_fd, size_t len)
{
*/
ssize_t lttcomm_send_fds_unix_sock(int sock, void *buf, int *fds, size_t nb_fd, size_t len)
{
- struct msghdr msg;
+ struct msghdr msg
= { 0 }
;
struct cmsghdr *cmptr;
struct iovec iov[1];
ssize_t ret = -1;
unsigned int sizeof_fds = nb_fd * sizeof(int);
char tmp[CMSG_SPACE(sizeof_fds)];
struct cmsghdr *cmptr;
struct iovec iov[1];
ssize_t ret = -1;
unsigned int sizeof_fds = nb_fd * sizeof(int);
char tmp[CMSG_SPACE(sizeof_fds)];
- memset(&msg, 0, sizeof(msg));
+ /*
+ * Note: the consumerd receiver only supports receiving one FD per
+ * message.
+ */
+ assert(nb_fd == 1);
msg.msg_control = (caddr_t)tmp;
msg.msg_controllen = CMSG_LEN(sizeof_fds);
cmptr = CMSG_FIRSTHDR(&msg);
msg.msg_control = (caddr_t)tmp;
msg.msg_controllen = CMSG_LEN(sizeof_fds);
cmptr = CMSG_FIRSTHDR(&msg);
- cmptr->cmsg_len = CMSG_LEN(sizeof_fds);
cmptr->cmsg_level = SOL_SOCKET;
cmptr->cmsg_type = SCM_RIGHTS;
cmptr->cmsg_level = SOL_SOCKET;
cmptr->cmsg_type = SCM_RIGHTS;
+ cmptr->cmsg_len = CMSG_LEN(sizeof_fds);
memcpy(CMSG_DATA(cmptr), fds, sizeof_fds);
memcpy(CMSG_DATA(cmptr), fds, sizeof_fds);
+ /* Sum of the length of all control messages in the buffer: */
+ msg.msg_controllen = cmptr->cmsg_len;
iov[0].iov_base = buf;
iov[0].iov_len = len;
iov[0].iov_base = buf;
iov[0].iov_len = len;
This page took
0.025405 seconds
and
4
git commands to generate.