Reset handle table on destroy
[lttng-ust.git] / libust / lttng-ust-abi.c
index 01512128f24b478e9bea2bef795ba89eb04e97b7..ccaa17fa9ba56bbf3a9cf8a81b0d134ca27fe1bb 100644 (file)
  * by the caller.
  */
 
-struct obj;
-
-struct objd_ops {
-       long (*cmd)(int objd, unsigned int cmd, unsigned long arg);
-       int (*release)(int objd);
-};
-
 struct obj {
        union {
                struct {
@@ -131,10 +124,10 @@ void objd_set_private(int id, void *private_data)
        obj->u.s.private_data = private_data;
 }
 
-static
 const struct objd_ops *objd_ops(int id)
 {
        struct obj *obj = _objd_get(id);
+
        if (!obj)
                return NULL;
        return obj->u.s.ops;
@@ -195,6 +188,10 @@ void objd_table_destroy(void)
                        ops->release(i);
        }
        free(objd_table.array);
+       objd_table.array = NULL;
+       objd_table.len = 0;
+       objd_table.allocated_len = 0;
+       objd_table.freelist_head = -1;
 }
 
 /*
@@ -213,6 +210,16 @@ enum channel_type {
        METADATA_CHANNEL,
 };
 
+int lttng_abi_create_root_handle(void)
+{
+       int root_handle;
+
+       root_handle = objd_alloc(NULL, &lttng_ops);
+       assert(root_handle == 0);
+       return root_handle;
+}
+
+static
 int lttng_abi_create_session(void)
 {
        struct ltt_session *session;
@@ -355,7 +362,6 @@ create_error:
        return;         /* not allowed to return error */
 }
 
-static
 int lttng_abi_create_channel(int session_objd,
                             struct lttng_ust_channel *chan_param,
                             enum channel_type channel_type)
This page took 0.024936 seconds and 4 git commands to generate.