Changes in uspace/app/init/init.c [28f8f6f2:51da086] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/init/init.c
r28f8f6f2 r51da086 34 34 */ 35 35 36 #include <fibril.h>37 36 #include <stdio.h> 38 37 #include <stdarg.h> … … 48 47 #include <config.h> 49 48 #include <io/logctl.h> 50 #include <vfs/vfs.h>51 49 #include <vol.h> 52 50 #include "untar.h" 53 51 #include "init.h" 54 52 53 #define BANNER_LEFT "######> " 54 #define BANNER_RIGHT " <######" 55 55 56 #define ROOT_DEVICE "bd/initrd" 56 57 #define ROOT_MOUNT_POINT "/" … … 65 66 #define APP_GETTERM "/app/getterm" 66 67 67 #define SRV_DISPLAY "/srv/hid/display" 68 #define DISPLAY_SVC "hid/display" 68 #define SRV_COMPOSITOR "/srv/hid/compositor" 69 69 70 70 #define HID_INPUT "hid/input" 71 71 #define HID_OUTPUT "hid/output" 72 #define HID_COMPOSITOR_SERVER ":0" 72 73 73 74 #define srv_start(path, ...) \ … … 83 84 { 84 85 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 } 85 99 } 86 100 … … 201 215 202 216 if (rc != EOK) { 217 oom_check(rc, path); 203 218 printf("%s: Error spawning %s (%s)\n", NAME, path, 204 219 str_error(rc)); … … 256 271 } 257 272 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); 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); 266 293 267 294 task_id_t id; 268 295 task_wait_t wait; 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; 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; 274 302 } 275 303 … … 280 308 printf("%s: Error retrieving retval from %s (%s)\n", NAME, 281 309 app, str_error(rc)); 282 return -1;310 return rc; 283 311 } 284 312 … … 294 322 errno_t rc = task_spawnl(NULL, NULL, APP_GETTERM, APP_GETTERM, svc, 295 323 LOCFS_MOUNT_POINT, "--msg", "--wait", "--", app, NULL); 296 if (rc != EOK) 324 if (rc != EOK) { 325 oom_check(rc, APP_GETTERM); 297 326 printf("%s: Error spawning %s %s %s --msg --wait -- %s\n", 298 327 NAME, APP_GETTERM, svc, LOCFS_MOUNT_POINT, app); 328 } 299 329 } else { 300 330 printf("%s: Spawning %s %s %s --wait -- %s\n", NAME, … … 303 333 errno_t rc = task_spawnl(NULL, NULL, APP_GETTERM, APP_GETTERM, svc, 304 334 LOCFS_MOUNT_POINT, "--wait", "--", app, NULL); 305 if (rc != EOK) 335 if (rc != EOK) { 336 oom_check(rc, APP_GETTERM); 306 337 printf("%s: Error spawning %s %s %s --wait -- %s\n", 307 338 NAME, APP_GETTERM, svc, LOCFS_MOUNT_POINT, app); 339 } 308 340 } 309 341 } … … 448 480 449 481 if (!config_key_exists("console")) { 450 rc = display_server();482 rc = compositor(HID_INPUT, HID_COMPOSITOR_SERVER); 451 483 if (rc == EOK) { 452 gui_start("/app/barber", DISPLAY_SVC);453 gui_start("/app/vlaunch", DISPLAY_SVC);454 gui_start("/app/vterm", DISPLAY_SVC);484 gui_start("/app/barber", HID_COMPOSITOR_SERVER); 485 gui_start("/app/vlaunch", HID_COMPOSITOR_SERVER); 486 gui_start("/app/vterm", HID_COMPOSITOR_SERVER); 455 487 } 456 488 }
Note:
See TracChangeset
for help on using the changeset viewer.