Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > C

close(2)

HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

close — close a file descriptor

SYNOPSIS

#include <unistd.h>

int close(int fildes);

DESCRIPTION

close() closes the file descriptor indicated by fildes. fildes is a file descriptor obtained from a creat(), open(), dup(), fcntl(), or pipe() system call. All associated file segments which have been locked by this process with the lockf() function are released (i.e., unlocked).

RETURN VALUE

Upon successful completion, close() returns a value of 0; otherwise, it returns -1 and sets errno to indicate the error.

ERRORS

close() fails if the any of following conditions are encountered:

[EBADF]

fildes is not a valid open file descriptor.

[EINTR]

An attempt to close a slow device or connection or file with pending aio requests was interrupted by a signal. The file descriptor still points to an open device or connection or file.

[ENOSPC]

Not enough space on the file system. This error can occur when closing a file on an NFS file system. [When a write() system call is executed on a local file system and if a new buffer needs to be allocated to hold the data, the buffer is mapped onto the disk at that time. A full disk is detected at this time and write() returns an error. When the write() system call is executed on an NFS file system, the new buffer is allocated without communicating with the NFS server to see if there is space for the buffer (to improve NFS performance). It is only when the buffer is written to the server (at file close or the buffer is full) that the disk-full condition is detected.]

STANDARDS CONFORMANCE

close(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.