Changeset 46c20c8 in mainline for uspace/srv/taskmon/taskmon.c


Ignore:
Timestamp:
2010-11-26T20:08:10Z (15 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
45df59a
Parents:
fb150d78 (diff), ffdd2b9 (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 mainline changes.

File:
1 edited

Legend:

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

    rfb150d78 r46c20c8  
    4444#include <macros.h>
    4545#include <errno.h>
     46#include <str_error.h>
    4647
    4748#define NAME  "taskmon"
     
    4950static void fault_event(ipc_callid_t callid, ipc_call_t *call)
    5051{
    51         char *argv[6];
    52         char *fname;
    53         char *dump_fname;
     52        const char *fname;
    5453        char *s_taskid;
    55         char **s;
     54        int rc;
    5655
    5756        task_id_t taskid;
     
    6160        thread = IPC_GET_ARG3(*call);
    6261
    63         if (asprintf(&s_taskid, "%" PRIuTASKID, taskid) < 0) {
     62        if (asprintf(&s_taskid, "%" PRIu64, taskid) < 0) {
    6463                printf("Memory allocation failed.\n");
    6564                return;
    6665        }
    6766
    68         if (asprintf(&dump_fname, "/data/core%" PRIuTASKID, taskid) < 0) {
     67        printf(NAME ": Task %" PRIu64 " fault in thread %p.\n", taskid,
     68            (void *) thread);
     69
     70        fname = "/app/taskdump";
     71
     72#ifdef CONFIG_WRITE_CORE_FILES
     73        char *dump_fname;
     74
     75        if (asprintf(&dump_fname, "/data/core%" PRIu64, taskid) < 0) {
    6976                printf("Memory allocation failed.\n");
    7077                return;
    7178        }
    7279
    73         printf(NAME ": Task %" PRIuTASKID " fault in thread %p.\n", taskid, thread);
    74 
    75 #ifdef CONFIG_WRITE_CORE_FILES
    76         argv[0] = "/app/taskdump";
    77         argv[1] = "-c";
    78         argv[2] = dump_fname;
    79         argv[3] = "-t";
    80         argv[4] = s_taskid;
    81         argv[5] = NULL;
     80        printf(NAME ": Executing %s -c %s -t %s\n", fname, dump_fname, s_taskid);
     81        rc = task_spawnl(NULL, fname, fname, "-c", dump_fname, "-t", s_taskid,
     82            NULL);
    8283#else
    83         argv[0] = "/app/taskdump";
    84         argv[1] = "-t";
    85         argv[2] = s_taskid;
    86         argv[3] = NULL;
     84        printf(NAME ": Executing %s -t %s\n", fname, s_taskid);
     85        rc = task_spawnl(NULL, fname, fname, "-t", s_taskid, NULL);
    8786#endif
    88         fname = argv[0];
    89 
    90         printf(NAME ": Executing");
    91         s = argv;
    92         while (*s != NULL) {
    93                 printf(" %s", *s);
    94                 ++s;
     87        if (rc != EOK) {
     88                printf("%s: Error spawning %s (%s).\n", NAME, fname,
     89                    str_error(rc));
    9590        }
    96         putchar('\n');
    97 
    98         if (!task_spawn(fname, argv))
    99                 printf(NAME ": Error spawning taskdump.\n", fname);
    10091}
    10192
Note: See TracChangeset for help on using the changeset viewer.