Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
* [ltt-dev] [UST] open_buffers_list in tracectl.c
@ 2011-02-21 19:50 Yannick Brosseau
  2011-02-22  8:09 ` Nils Carlson
  0 siblings, 1 reply; 2+ messages in thread
From: Yannick Brosseau @ 2011-02-21 19:50 UTC (permalink / raw)


Question for UST experts (Nils?)

While trying to fix the fork case, I've found problems with the the
open_buffers_list. I've fixed the segfault by moving the
ltt_trace_destroy later in ust_fork, but now I get some warnings about
already closed file descriptor.
It seems that we try to close the fd twice.
Now I'm wondering if we really need to close the fd referenced by the
open buffers list in ust_fork()? All these FD are closed when we destroy
the channels in the call to ltt_trace_destroy, so it seems redundant to
me. 

Am I missing something?

For quick reference here's the code using open_buffer_list from
tracectl.c in ust_fork(void)

    /* Delete all blocked consumers */
    cds_list_for_each_entry_safe(buf, buf_tmp, &open_buffers_list,
                 open_buffers_list) {
        result = close(buf->data_ready_fd_read);
        if (result == -1) {
            PERROR("close");
        }
        result = close(buf->data_ready_fd_write);
        if (result == -1) {
            PERROR("close");
        }
        cds_list_del(&buf->open_buffers_list);
    }

It would  suggest to change it to simply

    /* Empty the list of open buffers */
    cds_list_for_each_entry_safe(buf, buf_tmp, &open_buffers_list,
                 open_buffers_list) {
        cds_list_del(&buf->open_buffers_list);
    }




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-02-22  8:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-21 19:50 [ltt-dev] [UST] open_buffers_list in tracectl.c Yannick Brosseau
2011-02-22  8:09 ` Nils Carlson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox