Add kernel uid/gid contexts
[lttng-tools.git] / src / common / config / session-config.c
index 595e743b45de0cc3de1e7a82de8b1a0d635e7bf7..c2ae5e1201fb0cf0b4ef51c438ee74d48fe6d86f 100644 (file)
@@ -177,7 +177,7 @@ const char * const config_loglevel_type_single = "SINGLE";
 const char * const config_event_type_all = "ALL";
 const char * const config_event_type_tracepoint = "TRACEPOINT";
 const char * const config_event_type_probe = "PROBE";
-const char * const config_event_type_userspace_probe = "USERSPACE_PROBE";
+LTTNG_HIDDEN const char * const config_event_type_userspace_probe = "USERSPACE_PROBE";
 const char * const config_event_type_function = "FUNCTION";
 const char * const config_event_type_function_entry = "FUNCTION_ENTRY";
 const char * const config_event_type_noop = "NOOP";
@@ -205,6 +205,25 @@ LTTNG_HIDDEN const char * const config_event_context_need_reschedule = "NEED_RES
 LTTNG_HIDDEN const char * const config_event_context_migratable = "MIGRATABLE";
 LTTNG_HIDDEN const char * const config_event_context_callstack_user= "CALLSTACK_USER";
 LTTNG_HIDDEN const char * const config_event_context_callstack_kernel = "CALLSTACK_KERNEL";
+LTTNG_HIDDEN const char * const config_event_context_cgroup_ns = "CGROUP_NS";
+LTTNG_HIDDEN const char * const config_event_context_ipc_ns = "IPC_NS";
+LTTNG_HIDDEN const char * const config_event_context_mnt_ns = "MNT_NS";
+LTTNG_HIDDEN const char * const config_event_context_net_ns = "NET_NS";
+LTTNG_HIDDEN const char * const config_event_context_pid_ns = "PID_NS";
+LTTNG_HIDDEN const char * const config_event_context_user_ns = "USER_NS";
+LTTNG_HIDDEN const char * const config_event_context_uts_ns = "UTS_NS";
+LTTNG_HIDDEN const char * const config_event_context_uid = "UID";
+LTTNG_HIDDEN const char * const config_event_context_euid = "EUID";
+LTTNG_HIDDEN const char * const config_event_context_suid = "SUID";
+LTTNG_HIDDEN const char * const config_event_context_gid = "GID";
+LTTNG_HIDDEN const char * const config_event_context_egid = "EGID";
+LTTNG_HIDDEN const char * const config_event_context_sgid = "SGID";
+LTTNG_HIDDEN const char * const config_event_context_vuid = "VUID";
+LTTNG_HIDDEN const char * const config_event_context_veuid = "VEUID";
+LTTNG_HIDDEN const char * const config_event_context_vsuid = "VSUID";
+LTTNG_HIDDEN const char * const config_event_context_vgid = "VGID";
+LTTNG_HIDDEN const char * const config_event_context_vegid = "VEGID";
+LTTNG_HIDDEN const char * const config_event_context_vsgid = "VSGID";
 
 /* Deprecated symbols */
 const char * const config_element_perf;
@@ -250,7 +269,7 @@ int config_get_section_entries(const char *override_path, const char *section,
                config_entry_handler_cb handler, void *user_data)
 {
        int ret = 0;
-       char *path;
+       const char *path;
        FILE *config_file = NULL;
        struct handler_filter_args filter = { section, handler, user_data };
 
@@ -1047,6 +1066,63 @@ int get_context_type(xmlChar *context_type)
        } else if (!strcmp((char *) context_type,
                config_event_context_callstack_kernel)) {
                ret = LTTNG_EVENT_CONTEXT_CALLSTACK_KERNEL;
+       } else if (!strcmp((char *) context_type,
+               config_event_context_cgroup_ns)) {
+               ret = LTTNG_EVENT_CONTEXT_CGROUP_NS;
+       } else if (!strcmp((char *) context_type,
+               config_event_context_ipc_ns)) {
+               ret = LTTNG_EVENT_CONTEXT_IPC_NS;
+       } else if (!strcmp((char *) context_type,
+               config_event_context_mnt_ns)) {
+               ret = LTTNG_EVENT_CONTEXT_MNT_NS;
+       } else if (!strcmp((char *) context_type,
+               config_event_context_net_ns)) {
+               ret = LTTNG_EVENT_CONTEXT_NET_NS;
+       } else if (!strcmp((char *) context_type,
+               config_event_context_pid_ns)) {
+               ret = LTTNG_EVENT_CONTEXT_PID_NS;
+       } else if (!strcmp((char *) context_type,
+               config_event_context_user_ns)) {
+               ret = LTTNG_EVENT_CONTEXT_USER_NS;
+       } else if (!strcmp((char *) context_type,
+               config_event_context_uts_ns)) {
+               ret = LTTNG_EVENT_CONTEXT_UTS_NS;
+       } else if (!strcmp((char *) context_type,
+               config_event_context_uid)) {
+               ret = LTTNG_EVENT_CONTEXT_UID;
+       } else if (!strcmp((char *) context_type,
+               config_event_context_euid)) {
+               ret = LTTNG_EVENT_CONTEXT_EUID;
+       } else if (!strcmp((char *) context_type,
+               config_event_context_suid)) {
+               ret = LTTNG_EVENT_CONTEXT_SUID;
+       } else if (!strcmp((char *) context_type,
+               config_event_context_gid)) {
+               ret = LTTNG_EVENT_CONTEXT_GID;
+       } else if (!strcmp((char *) context_type,
+               config_event_context_egid)) {
+               ret = LTTNG_EVENT_CONTEXT_EGID;
+       } else if (!strcmp((char *) context_type,
+               config_event_context_sgid)) {
+               ret = LTTNG_EVENT_CONTEXT_SGID;
+       } else if (!strcmp((char *) context_type,
+               config_event_context_vuid)) {
+               ret = LTTNG_EVENT_CONTEXT_VUID;
+       } else if (!strcmp((char *) context_type,
+               config_event_context_veuid)) {
+               ret = LTTNG_EVENT_CONTEXT_VEUID;
+       } else if (!strcmp((char *) context_type,
+               config_event_context_vsuid)) {
+               ret = LTTNG_EVENT_CONTEXT_VSUID;
+       } else if (!strcmp((char *) context_type,
+               config_event_context_vgid)) {
+               ret = LTTNG_EVENT_CONTEXT_VGID;
+       } else if (!strcmp((char *) context_type,
+               config_event_context_vegid)) {
+               ret = LTTNG_EVENT_CONTEXT_VEGID;
+       } else if (!strcmp((char *) context_type,
+               config_event_context_vsgid)) {
+               ret = LTTNG_EVENT_CONTEXT_VSGID;
        } else {
                goto error;
        }
@@ -1633,6 +1709,7 @@ process_userspace_probe_tracepoint_attribute_node(
                                lttng_userspace_probe_location_tracepoint_create(
                                                binary_path, provider_name,
                                                probe_name, lookup_method);
+                       lookup_method = NULL;
                        goto error;
                }
        }
@@ -3531,7 +3608,7 @@ int config_load_session(const char *path, const char *session_name,
        }
 
        if (!path) {
-               char *home_path;
+               const char *home_path;
                const char *sys_path;
 
                /* Try home path */
This page took 0.024818 seconds and 4 git commands to generate.