Changeset 46c20c8 in mainline for uspace/srv/taskmon/taskmon.c
- Timestamp:
- 2010-11-26T20:08:10Z (15 years ago)
- 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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/taskmon/taskmon.c
rfb150d78 r46c20c8 44 44 #include <macros.h> 45 45 #include <errno.h> 46 #include <str_error.h> 46 47 47 48 #define NAME "taskmon" … … 49 50 static void fault_event(ipc_callid_t callid, ipc_call_t *call) 50 51 { 51 char *argv[6]; 52 char *fname; 53 char *dump_fname; 52 const char *fname; 54 53 char *s_taskid; 55 char **s;54 int rc; 56 55 57 56 task_id_t taskid; … … 61 60 thread = IPC_GET_ARG3(*call); 62 61 63 if (asprintf(&s_taskid, "%" PRIu TASKID, taskid) < 0) {62 if (asprintf(&s_taskid, "%" PRIu64, taskid) < 0) { 64 63 printf("Memory allocation failed.\n"); 65 64 return; 66 65 } 67 66 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) { 69 76 printf("Memory allocation failed.\n"); 70 77 return; 71 78 } 72 79 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); 82 83 #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); 87 86 #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)); 95 90 } 96 putchar('\n');97 98 if (!task_spawn(fname, argv))99 printf(NAME ": Error spawning taskdump.\n", fname);100 91 } 101 92
Note:
See TracChangeset
for help on using the changeset viewer.