1 // Ping-pong a counter between two shared-memory processes.
2 // Only need to start one of these -- splits into two with sfork.
9 umain(int argc
, char **argv
)
15 if ((who
= sfork()) != 0) {
16 cprintf("i am %08x; env is %p\n", sys_getenvid(), thisenv
);
17 // get the ball rolling
18 cprintf("send 0 from %x to %x\n", sys_getenvid(), who
);
19 ipc_send(who
, 0, 0, 0);
24 cprintf("%x got %d from %x (env is %p %x)\n", sys_getenvid(), val
, who
, thisenv
, thisenv
->env_id
);
28 ipc_send(who
, 0, 0, 0);