Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ close(2) — Atari System V ue12

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

creat(2)

dup(2)

exec(2)

fcntl(2)

intro(2)

open(2)

pipe(2)

signal(2)

signal(5)

streamio(7)

fattach(3C)

fdetach(3C)





   close(2)                                                           close(2)


   NAME
         close - close a file descriptor

   SYNOPSIS
         #include <unistd.h>
         int close(int fildes);

   DESCRIPTION
         fildes is a file descriptor obtained from a creat, open, dup, fcntl,
         or pipe system call.  close closes the file descriptor indicated by
         fildes.  All outstanding record locks owned by the process (on the
         file indicated by fildes) are removed.

         When all file descriptors associated with the open file description
         have been closed, the open file description is freed.

         If the link count of the file is zero, when all file descriptors
         associated with the file have been closed, the space occupied by the
         file is freed and the file is no longer accessible.

         If a STREAMS-based [see intro(2)] fildes is closed, and the calling
         process had previously registered to receive a SIGPOLL signal [see
         signal(2)] for events associated with that stream [see ISETSIG in
         streamio(7)], the calling process will be unregistered for events
         associated with the stream.  The last close for a stream causes the
         stream associated with fildes to be dismantled.  If ONDELAY and
         ONONBLOCK are clear and there have been no signals posted for the
         stream, and if there are data on the module's write queue, close
         waits up to 15 seconds (for each module and driver) for any output to
         drain before dismantling the stream.  The time delay can be changed
         via an ISETCLTIME ioctl request [see streamio(7)].  If ONDELAY or
         ONONBLOCK is set, or if there are any pending signals, close does
         not wait for output to drain, and dismantles the stream immediately.

         If fildes is associated with one end of a pipe, the last close causes
         a hangup to occur on the other end of the pipe.  In addition, if the
         other end of the pipe has been named [see fattach(3C)], the last
         close forces the named end to be detached [see fdetach(3C)].  If the
         named end has no open processes associated with it and becomes
         detached, the stream associated with that end is also dismantled.

         The named file is closed unless one or more of the following are
         true:

         EBADF          fildes is not a valid open file descriptor.

         EINTR          A signal was caught during the close system call.

         ENOLINK        fildes is on a remote machine and the link to that
                        machine is no longer active.



   7/91                                                                 Page 1









   close(2)                                                           close(2)


   SEE ALSO
         creat(2), dup(2), exec(2), fcntl(2), intro(2), open(2), pipe(2),
         signal(2), signal(5), streamio(7).
         fattach(3C), fdetach(3C) in the Programmer's Guide: Networking
         Interfaces.

   DIAGNOSTICS
         Upon successful completion, a value of 0 is returned.  Otherwise, a
         value of -1 is returned and errno is set to indicate the error.












































   Page 2                                                                 7/91





Typewritten Software • bear@typewritten.org • Edmonds, WA 98026