1 /* Copyright (C) 2009 Pierre-Marc Fournier
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 #include <sys/types.h>
23 #include <sys/socket.h>
36 #include "relay.h" /* FIXME: remove */
37 #include "marker-control.h"
41 #define USTSIGNAL SIGIO
43 #define MAX_MSG_SIZE (100)
45 #define MSG_REGISTER_NOTIF 2
47 char consumer_stack
[10000];
49 /* This should only be accessed by the constructor, before the creation
50 * of the listener, and then only by the listener.
54 struct list_head blocked_consumers
= LIST_HEAD_INIT(blocked_consumers
);
56 static struct ustcomm_app ustcomm_app
;
58 struct tracecmd
{ /* no padding */
63 /* volatile because shared between the listener and the main thread */
64 volatile sig_atomic_t buffers_to_export
= 0;
66 //struct listener_arg {
71 /* size: the size of all the fields except size itself */
74 /* Only the necessary part of the payload is transferred. It
75 * may even be none of it.
80 struct consumer_channel
{
82 struct ltt_channel_struct
*chan
;
85 struct blocked_consumer
{
90 /* args to ustcomm_send_reply */
91 struct ustcomm_server server
;
92 struct ustcomm_source src
;
94 /* args to ltt_do_get_subbuf */
95 struct rchan_buf
*rbuf
;
96 struct ltt_channel_buf_struct
*lttbuf
;
98 struct list_head list
;
101 static long long make_pidunique(void)
106 gettimeofday(&tv
, NULL
);
110 retval
|= tv
.tv_usec
;
115 static void print_markers(FILE *fp
)
117 struct marker_iter iter
;
120 marker_iter_reset(&iter
);
121 marker_iter_start(&iter
);
124 fprintf(fp
, "marker: %s_%s %d \"%s\"\n", iter
.marker
->channel
, iter
.marker
->name
, (int)imv_read(iter
.marker
->state
), iter
.marker
->format
);
125 marker_iter_next(&iter
);
130 static int init_socket(void);
132 /* This needs to be called whenever a new thread is created. It notifies
133 * liburcu of the new thread.
136 void ust_register_thread(void)
138 rcu_register_thread();
145 struct trctl_msg msg
;
147 /* FIXME: fd_notif should probably be protected by a spinlock */
152 msg
.type
= MSG_NOTIF
;
153 msg
.size
= sizeof(msg
.type
);
155 /* FIXME: don't block here */
156 result
= write(fd_notif
, &msg
, msg
.size
+sizeof(msg
.size
));
163 /* Ask the daemon to collect a trace called trace_name and being
164 * produced by this pid.
166 * The trace must be at least allocated. (It can also be started.)
167 * This is because _ltt_trace_find is used.
170 static void inform_consumer_daemon(const char *trace_name
)
173 struct ltt_trace_struct
*trace
;
174 pid_t pid
= getpid();
179 trace
= _ltt_trace_find(trace_name
);
181 WARN("inform_consumer_daemon: could not find trace \"%s\"; it is probably already destroyed", trace_name
);
185 for(i
=0; i
< trace
->nr_channels
; i
++) {
186 result
= ustcomm_request_consumer(pid
, trace
->channels
[i
].channel_name
);
188 WARN("Failed to request collection for channel %s. Is the daemon available?", trace
->channels
[i
].channel_name
);
189 /* continue even if fail */
198 void process_blocked_consumers(void)
202 struct blocked_consumer
*bc
;
207 list_for_each_entry(bc
, &blocked_consumers
, list
) {
211 fds
= (struct pollfd
*) malloc(n_fds
* sizeof(struct pollfd
));
213 ERR("malloc returned NULL");
217 list_for_each_entry(bc
, &blocked_consumers
, list
) {
218 fds
[idx
].fd
= bc
->fd_producer
;
219 fds
[idx
].events
= POLLIN
;
220 bc
->tmp_poll_idx
= idx
;
224 while((result
= poll(fds
, n_fds
, 0)) == -1 && errno
== EINTR
)
231 list_for_each_entry(bc
, &blocked_consumers
, list
) {
232 if(fds
[bc
->tmp_poll_idx
].revents
) {
233 long consumed_old
= 0;
236 result
= read(bc
->fd_producer
, &inbuf
, 1);
244 close(bc
->fd_producer
);
248 result
= ustcomm_send_reply(&bc
->server
, "END", &bc
->src
);
250 ERR("ustcomm_send_reply failed");
257 result
= ltt_do_get_subbuf(bc
->rbuf
, bc
->lttbuf
, &consumed_old
);
258 if(result
== -EAGAIN
) {
259 WARN("missed buffer?");
262 else if(result
< 0) {
263 DBG("ltt_do_get_subbuf: error: %s", strerror(-result
));
265 asprintf(&reply
, "%s %ld", "OK", consumed_old
);
266 result
= ustcomm_send_reply(&bc
->server
, reply
, &bc
->src
);
268 ERR("ustcomm_send_reply failed");
280 void *listener_main(void *p
)
284 ust_register_thread();
289 char trace_name
[] = "auto";
290 char trace_type
[] = "ustrelay";
293 struct ustcomm_source src
;
295 process_blocked_consumers();
297 result
= ustcomm_app_recv_message(&ustcomm_app
, &recvbuf
, &src
, 5);
299 WARN("error in ustcomm_app_recv_message");
302 else if(result
== 0) {
307 DBG("received a message! it's: %s", recvbuf
);
308 len
= strlen(recvbuf
);
310 if(!strcmp(recvbuf
, "print_markers")) {
311 print_markers(stderr
);
313 else if(!strcmp(recvbuf
, "list_markers")) {
318 fp
= open_memstream(&ptr
, &size
);
322 result
= ustcomm_send_reply(&ustcomm_app
.server
, ptr
, &src
);
326 else if(!strcmp(recvbuf
, "start")) {
327 /* start is an operation that setups the trace, allocates it and starts it */
328 result
= ltt_trace_setup(trace_name
);
330 ERR("ltt_trace_setup failed");
334 result
= ltt_trace_set_type(trace_name
, trace_type
);
336 ERR("ltt_trace_set_type failed");
340 result
= ltt_trace_alloc(trace_name
);
342 ERR("ltt_trace_alloc failed");
346 inform_consumer_daemon(trace_name
);
348 result
= ltt_trace_start(trace_name
);
350 ERR("ltt_trace_start failed");
354 else if(!strcmp(recvbuf
, "trace_setup")) {
357 result
= ltt_trace_setup(trace_name
);
359 ERR("ltt_trace_setup failed");
363 result
= ltt_trace_set_type(trace_name
, trace_type
);
365 ERR("ltt_trace_set_type failed");
369 else if(!strcmp(recvbuf
, "trace_alloc")) {
372 result
= ltt_trace_alloc(trace_name
);
374 ERR("ltt_trace_alloc failed");
378 else if(!strcmp(recvbuf
, "trace_start")) {
381 result
= ltt_trace_start(trace_name
);
383 ERR("ltt_trace_start failed");
387 else if(!strcmp(recvbuf
, "trace_stop")) {
390 result
= ltt_trace_stop(trace_name
);
392 ERR("ltt_trace_stop failed");
396 else if(!strcmp(recvbuf
, "trace_destroy")) {
398 DBG("trace destroy");
400 result
= ltt_trace_destroy(trace_name
);
402 ERR("ltt_trace_destroy failed");
406 else if(nth_token_is(recvbuf
, "get_shmid", 0) == 1) {
407 struct ltt_trace_struct
*trace
;
408 char trace_name
[] = "auto";
414 channel_name
= nth_token(recvbuf
, 1);
415 if(channel_name
== NULL
) {
416 ERR("get_shmid: cannot parse channel");
421 trace
= _ltt_trace_find(trace_name
);
425 ERR("cannot find trace!");
429 for(i
=0; i
<trace
->nr_channels
; i
++) {
430 struct rchan
*rchan
= trace
->channels
[i
].trans_channel_data
;
431 struct rchan_buf
*rbuf
= rchan
->buf
;
432 struct ltt_channel_struct
*ltt_channel
= (struct ltt_channel_struct
*)rchan
->private_data
;
434 if(!strcmp(trace
->channels
[i
].channel_name
, channel_name
)) {
437 DBG("the shmid for the requested channel is %d", rbuf
->shmid
);
438 DBG("the shmid for its buffer structure is %d", ltt_channel
->buf_shmid
);
439 asprintf(&reply
, "%d %d", rbuf
->shmid
, ltt_channel
->buf_shmid
);
441 result
= ustcomm_send_reply(&ustcomm_app
.server
, reply
, &src
);
443 ERR("listener: get_shmid: ustcomm_send_reply failed");
455 else if(nth_token_is(recvbuf
, "get_n_subbufs", 0) == 1) {
456 struct ltt_trace_struct
*trace
;
457 char trace_name
[] = "auto";
461 DBG("get_n_subbufs");
463 channel_name
= nth_token(recvbuf
, 1);
464 if(channel_name
== NULL
) {
465 ERR("get_n_subbufs: cannot parse channel");
470 trace
= _ltt_trace_find(trace_name
);
474 ERR("cannot find trace!");
478 for(i
=0; i
<trace
->nr_channels
; i
++) {
479 struct rchan
*rchan
= trace
->channels
[i
].trans_channel_data
;
481 if(!strcmp(trace
->channels
[i
].channel_name
, channel_name
)) {
484 DBG("the n_subbufs for the requested channel is %zd", rchan
->n_subbufs
);
485 asprintf(&reply
, "%zd", rchan
->n_subbufs
);
487 result
= ustcomm_send_reply(&ustcomm_app
.server
, reply
, &src
);
489 ERR("listener: get_n_subbufs: ustcomm_send_reply failed");
499 else if(nth_token_is(recvbuf
, "get_subbuf_size", 0) == 1) {
500 struct ltt_trace_struct
*trace
;
501 char trace_name
[] = "auto";
505 DBG("get_subbuf_size");
507 channel_name
= nth_token(recvbuf
, 1);
508 if(channel_name
== NULL
) {
509 ERR("get_subbuf_size: cannot parse channel");
514 trace
= _ltt_trace_find(trace_name
);
518 ERR("cannot find trace!");
522 for(i
=0; i
<trace
->nr_channels
; i
++) {
523 struct rchan
*rchan
= trace
->channels
[i
].trans_channel_data
;
525 if(!strcmp(trace
->channels
[i
].channel_name
, channel_name
)) {
528 DBG("the subbuf_size for the requested channel is %zd", rchan
->subbuf_size
);
529 asprintf(&reply
, "%zd", rchan
->subbuf_size
);
531 result
= ustcomm_send_reply(&ustcomm_app
.server
, reply
, &src
);
533 ERR("listener: get_subbuf_size: ustcomm_send_reply failed");
543 else if(nth_token_is(recvbuf
, "load_probe_lib", 0) == 1) {
546 libfile
= nth_token(recvbuf
, 1);
548 DBG("load_probe_lib loading %s", libfile
);
550 else if(nth_token_is(recvbuf
, "get_subbuffer", 0) == 1) {
551 struct ltt_trace_struct
*trace
;
552 char trace_name
[] = "auto";
558 channel_name
= nth_token(recvbuf
, 1);
559 if(channel_name
== NULL
) {
560 ERR("get_subbuf: cannot parse channel");
565 trace
= _ltt_trace_find(trace_name
);
569 ERR("cannot find trace!");
573 for(i
=0; i
<trace
->nr_channels
; i
++) {
574 struct rchan
*rchan
= trace
->channels
[i
].trans_channel_data
;
576 if(!strcmp(trace
->channels
[i
].channel_name
, channel_name
)) {
577 struct rchan_buf
*rbuf
= rchan
->buf
;
578 struct ltt_channel_buf_struct
*lttbuf
= trace
->channels
[i
].buf
;
579 struct blocked_consumer
*bc
;
581 bc
= (struct blocked_consumer
*) malloc(sizeof(struct blocked_consumer
));
583 ERR("malloc returned NULL");
586 bc
->fd_consumer
= src
.fd
;
587 bc
->fd_producer
= lttbuf
->data_ready_fd_read
;
591 bc
->server
= ustcomm_app
.server
;
593 list_add(&bc
->list
, &blocked_consumers
);
599 else if(nth_token_is(recvbuf
, "put_subbuffer", 0) == 1) {
600 struct ltt_trace_struct
*trace
;
601 char trace_name
[] = "auto";
605 char *consumed_old_str
;
610 channel_name
= strdup_malloc(nth_token(recvbuf
, 1));
611 if(channel_name
== NULL
) {
612 ERR("put_subbuf_size: cannot parse channel");
616 consumed_old_str
= strdup_malloc(nth_token(recvbuf
, 2));
617 if(consumed_old_str
== NULL
) {
618 ERR("put_subbuf: cannot parse consumed_old");
621 consumed_old
= strtol(consumed_old_str
, &endptr
, 10);
622 if(*endptr
!= '\0') {
623 ERR("put_subbuf: invalid value for consumed_old");
628 trace
= _ltt_trace_find(trace_name
);
632 ERR("cannot find trace!");
636 for(i
=0; i
<trace
->nr_channels
; i
++) {
637 struct rchan
*rchan
= trace
->channels
[i
].trans_channel_data
;
639 if(!strcmp(trace
->channels
[i
].channel_name
, channel_name
)) {
640 struct rchan_buf
*rbuf
= rchan
->buf
;
641 struct ltt_channel_buf_struct
*lttbuf
= trace
->channels
[i
].buf
;
645 result
= ltt_do_put_subbuf(rbuf
, lttbuf
, consumed_old
);
647 WARN("ltt_do_put_subbuf: error (subbuf=%s)", channel_name
);
648 asprintf(&reply
, "%s", "ERROR");
651 DBG("ltt_do_put_subbuf: success (subbuf=%s)", channel_name
);
652 asprintf(&reply
, "%s", "OK");
655 result
= ustcomm_send_reply(&ustcomm_app
.server
, reply
, &src
);
657 ERR("listener: put_subbuf: ustcomm_send_reply failed");
668 free(consumed_old_str
);
670 else if(nth_token_is(recvbuf
, "enable_marker", 0) == 1) {
671 char *channel_slash_name
= nth_token(recvbuf
, 1);
672 char channel_name
[256]="";
673 char marker_name
[256]="";
675 result
= sscanf(channel_slash_name
, "%255[^/]/%255s", channel_name
, marker_name
);
677 if(channel_name
== NULL
|| marker_name
== NULL
) {
678 WARN("invalid marker name");
681 printf("%s %s\n", channel_name
, marker_name
);
683 result
= ltt_marker_connect(channel_name
, marker_name
, "default");
685 WARN("could not enable marker; channel=%s, name=%s", channel_name
, marker_name
);
688 else if(nth_token_is(recvbuf
, "disable_marker", 0) == 1) {
689 char *channel_slash_name
= nth_token(recvbuf
, 1);
693 result
= sscanf(channel_slash_name
, "%a[^/]/%as", &channel_name
, &marker_name
);
695 if(marker_name
== NULL
) {
697 printf("%s %s\n", channel_name
, marker_name
);
699 result
= ltt_marker_disconnect(channel_name
, marker_name
, "default");
701 WARN("could not disable marker; channel=%s, name=%s", channel_name
, marker_name
);
704 else if(nth_token_is(recvbuf
, "get_pidunique", 0) == 1) {
707 asprintf(&reply
, "%lld", pidunique
);
709 result
= ustcomm_send_reply(&ustcomm_app
.server
, reply
, &src
);
711 ERR("listener: get_pidunique: ustcomm_send_reply failed");
717 // else if(nth_token_is(recvbuf, "get_notifications", 0) == 1) {
718 // struct ltt_trace_struct *trace;
719 // char trace_name[] = "auto";
721 // char *channel_name;
723 // DBG("get_notifications");
725 // channel_name = strdup_malloc(nth_token(recvbuf, 1));
726 // if(channel_name == NULL) {
727 // ERR("put_subbuf_size: cannot parse channel");
731 // ltt_lock_traces();
732 // trace = _ltt_trace_find(trace_name);
733 // ltt_unlock_traces();
735 // if(trace == NULL) {
736 // ERR("cannot find trace!");
740 // for(i=0; i<trace->nr_channels; i++) {
741 // struct rchan *rchan = trace->channels[i].trans_channel_data;
744 // if(!strcmp(trace->channels[i].channel_name, channel_name)) {
745 // struct rchan_buf *rbuf = rchan->buf;
746 // struct ltt_channel_buf_struct *lttbuf = trace->channels[i].buf;
748 // result = fd = ustcomm_app_detach_client(&ustcomm_app, &src);
749 // if(result == -1) {
750 // ERR("ustcomm_app_detach_client failed");
754 // lttbuf->wake_consumer_arg = (void *) fd;
758 // lttbuf->call_wake_consumer = 1;
764 // free(channel_name);
767 ERR("unable to parse message: %s", recvbuf
);
775 int have_listener
= 0;
777 void create_listener(void)
780 static char listener_stack
[16384];
789 result
= clone(listener_main
, listener_stack
+sizeof(listener_stack
)-1, CLONE_FS
| CLONE_FILES
| CLONE_VM
| CLONE_SIGHAND
| CLONE_THREAD
, NULL
);
796 pthread_create(&thread
, NULL
, listener_main
, NULL
);
802 /* The signal handler itself. Signals must be setup so there cannot be
805 void sighandler(int sig
)
807 static char have_listener
= 0;
816 /* Called by the app signal handler to chain it to us. */
818 void chain_signal(void)
820 sighandler(USTSIGNAL
);
823 static int init_socket(void)
825 return ustcomm_init_app(getpid(), &ustcomm_app
);
828 static int init_signal_handler(void)
830 /* Attempt to handler SIGIO. If the main program wants to
831 * handle it, fine, it'll override us. They it'll have to
832 * use the chaining function.
836 struct sigaction act
;
838 result
= sigemptyset(&act
.sa_mask
);
840 PERROR("sigemptyset");
844 act
.sa_handler
= sighandler
;
845 act
.sa_flags
= SA_RESTART
;
847 /* Only defer ourselves. Also, try to restart interrupted
848 * syscalls to disturb the traced program as little as possible.
850 result
= sigaction(SIGIO
, &act
, NULL
);
859 #define AUTOPROBE_DISABLED 0
860 #define AUTOPROBE_ENABLE_ALL 1
861 #define AUTOPROBE_ENABLE_REGEX 2
862 static int autoprobe_method
= AUTOPROBE_DISABLED
;
863 static regex_t autoprobe_regex
;
865 static void auto_probe_connect(struct marker
*m
)
869 char* concat_name
= NULL
;
870 const char *probe_name
= "default";
872 if(autoprobe_method
== AUTOPROBE_DISABLED
) {
875 else if(autoprobe_method
== AUTOPROBE_ENABLE_REGEX
) {
876 result
= asprintf(&concat_name
, "%s/%s", m
->channel
, m
->name
);
878 ERR("auto_probe_connect: asprintf failed (marker %s/%s)",
879 m
->channel
, m
->name
);
882 if (regexec(&autoprobe_regex
, concat_name
, 0, NULL
, 0)) {
889 result
= ltt_marker_connect(m
->channel
, m
->name
, probe_name
);
890 if(result
&& result
!= -EEXIST
)
891 ERR("ltt_marker_connect (marker = %s/%s, errno = %d)", m
->channel
, m
->name
, -result
);
893 DBG("auto connected marker %s %s to probe default", m
->channel
, m
->name
);
897 static void __attribute__((constructor(1000))) init()
900 char* autoprobe_val
= NULL
;
902 /* Assign the pidunique, to be able to differentiate the processes with same
903 * pid, (before and after an exec).
905 pidunique
= make_pidunique();
907 /* Initialize RCU in case the constructor order is not good. */
910 /* It is important to do this before events start to be generated. */
911 ust_register_thread();
913 DBG("Tracectl constructor");
915 /* Must create socket before signal handler to prevent races.
917 result
= init_socket();
919 ERR("init_socket error");
922 result
= init_signal_handler();
924 ERR("init_signal_handler error");
928 autoprobe_val
= getenv("UST_AUTOPROBE");
930 struct marker_iter iter
;
932 DBG("Autoprobe enabled.");
934 /* Ensure markers are initialized */
937 /* Ensure marker control is initialized, for the probe */
938 init_marker_control();
940 /* first, set the callback that will connect the
941 * probe on new markers
943 if(autoprobe_val
[0] == '/') {
944 result
= regcomp(&autoprobe_regex
, autoprobe_val
+1, 0);
948 regerror(result
, &autoprobe_regex
, regexerr
, sizeof(regexerr
));
949 ERR("cannot parse regex %s (%s), will ignore UST_AUTOPROBE", autoprobe_val
, regexerr
);
950 /* don't crash the application just for this */
953 autoprobe_method
= AUTOPROBE_ENABLE_REGEX
;
957 /* just enable all instrumentation */
958 autoprobe_method
= AUTOPROBE_ENABLE_ALL
;
961 marker_set_new_marker_cb(auto_probe_connect
);
963 /* Now, connect the probes that were already registered. */
964 marker_iter_reset(&iter
);
965 marker_iter_start(&iter
);
967 DBG("now iterating on markers already registered");
969 DBG("now iterating on marker %s", iter
.marker
->name
);
970 auto_probe_connect(iter
.marker
);
971 marker_iter_next(&iter
);
975 if(getenv("UST_TRACE")) {
976 char trace_name
[] = "auto";
977 char trace_type
[] = "ustrelay";
979 DBG("starting early tracing");
981 /* Ensure marker control is initialized */
982 init_marker_control();
984 /* Ensure relay is initialized */
985 init_ustrelay_transport();
987 /* Ensure markers are initialized */
991 ltt_channels_register("ust");
993 result
= ltt_trace_setup(trace_name
);
995 ERR("ltt_trace_setup failed");
999 result
= ltt_trace_set_type(trace_name
, trace_type
);
1001 ERR("ltt_trace_set_type failed");
1005 result
= ltt_trace_alloc(trace_name
);
1007 ERR("ltt_trace_alloc failed");
1011 inform_consumer_daemon(trace_name
);
1013 result
= ltt_trace_start(trace_name
);
1015 ERR("ltt_trace_start failed");
1023 /* should decrementally destroy stuff if error */
1027 /* This is only called if we terminate normally, not with an unhandled signal,
1028 * so we cannot rely on it. However, for now, LTTV requires that the header of
1029 * the last sub-buffer contain a valid end time for the trace. This is done
1030 * automatically only when the trace is properly stopped.
1032 * If the traced program crashed, it is always possible to manually add the
1033 * right value in the header, or to open the trace in text mode.
1035 * FIXME: Fix LTTV so it doesn't need this.
1038 static void destroy_traces(void)
1042 /* if trace running, finish it */
1044 DBG("destructor stopping traces");
1046 result
= ltt_trace_stop("auto");
1048 ERR("ltt_trace_stop error");
1051 result
= ltt_trace_destroy("auto");
1053 ERR("ltt_trace_destroy error");
1057 static int trace_recording(void)
1060 struct ltt_trace_struct
*trace
;
1064 list_for_each_entry(trace
, <t_traces
.head
, list
) {
1071 ltt_unlock_traces();
1077 static int have_consumer(void)
1079 return !list_empty(&blocked_consumers
);
1083 int restarting_usleep(useconds_t usecs
)
1089 tv
.tv_nsec
= usecs
* 1000;
1092 result
= nanosleep(&tv
, &tv
);
1093 } while(result
== -1 && errno
== EINTR
);
1098 /* This destructor keeps the process alive for a few seconds in order
1099 * to leave time to ustd to connect to its buffers. This is necessary
1100 * for programs whose execution is very short. It is also useful in all
1101 * programs when tracing is started close to the end of the program
1104 * FIXME: For now, this only works for the first trace created in a
1108 static void __attribute__((destructor
)) keepalive()
1110 if(trace_recording() && buffers_to_export
) {
1112 DBG("Keeping process alive for consumer daemon...");
1113 while(buffers_to_export
) {
1114 const int interv
= 200000;
1115 restarting_usleep(interv
);
1118 if(total
>= 3000000) {
1119 WARN("non-consumed buffers remaining after wait limit; not waiting anymore");
1123 DBG("Finally dying...");
1128 ustcomm_fini_app(&ustcomm_app
);
1131 void ust_potential_exec(void)
1133 trace_mark(ust
, potential_exec
, MARK_NOARGS
);
1138 /* Notify ust that there was a fork. This needs to be called inside
1139 * the new process, anytime a process whose memory is not shared with
1140 * the parent is created. If this function is not called, the events
1141 * of the new process will not be collected.
1146 struct blocked_consumer
*bc
;
1147 struct blocked_consumer
*deletable_bc
= NULL
;
1150 DBG("ust: forking");
1151 ltt_trace_stop("auto");
1152 ltt_trace_destroy("auto");
1153 /* Delete all active connections */
1154 ustcomm_close_all_connections(&ustcomm_app
.server
);
1156 /* Delete all blocked consumers */
1157 list_for_each_entry(bc
, &blocked_consumers
, list
) {
1160 list_del(&bc
->list
);
1166 ltt_trace_setup("auto");
1167 result
= ltt_trace_set_type("auto", "ustrelay");
1169 ERR("ltt_trace_set_type failed");
1173 ltt_trace_alloc("auto");
1174 ltt_trace_start("auto");
1175 inform_consumer_daemon("auto");