projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Rename liblttsessiondcomm to liblttng-sessiond-comm, install it.
[lttng-tools.git]
/
liblttkconsumerd
/
liblttkconsumerd.c
diff --git
a/liblttkconsumerd/liblttkconsumerd.c
b/liblttkconsumerd/liblttkconsumerd.c
index 1e86d28d0cc1ea9cf6afecfb22f554b040ebef13..9ad380c8dab5e8c1be679a0881890e929f355c57 100644
(file)
--- a/
liblttkconsumerd/liblttkconsumerd.c
+++ b/
liblttkconsumerd/liblttkconsumerd.c
@@
-28,6
+28,7
@@
#include <sys/types.h>
#include <unistd.h>
#include <urcu/list.h>
#include <sys/types.h>
#include <unistd.h>
#include <urcu/list.h>
+#include <assert.h>
#include "libkernelctl.h"
#include "liblttkconsumerd.h"
#include "libkernelctl.h"
#include "liblttkconsumerd.h"
@@
-176,6
+177,7
@@
static int kconsumerd_add_fd(struct lttcomm_kconsumerd_msg *buf, int consumerd_f
tmp_fd->state = buf->state;
tmp_fd->max_sb_size = buf->max_sb_size;
strncpy(tmp_fd->path_name, buf->path_name, PATH_MAX);
tmp_fd->state = buf->state;
tmp_fd->max_sb_size = buf->max_sb_size;
strncpy(tmp_fd->path_name, buf->path_name, PATH_MAX);
+ tmp_fd->path_name[PATH_MAX - 1] = '\0';
/* Opening the tracefile in write mode */
ret = open(tmp_fd->path_name,
/* Opening the tracefile in write mode */
ret = open(tmp_fd->path_name,
@@
-585,7
+587,6
@@
static int kconsumerd_consumerd_recv_fd(int sfd,
struct pollfd *kconsumerd_sockpoll, int size,
enum kconsumerd_command cmd_type)
{
struct pollfd *kconsumerd_sockpoll, int size,
enum kconsumerd_command cmd_type)
{
- struct msghdr msg;
struct iovec iov[1];
int ret = 0, i, tmp2;
struct cmsghdr *cmsg;
struct iovec iov[1];
int ret = 0, i, tmp2;
struct cmsghdr *cmsg;
@@
-596,8
+597,11
@@
static int kconsumerd_consumerd_recv_fd(int sfd,
/* the number of fds we are about to receive */
nb_fd = size / sizeof(struct lttcomm_kconsumerd_msg);
/* the number of fds we are about to receive */
nb_fd = size / sizeof(struct lttcomm_kconsumerd_msg);
+ /*
+ * nb_fd is the number of fds we receive. One fd per recvmsg.
+ */
for (i = 0; i < nb_fd; i++) {
for (i = 0; i < nb_fd; i++) {
-
memset(&msg, 0, sizeof(msg))
;
+
struct msghdr msg = { 0 }
;
/* Prepare to receive the structures */
iov[0].iov_base = &lkm;
/* Prepare to receive the structures */
iov[0].iov_base = &lkm;
@@
-631,12
+635,13
@@
static int kconsumerd_consumerd_recv_fd(int sfd,
kconsumerd_send_error(KCONSUMERD_ERROR_RECV_FD);
goto end;
}
kconsumerd_send_error(KCONSUMERD_ERROR_RECV_FD);
goto end;
}
+
/* if we received fds */
if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) {
switch (cmd_type) {
case ADD_STREAM:
/* if we received fds */
if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) {
switch (cmd_type) {
case ADD_STREAM:
- DBG("kconsumerd_add_fd %s (%d)", lkm.path_name, (
CMSG_DATA(cmsg)[0])
);
- ret = kconsumerd_add_fd(&lkm, (
CMSG_DATA(cmsg)[0])
);
+ DBG("kconsumerd_add_fd %s (%d)", lkm.path_name, (
(int *) CMSG_DATA(cmsg))[0]
);
+ ret = kconsumerd_add_fd(&lkm, (
(int *) CMSG_DATA(cmsg))[0]
);
if (ret < 0) {
kconsumerd_send_error(KCONSUMERD_OUTFD_ERROR);
goto end;
if (ret < 0) {
kconsumerd_send_error(KCONSUMERD_OUTFD_ERROR);
goto end;
@@
-1000,7
+1005,7
@@
end:
*/
void kconsumerd_cleanup(void)
{
*/
void kconsumerd_cleanup(void)
{
- struct kconsumerd_fd *iter;
+ struct kconsumerd_fd *iter
, *tmp
;
/* remove the socket file */
unlink(kconsumerd_command_sock_path);
/* remove the socket file */
unlink(kconsumerd_command_sock_path);
@@
-1010,7
+1015,7
@@
void kconsumerd_cleanup(void)
* running (after joining on the threads), no need to protect
* list iteration with mutex.
*/
* running (after joining on the threads), no need to protect
* list iteration with mutex.
*/
- cds_list_for_each_entry
(iter
, &kconsumerd_data.fd_list.head, list) {
+ cds_list_for_each_entry
_safe(iter, tmp
, &kconsumerd_data.fd_list.head, list) {
kconsumerd_del_fd(iter);
}
}
kconsumerd_del_fd(iter);
}
}
This page took
0.023928 seconds
and
4
git commands to generate.