| 1 | /* |
| 2 | * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; either version 2 |
| 7 | * of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 17 | */ |
| 18 | |
| 19 | #ifndef _LIBLTTNGCTL_H |
| 20 | #define _LIBLTTNGCTL_H |
| 21 | |
| 22 | #include <limits.h> |
| 23 | #include <stdint.h> |
| 24 | #include <uuid/uuid.h> |
| 25 | |
| 26 | /* Default unix group name for tracing. |
| 27 | */ |
| 28 | #define DEFAULT_TRACING_GROUP "tracing" |
| 29 | |
| 30 | /* Environment variable to set session daemon |
| 31 | * binary path. |
| 32 | */ |
| 33 | #define LTTNG_SESSIOND_PATH_ENV "LTTNG_SESSIOND_PATH" |
| 34 | |
| 35 | /* UUID string length (including \0) */ |
| 36 | #define UUID_STR_LEN 37 |
| 37 | /* UUID short string version length (including \0) */ |
| 38 | #define UUID_SHORT_STR_LEN 9 |
| 39 | |
| 40 | /* Trace type for lttng_trace. |
| 41 | */ |
| 42 | enum lttng_trace_type { |
| 43 | KERNEL, USERSPACE, |
| 44 | }; |
| 45 | |
| 46 | /* Simple structure representing a session. |
| 47 | */ |
| 48 | struct lttng_session { |
| 49 | char name[NAME_MAX]; |
| 50 | uuid_t uuid; |
| 51 | }; |
| 52 | |
| 53 | /* Simple trace representation. |
| 54 | */ |
| 55 | struct lttng_trace { |
| 56 | char name[NAME_MAX]; |
| 57 | pid_t pid; |
| 58 | enum lttng_trace_type type; |
| 59 | }; |
| 60 | |
| 61 | extern int lttng_create_session(char *name); |
| 62 | extern int lttng_destroy_session(uuid_t *uuid); |
| 63 | extern int lttng_connect_sessiond(void); |
| 64 | extern int lttng_disconnect_sessiond(void); |
| 65 | extern int lttng_set_tracing_group(const char *name); |
| 66 | extern int lttng_check_session_daemon(void); |
| 67 | extern const char *lttng_get_readable_code(int code); |
| 68 | extern int lttng_ust_list_apps(pid_t **pids); |
| 69 | extern int lttng_list_sessions(struct lttng_session **sessions); |
| 70 | extern int lttng_list_traces(uuid_t *uuid, struct lttng_trace **traces); |
| 71 | extern void lttng_set_current_session_uuid(uuid_t *uuid); |
| 72 | extern int lttng_ust_create_trace(pid_t pid); |
| 73 | extern int lttng_ust_start_trace(pid_t pid); |
| 74 | extern int lttng_ust_stop_trace(pid_t pid); |
| 75 | |
| 76 | /* |
| 77 | * Kernel tracer control |
| 78 | */ |
| 79 | extern int lttng_kernel_enable_event(char *event_name); |
| 80 | extern int lttng_kernel_disable_event(char *event_name); |
| 81 | extern int lttng_kernel_create_session(void); |
| 82 | extern int lttng_kernel_start_tracing(void); |
| 83 | extern int lttng_kernel_stop_tracing(void); |
| 84 | extern int lttng_kernel_create_channel(void); |
| 85 | extern int lttng_kernel_create_stream(void); |
| 86 | extern int lttng_kernel_open_metadata(void); |
| 87 | |
| 88 | #endif /* _LIBLTTNGCTL_H */ |