| 1 | #ifndef _LTTNG_UST_ABI_H |
| 2 | #define _LTTNG_UST_ABI_H |
| 3 | |
| 4 | /* |
| 5 | * lttng-ust-abi.h |
| 6 | * |
| 7 | * Copyright 2010-2011 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 8 | * |
| 9 | * LTTng-UST ABI header |
| 10 | * |
| 11 | * Dual LGPL v2.1/GPL v2 license. |
| 12 | */ |
| 13 | |
| 14 | #include <stdint.h> |
| 15 | |
| 16 | #define LTTNG_UST_SYM_NAME_LEN 128 |
| 17 | |
| 18 | #define LTTNG_UST_COMM_VERSION_MAJOR 0 |
| 19 | #define LTTNG_UST_COMM_VERSION_MINOR 1 |
| 20 | |
| 21 | enum lttng_ust_instrumentation { |
| 22 | LTTNG_UST_TRACEPOINT = 0, |
| 23 | LTTNG_UST_PROBE = 1, |
| 24 | LTTNG_UST_FUNCTION = 2, |
| 25 | }; |
| 26 | |
| 27 | enum lttng_ust_output { |
| 28 | LTTNG_UST_MMAP = 0, |
| 29 | }; |
| 30 | |
| 31 | struct lttng_ust_tracer_version { |
| 32 | uint32_t version; |
| 33 | uint32_t patchlevel; |
| 34 | uint32_t sublevel; |
| 35 | }; |
| 36 | |
| 37 | struct lttng_ust_channel { |
| 38 | int overwrite; /* 1: overwrite, 0: discard */ |
| 39 | uint64_t subbuf_size; /* in bytes */ |
| 40 | uint64_t num_subbuf; |
| 41 | unsigned int switch_timer_interval; /* usecs */ |
| 42 | unsigned int read_timer_interval; /* usecs */ |
| 43 | enum lttng_ust_output output; /* output mode */ |
| 44 | }; |
| 45 | |
| 46 | struct lttng_ust_event { |
| 47 | char name[LTTNG_UST_SYM_NAME_LEN]; /* event name */ |
| 48 | enum lttng_ust_instrumentation instrumentation; |
| 49 | /* Per instrumentation type configuration */ |
| 50 | union { |
| 51 | } u; |
| 52 | }; |
| 53 | |
| 54 | enum lttng_ust_context_type { |
| 55 | LTTNG_UST_CONTEXT_VTID = 0, |
| 56 | }; |
| 57 | |
| 58 | struct lttng_ust_context { |
| 59 | enum lttng_ust_context_type ctx; |
| 60 | union { |
| 61 | } u; |
| 62 | }; |
| 63 | |
| 64 | #define _UST_CMD(minor) (minor) |
| 65 | #define _UST_CMDR(minor, type) (minor) |
| 66 | #define _UST_CMDW(minor, type) (minor) |
| 67 | |
| 68 | /* Handled by object descriptor */ |
| 69 | #define LTTNG_UST_RELEASE _UST_CMD(0x1) |
| 70 | |
| 71 | /* Handled by object cmd */ |
| 72 | |
| 73 | /* LTTng-UST commands */ |
| 74 | #define LTTNG_UST_SESSION _UST_CMD(0x40) |
| 75 | #define LTTNG_UST_TRACER_VERSION \ |
| 76 | _UST_CMDR(0x41, struct lttng_ust_tracer_version) |
| 77 | #define LTTNG_UST_TRACEPOINT_LIST _UST_CMD(0x42) |
| 78 | #define LTTNG_UST_WAIT_QUIESCENT _UST_CMD(0x43) |
| 79 | |
| 80 | /* Session FD commands */ |
| 81 | #define LTTNG_UST_METADATA \ |
| 82 | _UST_CMDW(0x50, struct lttng_ust_channel) |
| 83 | #define LTTNG_UST_CHANNEL \ |
| 84 | _UST_CMDW(0x51, struct lttng_ust_channel) |
| 85 | #define LTTNG_UST_SESSION_START _UST_CMD(0x52) |
| 86 | #define LTTNG_UST_SESSION_STOP _UST_CMD(0x53) |
| 87 | |
| 88 | /* Channel FD commands */ |
| 89 | #define LTTNG_UST_STREAM _UST_CMD(0x60) |
| 90 | #define LTTNG_UST_EVENT \ |
| 91 | _UST_CMDW(0x61, struct lttng_ust_event) |
| 92 | |
| 93 | /* Event and Channel FD commands */ |
| 94 | #define LTTNG_UST_CONTEXT \ |
| 95 | _UST_CMDW(0x70, struct lttng_ust_context) |
| 96 | |
| 97 | /* Event, Channel and Session commands */ |
| 98 | #define LTTNG_UST_ENABLE _UST_CMD(0x80) |
| 99 | #define LTTNG_UST_DISABLE _UST_CMD(0x81) |
| 100 | |
| 101 | #define LTTNG_UST_ROOT_HANDLE 0 |
| 102 | |
| 103 | struct obj; |
| 104 | |
| 105 | struct objd_ops { |
| 106 | long (*cmd)(int objd, unsigned int cmd, unsigned long arg); |
| 107 | int (*release)(int objd); |
| 108 | }; |
| 109 | |
| 110 | /* Create root handle. Always ID 0. */ |
| 111 | int lttng_abi_create_root_handle(void); |
| 112 | |
| 113 | const struct objd_ops *objd_ops(int id); |
| 114 | int objd_unref(int id); |
| 115 | |
| 116 | void lttng_ust_abi_exit(void); |
| 117 | void ltt_events_exit(void); |
| 118 | |
| 119 | #endif /* _LTTNG_UST_ABI_H */ |