TEXT   298

close.txt

Guest on 1st August 2021 05:52:47 PM

  1.  
  2.  
  3. NAME
  4.        close - close a file descriptor
  5.  
  6.  
  7.  
  8. SYNOPSIS
  9.        #include <unistd.h>
  10.  
  11.        int close(int fd);
  12.  
  13.  
  14.  
  15. DESCRIPTION
  16.        close  closes  a  file  descriptor,  so  that it no longer
  17.        refers to any file and may be reused.
  18.  
  19.        If fd is the last copy of a particular file descriptor the
  20.        resources  associated  with  it are freed; for example any
  21.        locks held are removed and if the descriptor was the  last
  22.        reference  to  a  file which has been removed using unlink
  23.        the file is deleted.
  24.  
  25.  
  26.  
  27. RETURN VALUE
  28.        close returns zero on success, or -1 if an error occurred.
  29.  
  30.  
  31.  
  32. ERRORS
  33.        EBADF  fd isn't a valid open file descriptor.
  34.  
  35.  
  36.  
  37. CONFORMING TO
  38.        SVID, AT&T, POSIX, X/OPEN, BSD 4.3
  39.  
  40.  
  41.  
  42. NOTES
  43.        Not  checking  the  return  value of close is a common but
  44.        nevertheless  serious  programming  error.   File   system
  45.        implementations  which  use techniques as ``write-behind''
  46.        to increase performance may lead to  write(2)  succeeding,
  47.        although  the  data  has  not been written yet.  The error
  48.        status may be reported at a later write operation, but  it
  49.        is  guaranteed  to  be  reported on closing the file.  Not
  50.        checking the return value when closing the file  may  lead
  51.        to  silent  loss of data.  This can especially be observed
  52.        with NFS and disk quotas.
  53.  
  54.  
  55.  
  56. SEE ALSO
  57.        open(2), fcntl(2), shutdown(2), unlink(2), fclose(3).

Raw Paste


Login or Register to edit or fork this paste. It's free.