Changeset 92c1680 in mainline
- Timestamp:
- 2013-09-09T21:13:57Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2e2c18a1
- Parents:
- ee7f78a
- Files:
-
- 5 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/Makefile.common
ree7f78a r92c1680 165 165 $(USPACE_PATH)/app/blkdump/blkdump \ 166 166 $(USPACE_PATH)/app/bnchmark/bnchmark \ 167 $(USPACE_PATH)/app/corecfg/corecfg \ 167 168 $(USPACE_PATH)/app/devctl/devctl \ 168 169 $(USPACE_PATH)/app/dltest/dltest \ -
uspace/Makefile
ree7f78a r92c1680 38 38 app/blkdump \ 39 39 app/bnchmark \ 40 app/corecfg \ 40 41 app/devctl \ 41 42 app/dnscfg \ -
uspace/lib/c/Makefile
ree7f78a r92c1680 65 65 generic/cfg.c \ 66 66 generic/clipboard.c \ 67 generic/corecfg.c \ 67 68 generic/devman.c \ 68 69 generic/device/hw_res.c \ -
uspace/lib/c/include/ipc/services.h
ree7f78a r92c1680 53 53 } services_t; 54 54 55 #define SERVICE_NAME_CORECFG "corecfg" 55 56 #define SERVICE_NAME_DNSR "net/dnsr" 56 57 #define SERVICE_NAME_INET "net/inet" -
uspace/srv/taskmon/taskmon.c
ree7f78a r92c1680 1 1 /* 2 * Copyright (c) 201 0Jiri Svoboda2 * Copyright (c) 2013 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 41 41 #include <task.h> 42 42 #include <event.h> 43 #include <ipc/corecfg.h> 44 #include <loc.h> 43 45 #include <macros.h> 44 46 #include <errno.h> … … 47 49 #define NAME "taskmon" 48 50 51 static bool write_core_files; 52 53 static void corecfg_client_conn(ipc_callid_t , ipc_call_t *, void *); 54 49 55 static void fault_event(ipc_callid_t callid, ipc_call_t *call) 50 56 { 51 57 const char *fname; 52 58 char *s_taskid; 59 char *dump_fname; 53 60 int rc; 54 61 … … 69 76 fname = "/app/taskdump"; 70 77 71 #ifdef CONFIG_WRITE_CORE_FILES 72 char *dump_fname; 78 if (write_core_files) { 79 if (asprintf(&dump_fname, "/data/core%" PRIu64, taskid) < 0) { 80 printf("Memory allocation failed.\n"); 81 return; 82 } 73 83 74 if (asprintf(&dump_fname, "/data/core%" PRIu64, taskid) < 0) { 75 printf("Memory allocation failed.\n"); 76 return; 84 printf(NAME ": Executing %s -c %s -t %s\n", fname, dump_fname, s_taskid); 85 rc = task_spawnl(NULL, fname, fname, "-c", dump_fname, "-t", s_taskid, 86 NULL); 87 } else { 88 printf(NAME ": Executing %s -t %s\n", fname, s_taskid); 89 rc = task_spawnl(NULL, fname, fname, "-t", s_taskid, NULL); 77 90 } 78 91 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);82 #else83 printf(NAME ": Executing %s -t %s\n", fname, s_taskid);84 rc = task_spawnl(NULL, fname, fname, "-t", s_taskid, NULL);85 #endif86 92 if (rc != EOK) { 87 93 printf("%s: Error spawning %s (%s).\n", NAME, fname, 88 94 str_error(rc)); 95 } 96 } 97 98 static void corecfg_get_enable_srv(ipc_callid_t iid, ipc_call_t *icall) 99 { 100 async_answer_1(iid, EOK, write_core_files); 101 } 102 103 static void corecfg_set_enable_srv(ipc_callid_t iid, ipc_call_t *icall) 104 { 105 write_core_files = IPC_GET_ARG1(*icall); 106 async_answer_0(iid, EOK); 107 } 108 109 static void corecfg_client_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg) 110 { 111 /* Accept the connection */ 112 async_answer_0(iid, EOK); 113 114 while (true) { 115 ipc_call_t call; 116 ipc_callid_t callid = async_get_call(&call); 117 sysarg_t method = IPC_GET_IMETHOD(call); 118 119 if (!method) { 120 /* The other side has hung up */ 121 async_answer_0(callid, EOK); 122 return; 123 } 124 125 switch (method) { 126 case CORECFG_GET_ENABLE: 127 corecfg_get_enable_srv(callid, &call); 128 break; 129 case CORECFG_SET_ENABLE: 130 corecfg_set_enable_srv(callid, &call); 131 break; 132 } 89 133 } 90 134 } … … 94 138 printf("%s: Task Monitoring Service\n", NAME); 95 139 140 #ifdef CONFIG_WRITE_CORE_FILES 141 write_core_files = true; 142 #else 143 write_core_files = false; 144 #endif 96 145 if (event_subscribe(EVENT_FAULT, 0) != EOK) { 97 146 printf("%s: Error registering fault notifications.\n", NAME); 147 return -1; 148 } 149 150 async_set_client_connection(corecfg_client_conn); 151 152 int rc = loc_server_register(NAME); 153 if (rc != EOK) { 154 printf("%s: Failed registering server (%d).\n", 155 NAME, rc); 156 return -1; 157 } 158 159 service_id_t sid; 160 rc = loc_service_register(SERVICE_NAME_CORECFG, &sid); 161 if (rc != EOK) { 162 printf("%s: Failed registering service (%d).\n", 163 NAME, rc); 98 164 return -1; 99 165 }
Note:
See TracChangeset
for help on using the changeset viewer.