Add lttng-kconsumerd.h
authorDavid Goulet <david.goulet@polymtl.ca>
Fri, 27 May 2011 20:40:44 +0000 (16:40 -0400)
committerDavid Goulet <david.goulet@polymtl.ca>
Fri, 27 May 2011 21:14:40 +0000 (17:14 -0400)
This header files contains data shared between the kconsumerd daemon and
the session daemon.

Signed-off-by: David Goulet <david.goulet@polymtl.ca>
include/Makefile.am
include/lttng-kconsumerd.h [new file with mode: 0644]
include/lttng-share.h
kconsumerd/kconsumerd.c
kconsumerd/kconsumerd.h
liblttsessiondcomm/liblttsessiondcomm.h
ltt-sessiond/main.c

index 8f0946be52ce0afe7196a4ac886dc409c3397ea6..f86ccda3de80f5b51b0eaa724e7338eaf82a6cf7 100644 (file)
@@ -1,4 +1,4 @@
 nobase_include_HEADERS = \
        lttng/liblttngctl.h
 
-noinst_HEADERS = lttngerr.h
+noinst_HEADERS = lttngerr.h lttng-kernel.h lttng-kconsumerd.h lttng-share.h
diff --git a/include/lttng-kconsumerd.h b/include/lttng-kconsumerd.h
new file mode 100644 (file)
index 0000000..fa10ee2
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2011 - Julien Desfossez <julien.desfossez@polymtl.ca>
+ *                      David Goulet <david.goulet@polymtl.ca>
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+#ifndef _LTTNG_KCONSUMERD_H
+#define _LTTNG_KCONSUMERD_H
+
+#include "lttng-share.h"
+
+/* Kernel consumer path */
+#define KCONSUMERD_PATH                                                LTTNG_RUNDIR "/kconsumerd"
+#define KCONSUMERD_CMD_SOCK_PATH                       KCONSUMERD_PATH "/command"
+#define KCONSUMERD_ERR_SOCK_PATH                       KCONSUMERD_PATH "/error"
+
+/* Commands for kconsumerd */
+enum kconsumerd_command {
+       ADD_STREAM,
+       UPDATE_STREAM, /* pause, delete, start depending on fd state */
+       STOP, /* delete all */
+};
+
+/* State of each fd in consumerd */
+enum kconsumerd_fd_state {
+       ACTIVE_FD,
+       PAUSE_FD,
+       DELETE_FD,
+};
+
+#endif /* _LTTNG_KCONSUMERD_H */
index 1965ffcb1e47f0cf90a7dc0fe3a4586610797b93..f61e24dbbb05c9f145ee1a14cab585e8900b755d 100644 (file)
@@ -24,4 +24,6 @@
 typedef uint32_t u32;
 typedef uint64_t u64;
 
+#define LTTNG_RUNDIR        "/var/run/lttng"
+
 #endif /* _LTTNG_SHARE_H */
