It may also instructive to look at
/usr/src/lib/posix
For example, here is _fork.c from that directory:
#include <lib.h>
#define fork _fork
#include <unistd.h>
PUBLIC pid_t fork()
{
message m;
return( _syscall(MM, FORK, &m) );
}