Annotation of qemu/trace/control.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Interface for configuring and controlling the state of tracing events.
        !             3:  *
        !             4:  * Copyright (C) 2011 LluĂ­s Vilanova <[email protected]>
        !             5:  *
        !             6:  * This work is licensed under the terms of the GNU GPL, version 2.  See
        !             7:  * the COPYING file in the top-level directory.
        !             8:  */
        !             9: 
        !            10: #include "trace/control.h"
        !            11: 
        !            12: 
        !            13: void trace_backend_init_events(const char *fname)
        !            14: {
        !            15:     if (fname == NULL) {
        !            16:         return;
        !            17:     }
        !            18: 
        !            19:     FILE *fp = fopen(fname, "r");
        !            20:     if (!fp) {
        !            21:         fprintf(stderr, "error: could not open trace events file '%s': %s\n",
        !            22:                 fname, strerror(errno));
        !            23:         exit(1);
        !            24:     }
        !            25:     char line_buf[1024];
        !            26:     while (fgets(line_buf, sizeof(line_buf), fp)) {
        !            27:         size_t len = strlen(line_buf);
        !            28:         if (len > 1) {              /* skip empty lines */
        !            29:             line_buf[len - 1] = '\0';
        !            30:             if (!trace_event_set_state(line_buf, true)) {
        !            31:                 fprintf(stderr,
        !            32:                         "error: trace event '%s' does not exist\n", line_buf);
        !            33:                 exit(1);
        !            34:             }
        !            35:         }
        !            36:     }
        !            37:     if (fclose(fp) != 0) {
        !            38:         fprintf(stderr, "error: closing file '%s': %s\n",
        !            39:                 fname, strerror(errno));
        !            40:         exit(1);
        !            41:     }
        !            42: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.