Back to index

glibc  2.9
port2fd.c File Reference
#include <hurd.h>
#include <hurd/fd.h>
#include <hurd/signal.h>
#include <hurd/term.h>
#include <fcntl.h>

Go to the source code of this file.


void _hurd_port2fd (struct hurd_fd *d, io_t dport, int flags)

Function Documentation

void _hurd_port2fd ( struct hurd_fd d,
io_t  dport,
int  flags 

Definition at line 30 of file port2fd.c.

  mach_port_t cttyid;
  io_t ctty = MACH_PORT_NULL;

  if (!(flags & O_IGNORE_CTTY))
               if (port != MACH_PORT_NULL && /* Do we have a ctty? */
                   ! __term_getctty (dport, &cttyid))   /* Could this be it? */
                   __mach_port_deallocate (__mach_task_self (), cttyid);
                   /* This port is capable of being a controlling tty.
                     Is it ours?  */
                   if (cttyid == port)
                     __term_open_ctty (dport, _hurd_pid, _hurd_pgrp, &ctty);
                   /* XXX if this port is our ctty, but we are not doing
                     ctty style i/o because term_become_ctty barfed,
                     what to do?  */

  /* Install PORT in the descriptor cell, leaving it locked.  */
    mach_port_t old
      = _hurd_userlink_clear (&d->port.users) ? d->port.port : MACH_PORT_NULL;
    d->port.port = dport;
    d->flags = (flags & O_CLOEXEC) ? FD_CLOEXEC : 0;
    if (old != MACH_PORT_NULL)
      __mach_port_deallocate (__mach_task_self (), old);

  _hurd_port_set (&d->ctty, ctty);

Here is the call graph for this function:

Here is the caller graph for this function: