X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=liblttng-ust%2Flttng-ust-abi.c;h=8fd2e95806e792c6a4e501de3931940cf57e8494;hb=ba5b3d2bf3ecd8614e74efc1db2f5a626c5d9a92;hp=62e1be74c1232ca31cee54c83f90df2b4bf51320;hpb=c0c0989ab70574e09b2f7e8b48c2da6af664a849;p=deliverable%2Flttng-ust.git diff --git a/liblttng-ust/lttng-ust-abi.c b/liblttng-ust/lttng-ust-abi.c index 62e1be74..8fd2e958 100644 --- a/liblttng-ust/lttng-ust-abi.c +++ b/liblttng-ust/lttng-ust-abi.c @@ -733,21 +733,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