- for(i=0; i < trace->nr_channels; i++) {
- if(trace->channels[i].request_collection) {
- /* iterate on all cpus */
- for(j=0; j<trace->channels[i].n_cpus; j++) {
- char *buf;
- if (asprintf(&buf, "%s_%d", trace->channels[i].channel_name, j) < 0) {
- ERR("inform_consumer_daemon : asprintf failed (%s_%d)",
- trace->channels[i].channel_name, j);
- goto finish;
- }
- result = ustcomm_request_consumer(pid, buf);
- if(result == -1) {
- WARN("Failed to request collection for channel %s. Is the daemon available?", trace->channels[i].channel_name);
- /* continue even if fail */
- }
- free(buf);
- STORE_SHARED(buffers_to_export, LOAD_SHARED(buffers_to_export)+1);
- }
- }
- }
-
- finish:
- ltt_unlock_traces();
-}
-
-int process_blkd_consumer_act(void *priv, int fd, short events)
-{
- int result;
- long consumed_old = 0;
- char *reply;
- struct blocked_consumer *bc = (struct blocked_consumer *) priv;
- char inbuf;
-
- result = read(bc->fd_producer, &inbuf, 1);
- if(result == -1) {
- PERROR("read");
- return -1;
- }
- if(result == 0) {
- int res;
- DBG("listener: got messsage that a buffer ended");
-
- res = close(bc->fd_producer);
- if(res == -1) {
- PERROR("close");
- }
-
- list_del(&bc->list);
-
- result = ustcomm_send_reply(&bc->server, "END", &bc->src);
- if(result < 0) {
- ERR("ustcomm_send_reply failed");
- return -1;
- }