Changeset b5e68c8 in mainline for uspace/app/init/init.c
- Timestamp:
- 2011-05-12T16:49:44Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f36787d7
- Parents:
- e80329d6 (diff), 750636a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/init/init.c
re80329d6 rb5e68c8 37 37 #include <stdio.h> 38 38 #include <unistd.h> 39 #include <ipc/ipc.h>40 39 #include <vfs/vfs.h> 41 40 #include <bool.h> … … 57 56 #define DEVFS_MOUNT_POINT "/dev" 58 57 59 #define SCRATCH_FS_TYPE "tmpfs"60 #define SCRATCH_MOUNT_POINT "/scratch"58 #define TMPFS_FS_TYPE "tmpfs" 59 #define TMPFS_MOUNT_POINT "/tmp" 61 60 62 61 #define DATA_FS_TYPE "fat" 63 #define DATA_DEVICE "bd/ disk0"62 #define DATA_DEVICE "bd/ata1disk0" 64 63 #define DATA_MOUNT_POINT "/data" 65 64 … … 124 123 static void spawn(const char *fname) 125 124 { 126 const char *argv[2];125 int rc; 127 126 struct stat s; 128 127 … … 131 130 132 131 printf("%s: Spawning %s\n", NAME, fname); 133 134 argv[0] = fname; 135 argv[1] = NULL; 136 137 int err; 138 if (!task_spawn(fname, argv, &err)) 132 rc = task_spawnl(NULL, fname, fname, NULL); 133 if (rc != EOK) { 139 134 printf("%s: Error spawning %s (%s)\n", NAME, fname, 140 str_error(err)); 135 str_error(rc)); 136 } 141 137 } 142 138 143 139 static void srv_start(const char *fname) 144 140 { 145 const char *argv[2];146 141 task_id_t id; 147 142 task_exit_t texit; … … 153 148 154 149 printf("%s: Starting %s\n", NAME, fname); 155 156 argv[0] = fname; 157 argv[1] = NULL; 158 159 id = task_spawn(fname, argv, &retval); 150 rc = task_spawnl(&id, fname, fname, NULL); 160 151 if (!id) { 161 152 printf("%s: Error spawning %s (%s)\n", NAME, fname, 162 str_error(r etval));153 str_error(rc)); 163 154 return; 164 155 } … … 167 158 if (rc != EOK) { 168 159 printf("%s: Error waiting for %s (%s(\n", NAME, fname, 169 str_error(retval)); 170 return; 171 } 172 173 if ((texit != TASK_EXIT_NORMAL) || (retval != 0)) { 174 printf("%s: Server %s failed to start (%s)\n", NAME, 175 fname, str_error(retval)); 160 str_error(rc)); 161 return; 162 } 163 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); 176 173 } 177 174 } … … 179 176 static void console(const char *dev) 180 177 { 181 const char *argv[3];182 178 char hid_in[DEVMAP_NAME_MAXLEN]; 183 179 int rc; … … 188 184 189 185 /* Wait for the input device to be ready */ 190 dev _handle_t handle;186 devmap_handle_t handle; 191 187 rc = devmap_device_get_handle(dev, &handle, IPC_FLAG_BLOCKING); 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 188 if (rc != EOK) { 202 189 printf("%s: Error waiting on %s (%s)\n", NAME, hid_in, 203 190 str_error(rc)); 204 } 205 206 static void getterm(const char *dev, const char *app) 207 { 208 const char *argv[4]; 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 { 209 203 char term[DEVMAP_NAME_MAXLEN]; 210 204 int rc; … … 215 209 216 210 /* Wait for the terminal device to be ready */ 217 dev _handle_t handle;211 devmap_handle_t handle; 218 212 rc = devmap_device_get_handle(dev, &handle, IPC_FLAG_BLOCKING); 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 213 if (rc != EOK) { 230 214 printf("%s: Error waiting on %s (%s)\n", NAME, term, 231 215 str_error(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); 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); 239 241 } 240 242 … … 268 270 } 269 271 270 mount_scratch(); 271 272 mount_tmpfs(); 273 274 #ifdef CONFIG_START_DEVMAN 275 spawn("/srv/devman"); 276 #endif 277 spawn("/srv/apic"); 278 spawn("/srv/i8259"); 272 279 spawn("/srv/fhc"); 273 280 spawn("/srv/obio"); … … 302 309 #endif 303 310 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" );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); 311 318 312 319 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.