Changeset 0b749a3 in mainline for uspace/srv/taskmon/taskmon.c


Ignore:
Timestamp:
2010-11-22T15:39:53Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0eddb76, aae339e9
Parents:
9a1d8ab (diff), 8cd1aa5e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge development/ changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/taskmon/taskmon.c

    r9a1d8ab r0b749a3  
    5050static void fault_event(ipc_callid_t callid, ipc_call_t *call)
    5151{
    52         const char *argv[6];
    5352        const char *fname;
    54         char *dump_fname;
    5553        char *s_taskid;
    56         const char **s;
     54        int rc;
    5755
    5856        task_id_t taskid;
     
    6765        }
    6866
     67        printf(NAME ": Task %" PRIuTASKID " fault in thread %p.\n", taskid, thread);
     68
     69        fname = "/app/taskdump";
     70
     71#ifdef CONFIG_WRITE_CORE_FILES
     72        char *dump_fname;
     73
    6974        if (asprintf(&dump_fname, "/data/core%" PRIuTASKID, taskid) < 0) {
    7075                printf("Memory allocation failed.\n");
     
    7277        }
    7378
    74         printf(NAME ": Task %" PRIuTASKID " fault in thread %p.\n", taskid, thread);
    75 
    76 #ifdef CONFIG_WRITE_CORE_FILES
    77         argv[0] = "/app/taskdump";
    78         argv[1] = "-c";
    79         argv[2] = dump_fname;
    80         argv[3] = "-t";
    81         argv[4] = s_taskid;
    82         argv[5] = NULL;
     79        printf(NAME ": Executing %s -c %s -t %s\n", dump_fname, s_taskid);
     80        rc = task_spawnl(NULL, fname, fname, "-c", dump_fname, "-t", s_taskid,
     81            NULL);
    8382#else
    84         argv[0] = "/app/taskdump";
    85         argv[1] = "-t";
    86         argv[2] = s_taskid;
    87         argv[3] = NULL;
     83        printf(NAME ": Executing %s -t %s\n", s_taskid);
     84        rc = task_spawnl(NULL, fname, fname, "-t", s_taskid, NULL);
    8885#endif
    89         fname = argv[0];
    90 
    91         printf(NAME ": Executing");
    92        
    93         s = argv;
    94         while (*s != NULL) {
    95                 printf(" %s", *s);
    96                 ++s;
     86        if (rc != EOK) {
     87                printf("%s: Error spawning %s (%s).\n", NAME, fname,
     88                    str_error(rc));
    9789        }
    98         putchar('\n');
    99        
    100         int err;
    101         if (!task_spawn(fname, argv, &err))
    102                 printf("%s: Error spawning %s (%s).\n", NAME, fname,
    103                     str_error(err));
    10490}
    10591
Note: See TracChangeset for help on using the changeset viewer.