*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->HP-UX 11i man pages -> close (2)              
Title
Content
Arch
Section
 

Contents


 close(2)                                                           close(2)




 NAME    [Toc]    [Back]
      close - close a file descriptor

 SYNOPSIS    [Toc]    [Back]
      #include <unistd.h>

      int close(int fildes);

 DESCRIPTION    [Toc]    [Back]
      close() closes the file descriptor indicated by fildes.  fildes is a
      file descriptor obtained from a creat(), open(), dup(), fcntl(), or
      pipe() system call.  All associated file segments which have been
      locked by this process with the lockf() function are released (i.e.,
      unlocked).

 RETURN VALUE    [Toc]    [Back]
      Upon successful completion, close() returns a value of 0; otherwise,
      it returns -1 and sets errno to indicate the error.

 ERRORS    [Toc]    [Back]
      close() fails if the any of following conditions are encountered:

           [EBADF]        fildes is not a valid open file descriptor.

           [EINTR]        An attempt to close a slow device or connection or
                          file with pending aio requests was interrupted by
                          a signal. The file descriptor still points to an
                          open device or connection or file.

           [ENOSPC]       Not enough space on the file system.  This error
                          can occur when closing a file on an NFS file
                          system.  [When a write() system call is executed
                          on a local file system and if a new buffer needs
                          to be allocated to hold the data, the buffer is
                          mapped onto the disk at that time.  A full disk is
                          detected at this time and write() returns an
                          error.  When the write() system call is executed
                          on an NFS file system, the new buffer is allocated
                          without communicating with the NFS server to see
                          if there is space for the buffer (to improve NFS
                          performance).  It is only when the buffer is
                          written to the server (at file close or the buffer
                          is full) that the disk-full condition is
                          detected.]

 SEE ALSO    [Toc]    [Back]
      creat(2), dup(2), exec(2), fcntl(2), lockf(2), open(2), pipe(2),
      thread_safety(5).

 STANDARDS CONFORMANCE    [Toc]    [Back]
      close(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1


 Hewlett-Packard Company            - 1 -   HP-UX 11i Version 2: August 2003
[ Back ]
      
      
 Similar pages
Name OS Title
close Tru64 Close the file associated with a file descriptor
cr_close HP-UX close a crash dump descriptor
mq_close HP-UX close a message queue descriptor
mq_close IRIX close a message queue descriptor
pxfisatty IRIX Determines if file descriptor corresponds to a valid file descriptor
AFclosefile IRIX close an audio file, update file header if file was opened for write access.
fdetach Tru64 Detach a STREAMS-based file descriptor from a file in the file system name space
fattach Tru64 Attach a STREAMS-based file descriptor to a file in the file system name space
VOP_OPENCLOSE FreeBSD open or close a file
VOP_CLOSE FreeBSD open or close a file
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service