/* Shutdown pager P and prevent any future paging activity on it.  */
void
pager_shutdown (struct pager *p)
{
  /* Sync and flush pager */
  pager_sync (p, 1);
  pager_flush (p, 1);
  mutex_lock (&p->interlock);
  p->pager_state = SHUTDOWN;
  ports_destroy_right (p);
  mutex_unlock (&p->interlock);
}
示例#2
0
文件: ethernet.c 项目: GNUHurdTR/hurd
int
ethernet_close (struct device *dev)
{
  struct ether_device *edev = (struct ether_device *) dev->priv;

  mach_port_deallocate (mach_task_self (), edev->readptname);
  edev->readptname = MACH_PORT_NULL;
  ports_destroy_right (edev->readpt);
  edev->readpt = NULL;
  device_close (edev->ether_port);
  mach_port_deallocate (mach_task_self (), edev->ether_port);
  edev->ether_port = MACH_PORT_NULL;
}
示例#3
0
error_t
trivfs_goaway (struct trivfs_control *fsys, int flags)
{
  int count;

  /* Stop new requests.  */
  ports_inhibit_class_rpcs (trivfs_cntl_portclasses[0]);
  ports_inhibit_class_rpcs (trivfs_protid_portclasses[0]);

  /* Are there any extant user ports for the /servers/exec file?  */
  count = ports_count_class (trivfs_protid_portclasses[0]);
  if (count == 0 || (flags & FSYS_GOAWAY_FORCE))
    {
      /* No users.  Disconnect from the filesystem.  */
      mach_port_deallocate (mach_task_self (), fsys->underlying);

      /* Are there remaining exec_startup RPCs to answer?  */
      count = ports_count_class (execboot_portclass);
      if (count == 0)
	/* Nope.  We got no reason to live.  */
	exit (0);

      /* Continue servicing tasks starting up.  */
      ports_enable_class (execboot_portclass);

      /* No more communication with the parent filesystem.  */
      ports_destroy_right (fsys);

      return 0;
    }
  else
    {
      /* We won't go away, so start things going again...  */
      ports_enable_class (trivfs_protid_portclasses[0]);
      ports_resume_class_rpcs (trivfs_cntl_portclasses[0]);
      ports_resume_class_rpcs (trivfs_protid_portclasses[0]);

      return EBUSY;
    }
}
示例#4
0
/* Implement io_revoke as described in <hurd/io.defs>. */
kern_return_t
diskfs_S_io_revoke (struct protid *cred)
{
  error_t err;
  struct node *np;

  error_t
    iterator_function (void *port)
    {
      struct protid *user = port;

      if ((user != cred)
	  && (user->po->np == np))
	ports_destroy_right (user);
      return 0;
    }

  if (!cred)
    return EOPNOTSUPP;

  np = cred->po->np;

  mutex_lock (&np->lock);

  err = fshelp_isowner (&np->dn_stat, cred->user);

  mutex_unlock (&np->lock);

  if (err)
    return err;

  ports_inhibit_bucket_rpcs (diskfs_port_bucket);
  ports_class_iterate (diskfs_protid_class, iterator_function);
  ports_resume_bucket_rpcs (diskfs_port_bucket);

  return 0;
}