ARGUSED */
| 118 | |
| 119 | /* ARGUSED */ |
| 120 | int |
| 121 | sys_pdfork(struct thread *td, struct pdfork_args *uap) |
| 122 | { |
| 123 | struct fork_req fr; |
| 124 | int error, fd, pid; |
| 125 | |
| 126 | bzero(&fr, sizeof(fr)); |
| 127 | fr.fr_flags = RFFDG | RFPROC | RFPROCDESC; |
| 128 | fr.fr_pidp = &pid; |
| 129 | fr.fr_pd_fd = &fd; |
| 130 | fr.fr_pd_flags = uap->flags; |
| 131 | AUDIT_ARG_FFLAGS(uap->flags); |
| 132 | /* |
| 133 | * It is necessary to return fd by reference because 0 is a valid file |
| 134 | * descriptor number, and the child needs to be able to distinguish |
| 135 | * itself from the parent using the return value. |
| 136 | */ |
| 137 | error = fork1(td, &fr); |
| 138 | if (error == 0) { |
| 139 | td->td_retval[0] = pid; |
| 140 | td->td_retval[1] = 0; |
| 141 | error = copyout(&fd, uap->fdp, sizeof(fd)); |
| 142 | } |
| 143 | return (error); |
| 144 | } |
| 145 | |
| 146 | /* ARGSUSED */ |
| 147 | int |