702 |
size_t destroynameslen) |
size_t destroynameslen) |
703 |
{ |
{ |
704 |
error_t err; |
error_t err; |
705 |
|
file_t file; |
706 |
|
|
707 |
if (!user) |
if (!user) |
708 |
return EOPNOTSUPP; |
return EOPNOTSUPP; |
709 |
|
|
710 |
/* We cannot use MACH_MSG_TYPE_MOVE_SEND because we might need to |
mutex_lock (&user->po->np->lock); |
711 |
retry an interrupted call that would have consumed the rights. */ |
err = check_openmodes (user->po->np->nn, O_EXEC, MACH_PORT_NULL); |
712 |
err = file_exec (user->po->np->nn->file, task, flags, argv, argvlen, |
file = user->po->np->nn->file; |
713 |
envp, envplen, fds, MACH_MSG_TYPE_COPY_SEND, fdslen, |
if (!err) |
714 |
portarray, MACH_MSG_TYPE_COPY_SEND, portarraylen, |
err = mach_port_mod_refs (mach_task_self (), |
715 |
intarray, intarraylen, deallocnames, deallocnameslen, |
file, MACH_PORT_RIGHT_SEND, 1); |
716 |
destroynames, destroynameslen); |
mutex_unlock (&user->po->np->lock); |
717 |
|
|
718 |
|
if (!err) |
719 |
|
{ |
720 |
|
/* We cannot use MACH_MSG_TYPE_MOVE_SEND because we might need to |
721 |
|
retry an interrupted call that would have consumed the rights. */ |
722 |
|
err = file_exec (user->po->np->nn->file, task, flags, argv, argvlen, |
723 |
|
envp, envplen, fds, MACH_MSG_TYPE_COPY_SEND, fdslen, |
724 |
|
portarray, MACH_MSG_TYPE_COPY_SEND, portarraylen, |
725 |
|
intarray, intarraylen, deallocnames, deallocnameslen, |
726 |
|
destroynames, destroynameslen); |
727 |
|
mach_port_deallocate (mach_task_self (), file); |
728 |
|
} |
729 |
|
|
730 |
if (err == 0) |
if (err == 0) |
731 |
{ |
{ |
732 |
size_t i; |
size_t i; |