Changes in uspace/app/init/init.c [51da086:28f8f6f2] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/init/init.c
r51da086 r28f8f6f2 34 34 */ 35 35 36 #include <fibril.h> 36 37 #include <stdio.h> 37 38 #include <stdarg.h> … … 47 48 #include <config.h> 48 49 #include <io/logctl.h> 50 #include <vfs/vfs.h> 49 51 #include <vol.h> 50 52 #include "untar.h" 51 53 #include "init.h" 52 54 53 #define BANNER_LEFT "######> "54 #define BANNER_RIGHT " <######"55 56 55 #define ROOT_DEVICE "bd/initrd" 57 56 #define ROOT_MOUNT_POINT "/" … … 66 65 #define APP_GETTERM "/app/getterm" 67 66 68 #define SRV_COMPOSITOR "/srv/hid/compositor" 67 #define SRV_DISPLAY "/srv/hid/display" 68 #define DISPLAY_SVC "hid/display" 69 69 70 70 #define HID_INPUT "hid/input" 71 71 #define HID_OUTPUT "hid/output" 72 #define HID_COMPOSITOR_SERVER ":0"73 72 74 73 #define srv_start(path, ...) \ … … 84 83 { 85 84 printf("%s: HelenOS init\n", NAME); 86 }87 88 static void oom_check(errno_t rc, const char *path)89 {90 if (rc == ENOMEM) {91 printf("%sOut-of-memory condition detected%s\n", BANNER_LEFT,92 BANNER_RIGHT);93 printf("%sBailing out of the boot process after %s%s\n",94 BANNER_LEFT, path, BANNER_RIGHT);95 printf("%sMore physical memory is required%s\n", BANNER_LEFT,96 BANNER_RIGHT);97 exit(ENOMEM);98 }99 85 } 100 86 … … 215 201 216 202 if (rc != EOK) { 217 oom_check(rc, path);218 203 printf("%s: Error spawning %s (%s)\n", NAME, path, 219 204 str_error(rc)); … … 271 256 } 272 257 273 static errno_t compositor(const char *isvc, const char *name) 274 { 275 /* Wait for the input service to be ready */ 276 service_id_t service_id; 277 errno_t rc = loc_service_get_id(isvc, &service_id, IPC_FLAG_BLOCKING); 278 if (rc != EOK) { 279 printf("%s: Error waiting on %s (%s)\n", NAME, isvc, 280 str_error(rc)); 281 return rc; 282 } 283 284 return srv_start(SRV_COMPOSITOR, isvc, name); 285 } 286 287 static int gui_start(const char *app, const char *srv_name) 288 { 289 char winreg[50]; 290 snprintf(winreg, sizeof(winreg), "%s%s%s", "comp", srv_name, "/winreg"); 291 292 printf("%s: Spawning %s %s\n", NAME, app, winreg); 258 static errno_t display_server(void) 259 { 260 return srv_start(SRV_DISPLAY); 261 } 262 263 static int gui_start(const char *app, const char *display_svc) 264 { 265 printf("%s: Spawning %s\n", NAME, app); 293 266 294 267 task_id_t id; 295 268 task_wait_t wait; 296 errno_t rc = task_spawnl(&id, &wait, app, app, winreg, NULL); 297 if (rc != EOK) { 298 oom_check(rc, app); 299 printf("%s: Error spawning %s %s (%s)\n", NAME, app, 300 winreg, str_error(rc)); 301 return rc; 269 errno_t rc = task_spawnl(&id, &wait, app, app, display_svc, NULL); 270 if (rc != EOK) { 271 printf("%s: Error spawning %s (%s)\n", NAME, app, 272 str_error(rc)); 273 return -1; 302 274 } 303 275 … … 308 280 printf("%s: Error retrieving retval from %s (%s)\n", NAME, 309 281 app, str_error(rc)); 310 return rc;282 return -1; 311 283 } 312 284 … … 322 294 errno_t rc = task_spawnl(NULL, NULL, APP_GETTERM, APP_GETTERM, svc, 323 295 LOCFS_MOUNT_POINT, "--msg", "--wait", "--", app, NULL); 324 if (rc != EOK) { 325 oom_check(rc, APP_GETTERM); 296 if (rc != EOK) 326 297 printf("%s: Error spawning %s %s %s --msg --wait -- %s\n", 327 298 NAME, APP_GETTERM, svc, LOCFS_MOUNT_POINT, app); 328 }329 299 } else { 330 300 printf("%s: Spawning %s %s %s --wait -- %s\n", NAME, … … 333 303 errno_t rc = task_spawnl(NULL, NULL, APP_GETTERM, APP_GETTERM, svc, 334 304 LOCFS_MOUNT_POINT, "--wait", "--", app, NULL); 335 if (rc != EOK) { 336 oom_check(rc, APP_GETTERM); 305 if (rc != EOK) 337 306 printf("%s: Error spawning %s %s %s --wait -- %s\n", 338 307 NAME, APP_GETTERM, svc, LOCFS_MOUNT_POINT, app); 339 }340 308 } 341 309 } … … 480 448 481 449 if (!config_key_exists("console")) { 482 rc = compositor(HID_INPUT, HID_COMPOSITOR_SERVER);450 rc = display_server(); 483 451 if (rc == EOK) { 484 gui_start("/app/barber", HID_COMPOSITOR_SERVER);485 gui_start("/app/vlaunch", HID_COMPOSITOR_SERVER);486 gui_start("/app/vterm", HID_COMPOSITOR_SERVER);452 gui_start("/app/barber", DISPLAY_SVC); 453 gui_start("/app/vlaunch", DISPLAY_SVC); 454 gui_start("/app/vterm", DISPLAY_SVC); 487 455 } 488 456 }
Note:
See TracChangeset
for help on using the changeset viewer.