xref: /minix3/minix/lib/libsys/sys_fork.c (revision 433d6423c39e34ec4b79c950597bb2d236f886be)
1*433d6423SLionel Sambuc #include "syslib.h"
2*433d6423SLionel Sambuc 
sys_fork(parent,child,child_endpoint,flags,msgaddr)3*433d6423SLionel Sambuc int sys_fork(parent, child, child_endpoint, flags, msgaddr)
4*433d6423SLionel Sambuc endpoint_t parent;		/* process doing the fork */
5*433d6423SLionel Sambuc endpoint_t child;		/* which proc has been created by the fork */
6*433d6423SLionel Sambuc endpoint_t *child_endpoint;
7*433d6423SLionel Sambuc u32_t flags;
8*433d6423SLionel Sambuc vir_bytes *msgaddr;
9*433d6423SLionel Sambuc {
10*433d6423SLionel Sambuc /* A process has forked.  Tell the kernel. */
11*433d6423SLionel Sambuc 
12*433d6423SLionel Sambuc   message m;
13*433d6423SLionel Sambuc   int r;
14*433d6423SLionel Sambuc 
15*433d6423SLionel Sambuc   m.m_lsys_krn_sys_fork.endpt = parent;
16*433d6423SLionel Sambuc   m.m_lsys_krn_sys_fork.slot = child;
17*433d6423SLionel Sambuc   m.m_lsys_krn_sys_fork.flags = flags;
18*433d6423SLionel Sambuc   r = _kernel_call(SYS_FORK, &m);
19*433d6423SLionel Sambuc   *child_endpoint = m.m_krn_lsys_sys_fork.endpt;
20*433d6423SLionel Sambuc   *msgaddr = m.m_krn_lsys_sys_fork.msgaddr;
21*433d6423SLionel Sambuc   return r;
22*433d6423SLionel Sambuc }
23