Back to index

glibc  2.9
Classes | Defines | Functions
port.h File Reference
#include <features.h>
#include <mach.h>
#include <hurd/userlink.h>
#include <spin-lock.h>
#include <hurd/signal.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  hurd_port

Defines

#define HURD_PORT_USE(portcell, expr)
#define _HURD_PORT_H_EXTERN_INLINE   __extern_inline

Functions

_HURD_PORT_H_EXTERN_INLINE void _hurd_port_init (struct hurd_port *port, mach_port_t init)
void _hurd_port_cleanup (void *, jmp_buf, int)
_HURD_PORT_H_EXTERN_INLINE
mach_port_t 
_hurd_port_locked_get (struct hurd_port *port, struct hurd_userlink *link)
_HURD_PORT_H_EXTERN_INLINE
mach_port_t 
_hurd_port_get (struct hurd_port *port, struct hurd_userlink *link)
_HURD_PORT_H_EXTERN_INLINE void _hurd_port_free (struct hurd_port *port, struct hurd_userlink *link, mach_port_t used_port)
_HURD_PORT_H_EXTERN_INLINE void _hurd_port_locked_set (struct hurd_port *port, mach_port_t newport)
_HURD_PORT_H_EXTERN_INLINE void _hurd_port_set (struct hurd_port *port, mach_port_t newport)

Class Documentation

struct hurd_port

Definition at line 39 of file port.h.

Collaboration diagram for hurd_port:
Class Members
spin_lock_t lock
mach_port_t port
struct hurd_userlink * users

Define Documentation

Definition at line 59 of file port.h.

#define HURD_PORT_USE (   portcell,
  expr 
)
Value:
({ struct hurd_port *const __p = (portcell);                                \
     struct hurd_userlink __link;                                    \
     const mach_port_t port = _hurd_port_get (__p, &__link);                \
     __typeof(expr) __result = (expr);                                      \
     _hurd_port_free (__p, &__link, port);                                  \
     __result; })

Definition at line 49 of file port.h.


Function Documentation

void _hurd_port_cleanup ( void *  ,
jmp_buf  ,
int   
)

Definition at line 28 of file port-cleanup.c.

{
  __mach_port_deallocate (__mach_task_self (), (mach_port_t) cleanup_data);
}

Here is the call graph for this function:

Here is the caller graph for this function:

_HURD_PORT_H_EXTERN_INLINE void _hurd_port_free ( struct hurd_port port,
struct hurd_userlink link,
mach_port_t  used_port 
)

Definition at line 114 of file port.h.

{
  int dealloc;
  if (used_port == MACH_PORT_NULL)
    /* When we fetch an empty port cell with _hurd_port_get,
       it does not link us on the users chain, since there is
       no shared resource.  */
    return;
  HURD_CRITICAL_BEGIN;
  __spin_lock (&port->lock);
  dealloc = _hurd_userlink_unlink (link);
  __spin_unlock (&port->lock);
  HURD_CRITICAL_END;
  if (dealloc)
    __mach_port_deallocate (__mach_task_self (), used_port);
}

Here is the call graph for this function:

Here is the caller graph for this function:

_HURD_PORT_H_EXTERN_INLINE mach_port_t _hurd_port_get ( struct hurd_port port,
struct hurd_userlink link 
)

Definition at line 99 of file port.h.

{
  mach_port_t result;
  HURD_CRITICAL_BEGIN;
  __spin_lock (&port->lock);
  result = _hurd_port_locked_get (port, link);
  HURD_CRITICAL_END;
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

_HURD_PORT_H_EXTERN_INLINE void _hurd_port_init ( struct hurd_port port,
mach_port_t  init 
)

Definition at line 66 of file port.h.

{
  __spin_lock_init (&port->lock);
  port->users = NULL;
  port->port = init;
}

Here is the call graph for this function:

Here is the caller graph for this function:

_HURD_PORT_H_EXTERN_INLINE mach_port_t _hurd_port_locked_get ( struct hurd_port port,
struct hurd_userlink link 
)

Definition at line 81 of file port.h.

{
  mach_port_t result;
  result = port->port;
  if (result != MACH_PORT_NULL)
    {
      link->cleanup = &_hurd_port_cleanup;
      link->cleanup_data = (void *) result;
      _hurd_userlink_link (&port->users, link);
    }
  __spin_unlock (&port->lock);
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

_HURD_PORT_H_EXTERN_INLINE void _hurd_port_locked_set ( struct hurd_port port,
mach_port_t  newport 
)

Definition at line 138 of file port.h.

{
  mach_port_t old;
  old = _hurd_userlink_clear (&port->users) ? port->port : MACH_PORT_NULL;
  port->port = newport;
  __spin_unlock (&port->lock);
  if (old != MACH_PORT_NULL)
    __mach_port_deallocate (__mach_task_self (), old);
}

Here is the call graph for this function:

Here is the caller graph for this function:

_HURD_PORT_H_EXTERN_INLINE void _hurd_port_set ( struct hurd_port port,
mach_port_t  newport 
)

Definition at line 151 of file port.h.

Here is the call graph for this function:

Here is the caller graph for this function: