392 |
directly to effect what posix_spawn does in the simple case. */ |
directly to effect what posix_spawn does in the simple case. */ |
393 |
{ |
{ |
394 |
task_t newtask; |
task_t newtask; |
395 |
|
process_t proc; |
396 |
file_t execfile = file_name_lookup (argv[argi], O_EXEC, 0); |
file_t execfile = file_name_lookup (argv[argi], O_EXEC, 0); |
397 |
if (execfile == MACH_PORT_NULL) |
if (execfile == MACH_PORT_NULL) |
398 |
error (3, errno, "%s", argv[argi]); |
error (3, errno, "%s", argv[argi]); |
407 |
child = task2pid (newtask); |
child = task2pid (newtask); |
408 |
if (child < 0) |
if (child < 0) |
409 |
error (3, errno, "task2pid"); |
error (3, errno, "task2pid"); |
410 |
|
proc = getproc (); |
411 |
|
err = proc_child (proc, newtask); |
412 |
|
mach_port_deallocate (mach_task_self (), proc); |
413 |
|
if (err) |
414 |
|
error (3, err, "proc_child"); |
415 |
|
|
416 |
err = _hurd_exec (newtask, execfile, &argv[argi], environ); |
err = _hurd_exec (newtask, execfile, &argv[argi], environ); |
417 |
mach_port_deallocate (mach_task_self (), newtask); |
mach_port_deallocate (mach_task_self (), newtask); |
418 |
mach_port_deallocate (mach_task_self (), execfile); |
mach_port_deallocate (mach_task_self (), execfile); |