Changes in uspace/app/init/init.c [3acb285:7bbc389] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/init/init.c
r3acb285 r7bbc389 37 37 #include <stdio.h> 38 38 #include <unistd.h> 39 #include <ipc/ipc.h> 39 40 #include <vfs/vfs.h> 40 41 #include <bool.h> … … 56 57 #define DEVFS_MOUNT_POINT "/dev" 57 58 58 #define TMPFS_FS_TYPE "tmpfs"59 #define TMPFS_MOUNT_POINT "/tmp"59 #define SCRATCH_FS_TYPE "tmpfs" 60 #define SCRATCH_MOUNT_POINT "/scratch" 60 61 61 62 #define DATA_FS_TYPE "fat" 62 #define DATA_DEVICE "bd/ ata1disk0"63 #define DATA_DEVICE "bd/disk0" 63 64 #define DATA_MOUNT_POINT "/data" 64 65 … … 123 124 static void spawn(const char *fname) 124 125 { 125 int rc;126 const char *argv[2]; 126 127 struct stat s; 127 128 … … 130 131 131 132 printf("%s: Spawning %s\n", NAME, fname); 132 rc = task_spawnl(NULL, fname, fname, NULL); 133 if (rc != EOK) { 133 134 argv[0] = fname; 135 argv[1] = NULL; 136 137 int err; 138 if (!task_spawn(fname, argv, &err)) 134 139 printf("%s: Error spawning %s (%s)\n", NAME, fname, 135 str_error(rc)); 136 } 140 str_error(err)); 137 141 } 138 142 139 143 static void srv_start(const char *fname) 140 144 { 145 const char *argv[2]; 141 146 task_id_t id; 142 147 task_exit_t texit; … … 148 153 149 154 printf("%s: Starting %s\n", NAME, fname); 150 rc = task_spawnl(&id, fname, fname, NULL); 155 156 argv[0] = fname; 157 argv[1] = NULL; 158 159 id = task_spawn(fname, argv, &retval); 151 160 if (!id) { 152 161 printf("%s: Error spawning %s (%s)\n", NAME, fname, 153 str_error(r c));162 str_error(retval)); 154 163 return; 155 164 } … … 158 167 if (rc != EOK) { 159 168 printf("%s: Error waiting for %s (%s(\n", NAME, fname, 160 str_error(r c));169 str_error(retval)); 161 170 return; 162 171 } 163 172 164 if (texit != TASK_EXIT_NORMAL) { 165 printf("%s: Server %s failed to start (unexpectedly " 166 "terminated)\n", NAME, fname); 167 return; 168 } 169 170 if (retval != 0) { 171 printf("%s: Server %s failed to start (exit code %d)\n", NAME, 172 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)); 173 176 } 174 177 } … … 176 179 static void console(const char *dev) 177 180 { 181 const char *argv[3]; 178 182 char hid_in[DEVMAP_NAME_MAXLEN]; 179 183 int rc; … … 184 188 185 189 /* Wait for the input device to be ready */ 186 dev map_handle_t handle;190 dev_handle_t handle; 187 191 rc = devmap_device_get_handle(dev, &handle, IPC_FLAG_BLOCKING); 188 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 189 202 printf("%s: Error waiting on %s (%s)\n", NAME, hid_in, 190 203 str_error(rc)); 191 return; 192 } 193 194 rc = task_spawnl(NULL, SRV_CONSOLE, SRV_CONSOLE, hid_in, NULL); 195 if (rc != EOK) { 196 printf("%s: Error spawning %s %s (%s)\n", NAME, SRV_CONSOLE, 197 hid_in, str_error(rc)); 198 } 199 } 200 201 static void getterm(const char *dev, const char *app, bool wmsg) 202 { 204 } 205 206 static void getterm(const char *dev, const char *app) 207 { 208 const char *argv[4]; 203 209 char term[DEVMAP_NAME_MAXLEN]; 204 210 int rc; … … 209 215 210 216 /* Wait for the terminal device to be ready */ 211 dev map_handle_t handle;217 dev_handle_t handle; 212 218 rc = devmap_device_get_handle(dev, &handle, IPC_FLAG_BLOCKING); 213 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 214 230 printf("%s: Error waiting on %s (%s)\n", NAME, term, 215 231 str_error(rc)); 216 return; 217 } 218 219 if (wmsg) { 220 rc = task_spawnl(NULL, APP_GETTERM, APP_GETTERM, "-w", term, 221 app, NULL); 222 if (rc != EOK) { 223 printf("%s: Error spawning %s -w %s %s (%s)\n", NAME, 224 APP_GETTERM, term, app, str_error(rc)); 225 } 226 } else { 227 rc = task_spawnl(NULL, APP_GETTERM, APP_GETTERM, term, app, 228 NULL); 229 if (rc != EOK) { 230 printf("%s: Error spawning %s %s %s (%s)\n", NAME, 231 APP_GETTERM, term, app, str_error(rc)); 232 } 233 } 234 } 235 236 static bool mount_tmpfs(void) 237 { 238 int rc = mount(TMPFS_FS_TYPE, TMPFS_MOUNT_POINT, "", "", 0); 239 return mount_report("Temporary filesystem", TMPFS_MOUNT_POINT, 240 TMPFS_FS_TYPE, NULL, rc); 232 } 233 234 static bool mount_scratch(void) 235 { 236 int rc = mount(SCRATCH_FS_TYPE, SCRATCH_MOUNT_POINT, "", "", 0); 237 return mount_report("Scratch filesystem", SCRATCH_MOUNT_POINT, 238 SCRATCH_FS_TYPE, NULL, rc); 241 239 } 242 240 … … 270 268 } 271 269 272 mount_tmpfs(); 273 274 #ifdef CONFIG_START_DEVMAN 275 spawn("/srv/devman"); 276 #endif 277 spawn("/srv/apic"); 278 spawn("/srv/i8259"); 270 mount_scratch(); 271 279 272 spawn("/srv/fhc"); 280 273 spawn("/srv/obio"); … … 309 302 #endif 310 303 311 getterm("term/vc0", "/app/bdsh" , true);312 getterm("term/vc1", "/app/bdsh" , false);313 getterm("term/vc2", "/app/bdsh" , false);314 getterm("term/vc3", "/app/bdsh" , false);315 getterm("term/vc4", "/app/bdsh" , false);316 getterm("term/vc5", "/app/bdsh" , false);317 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"); 318 311 319 312 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.