2005-04-21 16:53:53 +02:00
|
|
|
#include "syslib.h"
|
|
|
|
|
2009-09-21 16:42:58 +02:00
|
|
|
PUBLIC int sys_fork(parent, child, child_endpoint, map_ptr, flags, msgaddr)
|
2008-11-19 13:26:10 +01:00
|
|
|
endpoint_t parent; /* process doing the fork */
|
|
|
|
endpoint_t child; /* which proc has been created by the fork */
|
2009-09-23 12:48:57 +02:00
|
|
|
endpoint_t *child_endpoint;
|
2006-05-11 16:47:31 +02:00
|
|
|
struct mem_map *map_ptr;
|
2008-11-19 13:26:10 +01:00
|
|
|
u32_t flags;
|
2009-09-21 16:42:58 +02:00
|
|
|
vir_bytes *msgaddr;
|
2005-04-21 16:53:53 +02:00
|
|
|
{
|
|
|
|
/* A process has forked. Tell the kernel. */
|
|
|
|
|
|
|
|
message m;
|
2006-03-03 10:44:55 +01:00
|
|
|
int r;
|
2005-04-21 16:53:53 +02:00
|
|
|
|
2006-03-03 10:44:55 +01:00
|
|
|
m.PR_ENDPT = parent;
|
|
|
|
m.PR_SLOT = child;
|
2007-04-02 17:10:07 +02:00
|
|
|
m.PR_MEM_PTR = (char *) map_ptr;
|
2008-11-19 13:26:10 +01:00
|
|
|
m.PR_FORK_FLAGS = flags;
|
2006-03-03 10:44:55 +01:00
|
|
|
r = _taskcall(SYSTASK, SYS_FORK, &m);
|
|
|
|
*child_endpoint = m.PR_ENDPT;
|
2009-09-23 12:48:57 +02:00
|
|
|
*msgaddr = (vir_bytes) m.PR_FORK_MSGADDR;
|
2006-03-03 10:44:55 +01:00
|
|
|
return r;
|
2005-04-21 16:53:53 +02:00
|
|
|
}
|