Changes in uspace/srv/taskmon/taskmon.c [d9fae235:ffa2c8ef] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/taskmon/taskmon.c
rd9fae235 rffa2c8ef 36 36 37 37 #include <stdio.h> 38 #include <ipc/ipc.h>39 38 #include <async.h> 40 39 #include <ipc/services.h> … … 50 49 static void fault_event(ipc_callid_t callid, ipc_call_t *call) 51 50 { 52 const char *argv[6];53 51 const char *fname; 54 char *dump_fname;55 52 char *s_taskid; 56 const char **s;53 int rc; 57 54 58 55 task_id_t taskid; … … 62 59 thread = IPC_GET_ARG3(*call); 63 60 64 if (asprintf(&s_taskid, "%" PRIu TASKID, taskid) < 0) {61 if (asprintf(&s_taskid, "%" PRIu64, taskid) < 0) { 65 62 printf("Memory allocation failed.\n"); 66 63 return; 67 64 } 68 65 69 if (asprintf(&dump_fname, "/data/core%" PRIuTASKID, taskid) < 0) { 66 printf(NAME ": Task %" PRIu64 " fault in thread %p.\n", taskid, 67 (void *) thread); 68 69 fname = "/app/taskdump"; 70 71 #ifdef CONFIG_WRITE_CORE_FILES 72 char *dump_fname; 73 74 if (asprintf(&dump_fname, "/data/core%" PRIu64, taskid) < 0) { 70 75 printf("Memory allocation failed.\n"); 71 76 return; 72 77 } 73 78 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", fname, dump_fname, s_taskid); 80 rc = task_spawnl(NULL, fname, fname, "-c", dump_fname, "-t", s_taskid, 81 NULL); 83 82 #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", fname, s_taskid); 84 rc = task_spawnl(NULL, fname, fname, "-t", s_taskid, NULL); 88 85 #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)); 97 89 } 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));104 90 } 105 91
Note:
See TracChangeset
for help on using the changeset viewer.