Changes in uspace/srv/taskmon/taskmon.c [ffa2c8ef:d9fae235] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/taskmon/taskmon.c
rffa2c8ef rd9fae235 36 36 37 37 #include <stdio.h> 38 #include <ipc/ipc.h> 38 39 #include <async.h> 39 40 #include <ipc/services.h> … … 49 50 static void fault_event(ipc_callid_t callid, ipc_call_t *call) 50 51 { 52 const char *argv[6]; 51 53 const char *fname; 54 char *dump_fname; 52 55 char *s_taskid; 53 int rc;56 const char **s; 54 57 55 58 task_id_t taskid; … … 59 62 thread = IPC_GET_ARG3(*call); 60 63 61 if (asprintf(&s_taskid, "%" PRIu 64, taskid) < 0) {64 if (asprintf(&s_taskid, "%" PRIuTASKID, taskid) < 0) { 62 65 printf("Memory allocation failed.\n"); 63 66 return; 64 67 } 65 68 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) { 69 if (asprintf(&dump_fname, "/data/core%" PRIuTASKID, taskid) < 0) { 75 70 printf("Memory allocation failed.\n"); 76 71 return; 77 72 } 78 73 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); 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; 82 83 #else 83 printf(NAME ": Executing %s -t %s\n", fname, s_taskid); 84 rc = task_spawnl(NULL, fname, fname, "-t", s_taskid, NULL); 84 argv[0] = "/app/taskdump"; 85 argv[1] = "-t"; 86 argv[2] = s_taskid; 87 argv[3] = NULL; 85 88 #endif 86 if (rc != EOK) { 89 fname = argv[0]; 90 91 printf(NAME ": Executing"); 92 93 s = argv; 94 while (*s != NULL) { 95 printf(" %s", *s); 96 ++s; 97 } 98 putchar('\n'); 99 100 int err; 101 if (!task_spawn(fname, argv, &err)) 87 102 printf("%s: Error spawning %s (%s).\n", NAME, fname, 88 str_error(rc)); 89 } 103 str_error(err)); 90 104 } 91 105
Note:
See TracChangeset
for help on using the changeset viewer.