Back to index

glibc  2.9
Functions
fd-close.c File Reference
#include <hurd/fd.h>

Go to the source code of this file.

Functions

error_t _hurd_fd_close (struct hurd_fd *fd)

Function Documentation

error_t _hurd_fd_close ( struct hurd_fd fd)

Definition at line 22 of file fd-close.c.

{
  error_t err;

  HURD_CRITICAL_BEGIN;

  __spin_lock (&fd->port.lock);
  if (fd->port.port == MACH_PORT_NULL)
    {
      __spin_unlock (&fd->port.lock);
      err = EBADF;
    }
  else
    {
      /* Clear the descriptor's port cells.
        This deallocates the ports if noone else is still using them.  */
      _hurd_port_set (&fd->ctty, MACH_PORT_NULL);
      _hurd_port_locked_set (&fd->port, MACH_PORT_NULL);
      err = 0;
    }

  HURD_CRITICAL_END;

  return err;
}

Here is the call graph for this function:

Here is the caller graph for this function: