X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=liblttng-ust%2Flttng-ust-abi.c;h=718dfbf70d9469c17dcecb53ee401d6d8a8ff427;hb=bd640d74f149ce079f81103221a8aaafca02ce04;hp=62e1be74c1232ca31cee54c83f90df2b4bf51320;hpb=c0c0989ab70574e09b2f7e8b48c2da6af664a849;p=lttng-ust.git diff --git a/liblttng-ust/lttng-ust-abi.c b/liblttng-ust/lttng-ust-abi.c index 62e1be74..718dfbf7 100644 --- a/liblttng-ust/lttng-ust-abi.c +++ b/liblttng-ust/lttng-ust-abi.c @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include #include @@ -46,6 +46,7 @@ #include "lttng-tracer.h" #include "string-utils.h" #include "ust-events-internal.h" +#include "context-internal.h" #define OBJ_NAME_LEN 16 @@ -311,8 +312,8 @@ int lttng_abi_create_session(void *owner) ret = session_objd; goto objd_error; } - session->objd = session_objd; - session->owner = owner; + session->priv->objd = session_objd; + session->priv->owner = owner; return session_objd; objd_error: @@ -421,7 +422,7 @@ long lttng_cmd(int objd, unsigned int cmd, unsigned long arg, case LTTNG_UST_TRACEPOINT_FIELD_LIST: return lttng_abi_tracepoint_field_list(owner); case LTTNG_UST_WAIT_QUIESCENT: - lttng_ust_synchronize_trace(); + lttng_ust_urcu_synchronize_rcu(); return 0; case LTTNG_UST_EVENT_NOTIFIER_GROUP_CREATE: return lttng_abi_event_notifier_send_fd(owner, @@ -469,7 +470,7 @@ int lttng_abi_map_channel(int session_objd, goto invalid; } - if (session->been_active) { + if (session->priv->been_active) { ret = -EBUSY; goto active; /* Refuse to add channel to active session */ } @@ -545,7 +546,7 @@ int lttng_abi_map_channel(int session_objd, memcpy(<tng_chan->chan->backend.config, transport->client_config, sizeof(lttng_chan->chan->backend.config)); - cds_list_add(<tng_chan->node, &session->chan_head); + cds_list_add(<tng_chan->node, &session->priv->chan_head); lttng_chan->header_type = 0; lttng_chan->handle = channel_handle; lttng_chan->type = type; @@ -733,21 +734,32 @@ static long lttng_event_notifier_group_error_counter_cmd(int objd, unsigned int cmd, unsigned long arg, union ust_args *uargs, void *owner) { + int ret; struct lttng_counter *counter = objd_private(objd); switch (cmd) { case LTTNG_UST_COUNTER_GLOBAL: - return -EINVAL; /* Unimplemented. */ + ret = -EINVAL; /* Unimplemented. */ + break; case LTTNG_UST_COUNTER_CPU: { struct lttng_ust_counter_cpu *counter_cpu = (struct lttng_ust_counter_cpu *)arg; - return lttng_counter_set_cpu_shm(counter->counter, + + ret = lttng_counter_set_cpu_shm(counter->counter, counter_cpu->cpu_nr, uargs->counter_shm.shm_fd); + if (!ret) { + /* Take ownership of the shm_fd. */ + uargs->counter_shm.shm_fd = -1; + } + break; } default: - return -EINVAL; + ret = -EINVAL; + break; } + + return ret; } LTTNG_HIDDEN @@ -1227,7 +1239,7 @@ int lttng_channel_release(int objd) struct lttng_channel *channel = objd_private(objd); if (channel) - return lttng_ust_objd_unref(channel->session->objd, 0); + return lttng_ust_objd_unref(channel->session->priv->objd, 0); return 0; }