Ejemplo n.º 1
0
Archivo: afs.C Proyecto: bougyman/sfs
 void nfs_readlink (svccb *sbp) {
   if (const authunix_parms *aup = sbp->getaup ())
     setres (strbuf ("%d", int (aup->aup_uid)));
   else
     setres (NFSERR_ACCES);
   sendreply (sbp);
 }
Ejemplo n.º 2
0
void
afslink::nfs_readlink (svccb *sbp)
{
  if (resok)
    sendreply (sbp);
  else
    sbps.push_back (sbp);
}
/*===========================================================================*
 *		            sef_cb_signal_manager                            *
 *===========================================================================*/
static int sef_cb_signal_manager(endpoint_t target, int signo)
{
/* Process signal on behalf of the kernel. */
  int r;

  r = process_ksig(target, signo);
  sendreply();

  return r;
}
Ejemplo n.º 4
0
void
afslink::reply ()
{
  resok = true;
  if (!sbps.empty ()) {
    do {
      sendreply (sbps.pop_front ());
    } while (!sbps.empty ());
    sbps.clear ();
  }
}
/*===========================================================================*
 *				main					     *
 *===========================================================================*/
int main()
{
/* Main routine of the process manager. */
  int result;

  /* SEF local startup. */
  sef_local_startup();
  
  
// Initialization of the semarray (of pointers) to NULL
  
  register struct mproc *rmp;
  
// rmp is the pointer to the struct of the process table

    	 for (rmp = &mproc[0]; rmp < &mproc[NR_PROCS]; rmp++)
    	 
    	 {
    				 for(int i=0; i<12; i++) // for all 12 semaphores
    				  {
    					  rmp->semarray[i]=NULL;
    				  }
    				  
    	  }

  // end of Initialization
  

/* This is PM's main loop-  get work and do it, forever and forever. */
  
while (TRUE) {
	  int ipc_status;

	  /* Wait for the next message and extract useful information from it. */
	  if (sef_receive_status(ANY, &m_in, &ipc_status) != OK)
		  panic("PM sef_receive_status error");
	  who_e = m_in.m_source;	/* who sent the message */
	  if(pm_isokendpt(who_e, &who_p) != OK)
		  panic("PM got message from invalid endpoint: %d", who_e);
	  call_nr = m_in.m_type;	/* system call number */

	  /* Process slot of caller. Misuse PM's own process slot if the kernel is
	   * calling. This can happen in case of synchronous alarms (CLOCK) or or
	   * event like pending kernel signals (SYSTEM).
	   */
	  mp = &mproc[who_p < 0 ? PM_PROC_NR : who_p];
	  if(who_p >= 0 && mp->mp_endpoint != who_e) {
		  panic("PM endpoint number out of sync with source: %d",
				  			mp->mp_endpoint);
	  }

	/* Drop delayed calls from exiting processes. */
	if (mp->mp_flags & EXITING)
		continue;

	/* Check for system notifications first. Special cases. */
	if (is_ipc_notify(ipc_status)) {
		if (who_p == CLOCK) {
			expire_timers(m_in.NOTIFY_TIMESTAMP);
		}

		/* done, send reply and continue */
		sendreply();
		continue;
	}

	switch(call_nr)
	{
	case PM_SETUID_REPLY:
	case PM_SETGID_REPLY:
	case PM_SETSID_REPLY:
	case PM_EXEC_REPLY:
	case PM_EXIT_REPLY:
	case PM_CORE_REPLY:
	case PM_FORK_REPLY:
	case PM_SRV_FORK_REPLY:
	case PM_UNPAUSE_REPLY:
	case PM_REBOOT_REPLY:
	case PM_SETGROUPS_REPLY:
		if (who_e == VFS_PROC_NR)
		{
			handle_vfs_reply();
			result= SUSPEND;		/* don't reply */
		}
		else
			result= ENOSYS;
		break;
	case COMMON_GETSYSINFO:
		result = do_getsysinfo();
		break;
	default:
		/* Else, if the system call number is valid, perform the
		 * call.
		 */
		if ((unsigned) call_nr >= NCALLS) {
			result = ENOSYS;
		} else {
#if ENABLE_SYSCALL_STATS
			calls_stats[call_nr]++;
#endif

			result = (*call_vec[call_nr])();

		}
		break;
	}

	/* Send reply. */
	if (result != SUSPEND) setreply(who_p, result);
	sendreply();
  }
  return(OK);
}