summaryrefslogtreecommitdiff
path: root/debian/patches/startup-more-errorhandling.patch
blob: a93cc880f75cbcd67f60ccd102420d1f264bb979 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
commit e04b779d1cf875010befd37f1a0b86e132d077a6
Author: Justus Winter <4winter@informatik.uni-hamburg.de>
Date:   Sun Feb 8 01:32:33 2015 +0100

    startup: add more error handling
    
    * startup/startup.c (launch_core_servers): Add more error handling.

diff --git a/startup/startup.c b/startup/startup.c
index e01d2a8..da78b13 100644
--- a/startup/startup.c
+++ b/startup/startup.c
@@ -665,10 +665,11 @@ launch_core_servers (void)
   error_t err;
 
   /* Reply to the proc and auth servers.   */
-  startup_procinit_reply (procreply, procreplytype, 0,
-			  mach_task_self (), authserver,
-			  host_priv, MACH_MSG_TYPE_COPY_SEND,
-			  device_master, MACH_MSG_TYPE_COPY_SEND);
+  err = startup_procinit_reply (procreply, procreplytype, 0,
+				mach_task_self (), authserver,
+				host_priv, MACH_MSG_TYPE_COPY_SEND,
+				device_master, MACH_MSG_TYPE_COPY_SEND);
+  assert_perror (err);
   if (!fakeboot)
     {
       mach_port_deallocate (mach_task_self (), device_master);
@@ -676,25 +677,34 @@ launch_core_servers (void)
     }
 
   /* Mark us as important.  */
-  proc_mark_important (procserver);
-  proc_mark_exec (procserver);
+  err = proc_mark_important (procserver);
+  assert_perror (err);
+  err = proc_mark_exec (procserver);
+  assert_perror (err);
 
   /* Declare that the filesystem and auth are our children. */
-  proc_child (procserver, fstask);
-  proc_child (procserver, authtask);
+  err = proc_child (procserver, fstask);
+  assert_perror (err);
+  err = proc_child (procserver, authtask);
+  assert_perror (err);
 
-  proc_task2proc (procserver, authtask, &authproc);
-  proc_mark_important (authproc);
-  proc_mark_exec (authproc);
+  err = proc_task2proc (procserver, authtask, &authproc);
+  assert_perror (err);
+  err = proc_mark_important (authproc);
+  assert_perror (err);
+  err = proc_mark_exec (authproc);
+  assert_perror (err);
 
   err = install_as_translator ();
   if (err)
     /* Good luck.  Who knows, maybe it's an old installation.  */
     error (0, err, "Failed to bind to " _SERVERS_STARTUP);
 
-  startup_authinit_reply (authreply, authreplytype, 0, authproc,
-			  MACH_MSG_TYPE_COPY_SEND);
-  mach_port_deallocate (mach_task_self (), authproc);
+  err = startup_authinit_reply (authreply, authreplytype, 0, authproc,
+				MACH_MSG_TYPE_COPY_SEND);
+  assert_perror (err);
+  err = mach_port_deallocate (mach_task_self (), authproc);
+  assert_perror (err);
 
   /* Give the library our auth and proc server ports.  */
   _hurd_port_set (&_hurd_ports[INIT_PORT_AUTH], authserver);
@@ -703,13 +713,16 @@ launch_core_servers (void)
   /* Do NOT run _hurd_proc_init!  That will start signals, which we do not
      want.  We listen to our own message port.  Tell the proc server where
      our args and environment are.  */
-  proc_set_arg_locations (procserver,
-			  (vm_address_t) global_argv, (vm_address_t) environ);
+  err = proc_set_arg_locations (procserver,
+				(vm_address_t) global_argv,
+				(vm_address_t) environ);
+  assert_perror (err);
 
   default_ports[INIT_PORT_AUTH] = authserver;
 
   /* Declare that the proc server is our child.  */
-  proc_child (procserver, proctask);
+  err = proc_child (procserver, proctask);
+  assert_perror (err);
   err = proc_task2proc (procserver, proctask, &procproc);
   if (!err)
     {
@@ -718,13 +731,18 @@ launch_core_servers (void)
       mach_port_deallocate (mach_task_self (), procproc);
     }
 
-  proc_register_version (procserver, host_priv, "init", "", HURD_VERSION);
+  err = proc_register_version (procserver, host_priv,
+			       "init", "", HURD_VERSION);
+  assert_perror (err);
 
   /* Get the bootstrap filesystem's proc server port.
      We must do this before calling proc_setmsgport below.  */
-  proc_task2proc (procserver, fstask, &fsproc);
-  proc_mark_important (fsproc);
-  proc_mark_exec (fsproc);
+  err = proc_task2proc (procserver, fstask, &fsproc);
+  assert_perror (err);
+  err = proc_mark_important (fsproc);
+  assert_perror (err);
+  err = proc_mark_exec (fsproc);
+  assert_perror (err);
 
 #if 0
   printf ("Init has completed.\n");
@@ -739,7 +757,8 @@ launch_core_servers (void)
      before accepting more RPC requests!  However, we must do this before
      calling fsys_init, because fsys_init blocks on exec_init, and
      exec_init will block waiting on our message port.  */
-  proc_setmsgport (procserver, startup, &old);
+  err = proc_setmsgport (procserver, startup, &old);
+  assert_perror (err);
   if (old != MACH_PORT_NULL)
     mach_port_deallocate (mach_task_self (), old);