#include <urcu/compiler.h>
#include <urcu/list.h>
#include <ust/lttng-events.h>
-#include "usterr_signal_safe.h"
+#include <ust/usterr-signal-safe.h>
#include "ust/core.h"
#include "ltt-tracer.h"
obj->u.s.f_count++;
}
-static
-void objd_unref(int id)
+int objd_unref(int id)
{
struct obj *obj = _objd_get(id);
+ if (!obj)
+ return -EINVAL;
if (!(--obj->u.s.f_count)) {
const struct objd_ops *ops = objd_ops(id);
ops->release(id);
objd_free(id);
}
+ return 0;
}
static
METADATA_CHANNEL,
};
-static
int lttng_abi_create_session(void)
{
struct ltt_session *session;
switch (context_param->ctx) {
case LTTNG_UST_CONTEXT_VTID:
- return lttng_add_vtid_to_ctx(ctx);
+ //TODO return lttng_add_vtid_to_ctx(ctx);
default:
return -EINVAL;
}
return chan_objd;
chan_error:
- objd_unref(chan_objd);
+ {
+ int err;
+
+ err = objd_unref(chan_objd);
+ assert(!err);
+ }
objd_error:
return ret;
}
* individual file is released).
*/
static
-int lttng_session_release(int objd)
+int lttng_release_session(int objd)
{
struct ltt_session *session = objd_private(objd);
- if (session)
+ if (session) {
ltt_session_destroy(session);
- return 0;
+ return 0;
+ } else {
+ return -EINVAL;
+ }
}
static const struct objd_ops lttng_session_ops = {
- .release = lttng_session_release,
+ .release = lttng_release_session,
.cmd = lttng_session_cmd,
};
return event_objd;
event_error:
- objd_unref(event_objd);
+ {
+ int err;
+
+ err = objd_unref(event_objd);
+ assert(!err);
+ }
objd_error:
return ret;
}
struct ltt_channel *channel = objd_private(objd);
if (channel)
- objd_unref(channel->session->objd);
+ return objd_unref(channel->session->objd);
return 0;
}
struct ltt_event *event = objd_private(objd);
if (event)
- objd_unref(event->chan->objd);
+ return objd_unref(event->chan->objd);
return 0;
}
.cmd = lttng_event_cmd,
};
-void __attribute__((constructor)) lttng_ust_abi_init(void)
-{
- /* TODO: initialize socket */
-}
-
-static
-void __attribute__((destructor)) lttng_ust_abi_exit(void)
+void lttng_ust_abi_exit(void)
{
- /* TODO: teardown socket */
objd_table_destroy();
}