From: David Goulet Date: Fri, 13 Jan 2012 15:10:58 +0000 (-0500) Subject: Merge branch 'master' of git://git.lttng.org/lttng-tools X-Git-Tag: v2.0-pre17~22 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=008dd0fe872d71d154867d25579b58a0a204d93d;hp=58f3ca76ddd0d871fc1b71d816bdbabe1d7adeb1 Merge branch 'master' of git://git.lttng.org/lttng-tools --- diff --git a/include/lttng/lttng-consumer.h b/include/lttng/lttng-consumer.h index f5ad3e6f2..3d16d4973 100644 --- a/include/lttng/lttng-consumer.h +++ b/include/lttng/lttng-consumer.h @@ -78,7 +78,6 @@ struct lttng_consumer_channel { size_t mmap_len; struct lttng_ust_shm_handle *handle; int nr_streams; - int shm_fd_is_copy; int wait_fd_is_copy; int cpucount; }; diff --git a/liblttng-consumer/lttng-consumer.c b/liblttng-consumer/lttng-consumer.c index 5a4cf08c5..0263aa1d8 100644 --- a/liblttng-consumer/lttng-consumer.c +++ b/liblttng-consumer/lttng-consumer.c @@ -178,8 +178,7 @@ void consumer_del_stream(struct lttng_consumer_stream *stream) if (stream->wait_fd >= 0 && !stream->wait_fd_is_copy) { close(stream->wait_fd); } - if (stream->shm_fd >= 0 && stream->wait_fd != stream->shm_fd - && !stream->shm_fd_is_copy) { + if (stream->shm_fd >= 0 && stream->wait_fd != stream->shm_fd) { close(stream->shm_fd); } if (!--stream->chan->refcount) @@ -363,8 +362,7 @@ void consumer_del_channel(struct lttng_consumer_channel *channel) if (channel->wait_fd >= 0 && !channel->wait_fd_is_copy) { close(channel->wait_fd); } - if (channel->shm_fd >= 0 && channel->wait_fd != channel->shm_fd - && !channel->shm_fd_is_copy) { + if (channel->shm_fd >= 0 && channel->wait_fd != channel->shm_fd) { close(channel->shm_fd); } free(channel); diff --git a/liblttng-ht/lttng-ht.c b/liblttng-ht/lttng-ht.c index d55c95373..74e5ed4fe 100644 --- a/liblttng-ht/lttng-ht.c +++ b/liblttng-ht/lttng-ht.c @@ -62,7 +62,8 @@ struct lttng_ht *lttng_ht_new(unsigned long size, int type) struct lttng_ht *ht; /* Test size */ - size != 0 ? : (size = DEFAULT_HT_SIZE); + if (!size) + size = DEFAULT_HT_SIZE; ht = zmalloc(sizeof(*ht)); if (ht == NULL) { diff --git a/liblttng-ustconsumer/lttng-ustconsumer.c b/liblttng-ustconsumer/lttng-ustconsumer.c index 26e680a9c..8305b061a 100644 --- a/liblttng-ustconsumer/lttng-ustconsumer.c +++ b/liblttng-ustconsumer/lttng-ustconsumer.c @@ -278,11 +278,8 @@ int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel *chan) if (!chan->handle) { return -ENOMEM; } - /* - * The channel fds are passed to ustctl, we only keep a copy. - */ - chan->shm_fd_is_copy = 1; chan->wait_fd_is_copy = 1; + chan->shm_fd = -1; return 0; } @@ -313,15 +310,14 @@ int lttng_ustconsumer_allocate_stream(struct lttng_consumer_stream *stream) stream->buf = ustctl_open_stream_read(stream->chan->handle, stream->cpu); if (!stream->buf) return -EBUSY; + /* ustctl_open_stream_read has closed the shm fd. */ + stream->wait_fd_is_copy = 1; + stream->shm_fd = -1; + stream->mmap_base = ustctl_get_mmap_base(stream->chan->handle, stream->buf); if (!stream->mmap_base) { return -EINVAL; } - /* - * The stream fds are passed to ustctl, we only keep a copy. - */ - stream->shm_fd_is_copy = 1; - stream->wait_fd_is_copy = 1; return 0; } diff --git a/lttng-sessiond/lttng-ust-abi.h b/lttng-sessiond/lttng-ust-abi.h index cac431307..28a040763 100644 --- a/lttng-sessiond/lttng-ust-abi.h +++ b/lttng-sessiond/lttng-ust-abi.h @@ -42,20 +42,6 @@ struct lttng_ust_channel { unsigned int switch_timer_interval; /* usecs */ unsigned int read_timer_interval; /* usecs */ enum lttng_ust_output output; /* output mode */ - /* The following fields are used internally within UST. */ - int shm_fd; - int wait_fd; - uint64_t memory_map_size; -}; - -/* - * This structure is only used internally within UST. It is not per-se - * part of the communication between sessiond and UST. - */ -struct lttng_ust_stream { - int shm_fd; - int wait_fd; - uint64_t memory_map_size; }; struct lttng_ust_event { @@ -151,8 +137,22 @@ struct lttng_ust_object_data { struct lttng_ust_obj; +union ust_args { + struct { + int *shm_fd; + int *wait_fd; + uint64_t *memory_map_size; + } channel; + struct { + int *shm_fd; + int *wait_fd; + uint64_t *memory_map_size; + } stream; +}; + struct lttng_ust_objd_ops { - long (*cmd)(int objd, unsigned int cmd, unsigned long arg); + long (*cmd)(int objd, unsigned int cmd, unsigned long arg, + union ust_args *args); int (*release)(int objd); }; diff --git a/lttng-sessiond/main.c b/lttng-sessiond/main.c index 04ac25d0f..f5f8dbe86 100644 --- a/lttng-sessiond/main.c +++ b/lttng-sessiond/main.c @@ -2916,7 +2916,7 @@ static int cmd_stop_trace(struct ltt_session *session) usess = session->ust_session; if (!session->enabled) { - ret = LTTCOMM_UST_START_FAIL; + ret = LTTCOMM_UST_STOP_FAIL; goto error; } @@ -2953,7 +2953,7 @@ static int cmd_stop_trace(struct ltt_session *session) ret = ust_app_stop_trace_all(usess); if (ret < 0) { - ret = LTTCOMM_UST_START_FAIL; + ret = LTTCOMM_UST_STOP_FAIL; goto error; } } diff --git a/lttng-sessiond/ust-app.c b/lttng-sessiond/ust-app.c index 4f68a87ee..3de826bc2 100644 --- a/lttng-sessiond/ust-app.c +++ b/lttng-sessiond/ust-app.c @@ -592,9 +592,6 @@ static int create_ust_channel(struct ust_app *app, } ua_chan->handle = ua_chan->obj->handle; - ua_chan->attr.shm_fd = ua_chan->obj->shm_fd; - ua_chan->attr.wait_fd = ua_chan->obj->wait_fd; - ua_chan->attr.memory_map_size = ua_chan->obj->memory_map_size; DBG2("UST app channel %s created successfully for pid:%d and sock:%d", ua_chan->name, app->key.pid, app->key.sock);