nobase_include_HEADERS = \
lttng/liblttngctl.h
-noinst_HEADERS = lttngerr.h
+noinst_HEADERS = lttngerr.h lttng-kernel.h lttng-kconsumerd.h lttng-share.h
--- /dev/null
+/*
+ * 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 */
typedef uint32_t u32;
typedef uint64_t u64;
+#define LTTNG_RUNDIR "/var/run/lttng"
+
#endif /* _LTTNG_SHARE_H */
* 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) {
* 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];
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) {
goto end;
}
break;
- case LTTCOMM_UPDATE_STREAM:
+ case UPDATE_STREAM:
change_fd_state(buf[i].fd, buf[i].state);
break;
default:
#ifndef _LTT_KCONSUMERD_H
#define _LTT_KCONSUMERD_H
+#include "lttng-kconsumerd.h"
+
struct ltt_kconsumerd_fd_list {
struct cds_list_head head;
};
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 */
};
#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
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.
*/
#include "ust-ctl.h"
#include "session.h"
#include "traceable-app.h"
+#include "lttng-kconsumerd.h"
/*
* TODO:
/* 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");