main()
{
  int pid;
  task_t child;
  int err;
  int right;
  int foo;

  pid = fork ();
  switch (pid)
    {
    default:			/* parent */
      child = task_by_pid (pid);
      
      mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE,
			  &right);

      mach_port_insert_right (mach_task_self (), right, right, 
			      MACH_MSG_TYPE_MAKE_SEND);
      
      /* Send it to the child */
      err = 
	mach_port_insert_right (child, 500, right, MACH_MSG_TYPE_MOVE_SEND);

      printf ("PARENT: insert of right to child: %d\n", err);
      break;

    case 0:			/* child */
      printf ("Child started.\n");
      mach_init ();
      
      while (err1 = mach_port_mod_refs (mach_task_self (), 500, 
					MACH_PORT_RIGHT_SEND, &foo))
  
