Changes in uspace/app/init/init.c [991f645:527298a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/init/init.c
r991f645 r527298a 124 124 static void spawn(const char *fname) 125 125 { 126 int rc;126 const char *argv[2]; 127 127 struct stat s; 128 128 … … 131 131 132 132 printf("%s: Spawning %s\n", NAME, fname); 133 rc = task_spawnl(NULL, fname, fname, NULL); 134 if (rc != EOK) { 133 134 argv[0] = fname; 135 argv[1] = NULL; 136 137 int err; 138 if (!task_spawn(fname, argv, &err)) 135 139 printf("%s: Error spawning %s (%s)\n", NAME, fname, 136 str_error(rc)); 137 } 140 str_error(err)); 138 141 } 139 142 140 143 static void srv_start(const char *fname) 141 144 { 145 const char *argv[2]; 142 146 task_id_t id; 143 147 task_exit_t texit; … … 149 153 150 154 printf("%s: Starting %s\n", NAME, fname); 151 rc = task_spawnl(&id, fname, fname, NULL); 155 156 argv[0] = fname; 157 argv[1] = NULL; 158 159 id = task_spawn(fname, argv, &retval); 152 160 if (!id) { 153 161 printf("%s: Error spawning %s (%s)\n", NAME, fname, 154 str_error(r c));162 str_error(retval)); 155 163 return; 156 164 } … … 159 167 if (rc != EOK) { 160 168 printf("%s: Error waiting for %s (%s(\n", NAME, fname, 161 str_error(r c));169 str_error(retval)); 162 170 return; 163 171 } 164 172 165 if (texit != TASK_EXIT_NORMAL) { 166 printf("%s: Server %s failed to start (unexpectedly " 167 "terminated)\n", NAME, fname); 168 return; 169 } 170 171 if (retval != 0) { 172 printf("%s: Server %s failed to start (exit code %d)\n", NAME, 173 fname, retval); 173 if ((texit != TASK_EXIT_NORMAL) || (retval != 0)) { 174 printf("%s: Server %s failed to start (%s)\n", NAME, 175 fname, str_error(retval)); 174 176 } 175 177 } … … 177 179 static void console(const char *dev) 178 180 { 181 const char *argv[3]; 179 182 char hid_in[DEVMAP_NAME_MAXLEN]; 180 183 int rc; … … 185 188 186 189 /* Wait for the input device to be ready */ 187 dev map_handle_t handle;190 dev_handle_t handle; 188 191 rc = devmap_device_get_handle(dev, &handle, IPC_FLAG_BLOCKING); 189 if (rc != EOK) { 192 193 if (rc == EOK) { 194 argv[0] = SRV_CONSOLE; 195 argv[1] = hid_in; 196 argv[2] = NULL; 197 198 if (!task_spawn(SRV_CONSOLE, argv, &rc)) 199 printf("%s: Error spawning %s %s (%s)\n", NAME, SRV_CONSOLE, 200 hid_in, str_error(rc)); 201 } else 190 202 printf("%s: Error waiting on %s (%s)\n", NAME, hid_in, 191 203 str_error(rc)); 192 return; 193 } 194 195 rc = task_spawnl(NULL, SRV_CONSOLE, SRV_CONSOLE, hid_in, NULL); 196 if (rc != EOK) { 197 printf("%s: Error spawning %s %s (%s)\n", NAME, SRV_CONSOLE, 198 hid_in, str_error(rc)); 199 } 200 } 201 202 static void getterm(const char *dev, const char *app, bool wmsg) 203 { 204 } 205 206 static void getterm(const char *dev, const char *app) 207 { 208 const char *argv[4]; 204 209 char term[DEVMAP_NAME_MAXLEN]; 205 210 int rc; … … 210 215 211 216 /* Wait for the terminal device to be ready */ 212 dev map_handle_t handle;217 dev_handle_t handle; 213 218 rc = devmap_device_get_handle(dev, &handle, IPC_FLAG_BLOCKING); 214 if (rc != EOK) { 219 220 if (rc == EOK) { 221 argv[0] = APP_GETTERM; 222 argv[1] = term; 223 argv[2] = app; 224 argv[3] = NULL; 225 226 if (!task_spawn(APP_GETTERM, argv, &rc)) 227 printf("%s: Error spawning %s %s %s (%s)\n", NAME, APP_GETTERM, 228 term, app, str_error(rc)); 229 } else 215 230 printf("%s: Error waiting on %s (%s)\n", NAME, term, 216 231 str_error(rc)); 217 return;218 }219 220 if (wmsg) {221 rc = task_spawnl(NULL, APP_GETTERM, APP_GETTERM, "-w", term,222 app, NULL);223 if (rc != EOK) {224 printf("%s: Error spawning %s -w %s %s (%s)\n", NAME,225 APP_GETTERM, term, app, str_error(rc));226 }227 } else {228 rc = task_spawnl(NULL, APP_GETTERM, APP_GETTERM, term, app,229 NULL);230 if (rc != EOK) {231 printf("%s: Error spawning %s %s %s (%s)\n", NAME,232 APP_GETTERM, term, app, str_error(rc));233 }234 }235 232 } 236 233 … … 305 302 #endif 306 303 307 getterm("term/vc0", "/app/bdsh" , true);308 getterm("term/vc1", "/app/bdsh" , false);309 getterm("term/vc2", "/app/bdsh" , false);310 getterm("term/vc3", "/app/bdsh" , false);311 getterm("term/vc4", "/app/bdsh" , false);312 getterm("term/vc5", "/app/bdsh" , false);313 getterm("term/vc6", "/app/klog" , false);304 getterm("term/vc0", "/app/bdsh"); 305 getterm("term/vc1", "/app/bdsh"); 306 getterm("term/vc2", "/app/bdsh"); 307 getterm("term/vc3", "/app/bdsh"); 308 getterm("term/vc4", "/app/bdsh"); 309 getterm("term/vc5", "/app/bdsh"); 310 getterm("term/vc6", "/app/klog"); 314 311 315 312 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.