Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ close(2) — AIX/RT 2.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

creat

dup

exec: execl, execv, execle, execve, execlp, execvp

fcntl

open

pipe

socket

close

Purpose

     Closes the file associated with a file descriptor.

Syntax

     int close (fildes)
     int fildes;

Description

     The close system call closes the file associated with the
     file  descriptor  fildes.   If  Distributed  Services  is
     installed on your system, this file can reside on another
     node.  The fildes parameter is a file descriptor obtained
     from a creat, open, dup, fcntl, or pipe system call.

     All file regions that  this process has previously locked
     with the  lockf system call are  unlocked.  This includes
     regions of  files other  than the  file specified  by the
     fildes parameter.

     If the fildes parameter is associated with a mapped file,
     and if  no other process  has attached this  mapped file,
     then it is unmapped.

Return Value

     Upon successful completion, a value of 0 is returned.  If
     the close  system call fails,  a value of -1  is returned
     and errno is set to indicate the error.

Diagnostics

     The close system call fails if the following is true:

     EBADF      The fildes parameter is  not a valid open file
                descriptor.

     If  Distributed Services  is  installed  on your  system,
     close can also  fail if one or more of  the following are
     true:

     EDIST         The   server   has  blocked   new   inbound
                   requests.

     EDIST         Outbound requests are currently blocked.

     EAGAIN        The  server  is  too  busy  to  accept  the
                   request.

     ENOMEM        Either  this node  or the  server does  not
                   have enough memory available to service the
                   request.

     EBADCONNECT   An attempt to use  an existing network con-
                   nection  with a  remote node  failed.  Data
                   may be lost.

                   This errno value occurs  only when the con-
                   nection  has been  lost and  there is  data
                   stored at the client that cannot be written
                   to  the server.   Otherwise, having  a lost
                   connection at close time  does not cause an
                   error.   (For  example,  in cases  where  a
                   read-only file is closed.)

Related Information

     In  this book:   "creat,"  "dup,"  "exec:  execl,  execv,
     execle,  execve,  execlp,   execvp,"   "fcntl,"   "open,"
     "pipe," and  "socket."

     Device Driver Development Guide.

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