From: David Goulet Date: Mon, 16 May 2011 17:19:17 +0000 (-0400) Subject: Add lttng-share header and change data type X-Git-Tag: v2.0-pre1~138 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=9bda164defe0c7ef5857d4ef59cc3b464f5a5404 Add lttng-share header and change data type Add the lttng-share.h file for common code needed all accross the lttng-tools tree. Session daemon communication library is refactored to use typedef uint32_t data type for enums and pid_t. Signed-off-by: David Goulet --- diff --git a/include/lttng-kernel.h b/include/lttng-kernel.h index b8eb45672..142de0706 100644 --- a/include/lttng-kernel.h +++ b/include/lttng-kernel.h @@ -21,9 +21,7 @@ #ifndef _LTTNG_KERNEL_H #define _LTTNG_KERNEL_H -#include - -typedef uint64_t u64; +#include "lttng-share.h" /* * LTTng DebugFS ABI structures. diff --git a/include/lttng-share.h b/include/lttng-share.h new file mode 100644 index 000000000..1965ffcb1 --- /dev/null +++ b/include/lttng-share.h @@ -0,0 +1,27 @@ +/* + * Copyright (C) - 2011 - David Goulet + * + * 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_SHARE_H +#define _LTTNG_SHARE_H + +#include + +typedef uint32_t u32; +typedef uint64_t u64; + +#endif /* _LTTNG_SHARE_H */ diff --git a/include/lttng/lttng.h b/include/lttng/lttng.h index f4b368f1f..e393397f3 100644 --- a/include/lttng/lttng.h +++ b/include/lttng/lttng.h @@ -37,8 +37,6 @@ /* UUID short string version length (including \0) */ #define UUID_SHORT_STR_LEN 9 -typedef uint64_t u64; - /* Trace type for lttng_trace. */ enum lttng_trace_type { diff --git a/liblttsessiondcomm/liblttsessiondcomm.h b/liblttsessiondcomm/liblttsessiondcomm.h index adb9a8d84..a1960a940 100644 --- a/liblttsessiondcomm/liblttsessiondcomm.h +++ b/liblttsessiondcomm/liblttsessiondcomm.h @@ -24,10 +24,7 @@ #include #include -/* - * FIXME: 32, 64bit enums -> uint32_t uint64_t for data exchange. - * Same for pid_t. - */ +#include "lttng-share.h" #define LTTNG_RUNDIR "/var/run/lttng" @@ -114,15 +111,14 @@ enum lttcomm_kconsumerd_fd_state { }; /* - * Data structure for ltt-session received message + * Data structure received from lttng client to session daemon. */ struct lttcomm_session_msg { - /* Common data to almost all command */ - enum lttcomm_sessiond_command cmd_type; + u32 cmd_type; /* enum lttcomm_sessiond_command */ uuid_t session_id; char trace_name[NAME_MAX]; char session_name[NAME_MAX]; - pid_t pid; + u32 pid; /* pid_t */ union { struct { int auto_session; @@ -151,18 +147,14 @@ struct lttcomm_session_msg { /* * Data structure for the response from sessiond to the lttng client. - * - * This data structure is the control struct use in - * the header of the transmission. NEVER put variable - * size data in here. */ struct lttcomm_lttng_header { - enum lttcomm_sessiond_command cmd_type; - enum lttcomm_return_code ret_code; + u32 cmd_type; /* enum lttcomm_sessiond_command */ + u32 ret_code; /* enum lttcomm_return_code */ + u32 pid; /* pid_t */ + u32 payload_size; uuid_t session_id; - pid_t pid; char trace_name[NAME_MAX]; - unsigned int payload_size; }; /* @@ -172,9 +164,9 @@ struct lttcomm_lttng_header { * how many lttcomm_kconsumerd_msg it is about to receive */ struct lttcomm_kconsumerd_header { - unsigned int payload_size; - enum lttcomm_consumerd_command cmd_type; - enum lttcomm_return_code ret_code; + u32 payload_size; + u32 cmd_type; /* enum lttcomm_consumerd_command */ + u32 ret_code; /* enum lttcomm_return_code */ }; /* lttcomm_kconsumerd_msg represents a file descriptor to consume the @@ -183,7 +175,7 @@ struct lttcomm_kconsumerd_header { struct lttcomm_kconsumerd_msg { char path_name[PATH_MAX]; int fd; - enum lttcomm_kconsumerd_fd_state state; + u32 state; /* enum lttcomm_kconsumerd_fd_state */ }; extern int lttcomm_create_unix_sock(const char *pathname);