Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

dup(2)

exec(2)

fcntl(2)

open(2)

creat(2)

intro(2)

pipe(2)

signal(2)

sigset(2)

sigaction(2)

socket(2)

streamio(7)



  close(2)                            CLIX                            close(2)



  NAME

    close - Closes the file associated with a file descriptor

  SYNOPSIS

    int close(
      int filedes );

  LIBRARY

    Standard C Library (libc.a)

  PARAMETERS

    filedes   Specifies a valid open file descriptor obtained from the
              creat(), open(), dup(), fcntl(), or pipe() functions.

  DESCRIPTION

    The close() function closes the file associated with the filedes
    parameter.

    All outstanding record locks owned by the process on the file indicated by
    filedes are removed.

    If a STREAMS (see the intro() function) file is closed, and the calling
    process had previously registered to receive a SIGPOLL signal for events
    associated with that file (see I_SETSIG in the streamio special file), the
    calling process will be unregistered for events associated with the file.
    The last close() function for a stream causes the stream associated with
    filedes to be dismantled.  If O_NDELAY and O_NONBLOCK are not set and
    there have been no signals posted for the stream, close() waits up to 15
    seconds, for each module and driver, for any output to drain before
    dismantling the stream.  If the O_NDELAY or O_NONBLOCK flag is set or if
    there are any pending signals, close() does not wait for output to drain,
    and dismantles the stream immediately.

  EXAMPLES

    To close a file descriptor from a previously opened file:

    close(fd);


  RETURN VALUES

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




  2/94 - Intergraph Corporation                                              1






  close(2)                            CLIX                            close(2)



  ERRORS

    The close() function fails if one or more of the following is true:

    [EBADF]     The filedes parameter is not a valid open file descriptor.

    [EINTR]     A signal was caught during the close() function.

    [ENOLINK]   The filedes parameter is on a remote machine and the link to
                that machine is no longer active.

  RELATED INFORMATION

    Functions:  dup(2), exec(2), fcntl(2), open(2), creat(2), intro(2),
    pipe(2), signal(2), sigset(2), sigaction(2), socket(2)

    Files:  streamio(7)





































  2                                              Intergraph Corporation - 2/94




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