index 592bc0842aa084683c512fe5fafcdadbfe405044..69aa47a6e5f0b175113b407eb91429c451b9af5b 100644 (file)
@@ -392,7 +392,7 @@ end:
  * Update a fd according to what we just received
  */
 static void change_fd_state(int sessiond_fd,
-               enum lttcomm_kconsumerd_fd_state state)
+               enum kconsumerd_fd_state state)
 {
        struct ltt_kconsumerd_fd *iter;
        cds_list_for_each_entry(iter, &kconsumerd_fd_list.head, list) {
@@ -411,7 +411,7 @@ static void change_fd_state(int sessiond_fd,
  * Returns the size of received data
  */
 static int consumerd_recv_fd(int sfd, int size,
-               enum lttcomm_consumerd_command cmd_type)
+               enum kconsumerd_command cmd_type)
 {
        struct msghdr msg;
        struct iovec iov[1];
@@ -459,7 +459,7 @@ static int consumerd_recv_fd(int sfd, int size,
                DBG("Receive : expecting %d fds", nb_fd);
                for (i = 0; i < nb_fd; i++) {
                        switch (cmd_type) {
-                       case LTTCOMM_ADD_STREAM:
+                       case ADD_STREAM:
                                DBG("add_fd %s (%d)", buf[i].path_name, ((int *)CMSG_DATA(cmsg))[i]);
                                ret = add_fd(&buf[i], ((int *)CMSG_DATA(cmsg))[i]);
                                if (ret < 0) {
@@ -467,7 +467,7 @@ static int consumerd_recv_fd(int sfd, int size,
                                        goto end;
                                }
                                break;
-                       case LTTCOMM_UPDATE_STREAM:
+                       case UPDATE_STREAM:
                                change_fd_state(buf[i].fd, buf[i].state);
                                break;
                        default:
index 6c78663f5e67900cfbbed0129a8f75c4d65929d1..2aff4ef5011218c9d319884797f18aeab38d8b15 100644 (file)
@@ -19,6 +19,8 @@
 #ifndef _LTT_KCONSUMERD_H
 #define _LTT_KCONSUMERD_H
 
+#include "lttng-kconsumerd.h"
+
 struct ltt_kconsumerd_fd_list {
        struct cds_list_head head;
 };
@@ -34,7 +36,7 @@ struct ltt_kconsumerd_fd {
        int out_fd; /* output file to write the data */
        off_t out_fd_offset; /* write position in the output file descriptor */
        char path_name[PATH_MAX]; /* tracefile name */
-       enum lttcomm_kconsumerd_fd_state state;
+       enum kconsumerd_fd_state state;
        unsigned long max_sb_size; /* the subbuffer size for this channel */
 };
 
index 6c46ac2553908fa18fe248e0dafe38c8bc7556f0..d63f9b62cc89334edc01036ec4e310df89dcfe27 100644 (file)
 
 #include "lttng-share.h"
 
-#define LTTNG_RUNDIR                                           "/var/run/lttng"
-
 /* Default unix socket path */
 #define DEFAULT_GLOBAL_CLIENT_UNIX_SOCK                LTTNG_RUNDIR "/client-ltt-sessiond"
 #define DEFAULT_GLOBAL_APPS_UNIX_SOCK          LTTNG_RUNDIR "/apps-ltt-sessiond"
 #define DEFAULT_HOME_APPS_UNIX_SOCK                    "%s/.apps-ltt-sessiond"
 #define DEFAULT_HOME_CLIENT_UNIX_SOCK          "%s/.client-ltt-sessiond"
 
-/* Kernel consumer path */
-#define KCONSUMERD_PATH                                                LTTNG_RUNDIR "/kconsumerd"
-#define KCONSUMERD_CMD_SOCK_PATH                       KCONSUMERD_PATH "/command"
-#define KCONSUMERD_ERR_SOCK_PATH                       KCONSUMERD_PATH "/error"
-
 /* Queue size of listen(2) */
 #define MAX_LISTEN 10
 
@@ -132,20 +125,6 @@ enum lttcomm_return_code {
        LTTCOMM_NR,                                             /* Last element */
 };
 
-/* commands for kconsumerd */
-enum lttcomm_consumerd_command {
-       LTTCOMM_ADD_STREAM = 1100,
-       LTTCOMM_UPDATE_STREAM, /* pause, delete, start depending on fd state */
-       LTTCOMM_STOP, /* delete all */
-};
-
-/* state of each fd in consumerd */
-enum lttcomm_kconsumerd_fd_state {
-       ACTIVE_FD,
-       PAUSE_FD,
-       DELETE_FD,
-};
-
 /*
  * Data structure received from lttng client to session daemon.
  */
index 4b2fb52c2dd256e5a68809af7107d1dc78631c29..5327804c33b3ec62fcfb6905f572bda798e97242 100644 (file)
@@ -45,6 +45,7 @@
 #include "ust-ctl.h"
 #include "session.h"
 #include "traceable-app.h"
+#include "lttng-kconsumerd.h"
 
 /*
  * TODO:
@@ -584,7 +585,7 @@ static int send_kconsumerd_fds(int sock, struct ltt_kernel_session *session)
 
        /* Setup header */
        lkh.payload_size = nb_fd * sizeof(struct lttcomm_kconsumerd_msg);
-       lkh.cmd_type = LTTCOMM_ADD_STREAM;
+       lkh.cmd_type = ADD_STREAM;
 
        DBG("Sending kconsumerd header");
 
This page took 0.028644 seconds and 4 git commands to generate.