MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sys_pdfork

Function sys_pdfork

freebsd/kern/kern_fork.c:120–144  ·  view source on GitHub ↗

ARGUSED */

Source from the content-addressed store, hash-verified

118
119/* ARGUSED */
120int
121sys_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 */
147int

Callers

nothing calls this directly

Calls 3

bzeroFunction · 0.85
fork1Function · 0.85
copyoutFunction · 0.50

Tested by

no test coverage detected