close

OS/161 Reference Manual

Name

close - close file

Library

Standard C Library (libc, -lc)

Synopsis

#include <unistd.h>

int
close(int fd);

Description

The file handle fd is closed. The same file handle may then be returned again from open, dup2, pipe, or similar calls.

Other file handles are not affected in any way, even if they are attached to the same file.

Return Values

On success, close returns 0. On error, -1 is returned, and errno is set according to the error encountered.

Errors

The following error codes should be returned under the conditions given. Other error codes may be returned for other errors not mentioned here.
  
EBADF fd is not a valid file handle.
EIO A hard I/O error occurred.