Merge branch 'master' of git://git.lttng.org/lttng-tools
authorDavid Goulet <dgoulet@efficios.com>
Fri, 13 Jan 2012 15:10:58 +0000 (10:10 -0500)
committerDavid Goulet <dgoulet@efficios.com>
Fri, 13 Jan 2012 15:10:58 +0000 (10:10 -0500)
include/lttng/lttng-consumer.h
liblttng-consumer/lttng-consumer.c
liblttng-ht/lttng-ht.c
liblttng-ustconsumer/lttng-ustconsumer.c
lttng-sessiond/lttng-ust-abi.h
lttng-sessiond/main.c
lttng-sessiond/ust-app.c

index f5ad3e6f2ad416d5e3d6064444d1064ff1caa519..3d16d49732f9175a68ecff669e0ace402d55b2c2 100644 (file)
@@ -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;
 };
index 5a4cf08c59109a7a5f21d8cc8070eb699debd3e0..0263aa1d83134bb5edd2937effce7d9cec1e4320 100644 (file)
@@ -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);
index d55c95373f6dcb2f1e25d4608f133455279b93f9..74e5ed4feb169cf803d90e7debea78b6c507722f 100644 (file)
@@ -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) {
index 26e680a9cd757d6bc5974dda20d6a30df3ccb9b2..8305b061a882fff9021037e1716ff32fb3f36935 100644 (file)
@@ -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;
 }
index cac431307c0150316edec5ec199f307bfe5a880d..28a040763d81c4aabe1158ab3a8c6e3335f55f93 100644 (file)
@@ -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);
 };
 
index 04ac25d0f0837b906dfa6f15ae4b9e3ca235bf5e..f5f8dbe86a3999d4fb10a30e34f0892ea973dd66 100644 (file)
@@ -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;
                }
        }
index 4f68a87eecd86270cc0011cd528d38c79ec3fc96..3de826bc2d97d8ca8850735af366291a4afb6c86 100644 (file)
@@ -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);
This page took 0.038991 seconds and 4 git commands to generate.