Close (system call)

Close (system call)

For most file systems, a program terminates access to a file in a filesystem using the close system call. This flushes buffers, updates file metadata (which may include and end of file indicator in the data), de-allocates resources associated with the file (including the file descriptor) and updates the system wide table of files in use. Some languages maintain a structure of files opened by its run-time library and may close when the program terminates. Some operating systems will invoke the close if the program terminates. Some operating systems will invoke the close as part of an operating system recovery as a result of a system failure.

C library POSIX definition

The close call is standardized by the POSIX specification

int close (int filedes);
int fclose(FILE *stream);


The function returns zero to indicate the file was closed successfully. If any error occurs, a value of -1 is returned and errno is appropriately set.

The errors that can occur include:

EBADF The argument supplied was not a valid file descriptor
EINTR The function call was interrupted by a signal
EIO An I/O error occurred

Reference

POSIX close


Wikimedia Foundation. 2010.

Игры ⚽ Нужно сделать НИР?

Look at other dictionaries:

  • System call — In computing, a system call is the mechanism used by an application program to request service from the kernel. Background A system call is a request made by any arbitrary program to the kernel for performing tasks picked from a predefined set… …   Wikipedia

  • System Call — Ein Systemaufruf, auch Systemcall (von engl. system call) oder kurz Syscall, ist in der Computertechnik eine von Anwendungsprogrammen benutzte Methode, um vom Betriebssystem bereitgestellte Funktionalitäten auszuführen. Inhaltsverzeichnis 1… …   Deutsch Wikipedia

  • Open (system call) — For most file systems, a program initializes access to a file in a filesystem using the open system call. This allocates resources associated to the file (the file descriptor), and returns a handle that the process will use to refer to that file …   Wikipedia

  • Splice (system call) — splice() is a system call that copies data between a file handle and a pipe, or between a pipe and user space. It does so without actually copying the data, in contrast to other data copying techniques, thereby improving I/O performance.Workings… …   Wikipedia

  • call — /kɔl / (say kawl) verb (t) 1. to cry out in a loud voice. 2. (of a bird or other animal) to utter (its characteristic cry). 3. to announce; proclaim: to call a halt. 4. to read over (a roll or list) in a loud voice. 5. to attract the attention of …  

  • Call of Duty: World at War — North American cover Developer(s) Treyarch Certain Affinity (some multiplayer maps a …   Wikipedia

  • Call signs in North America — are frequently still used by North American broadcast stations in addition to amateur radio and other international radio stations that continue to identify by call signs around the world. Each country has a different set of patterns for its own… …   Wikipedia

  • Call of Duty: Modern Warfare 3 — Call of Duty Modern Warfare 3 Обложка игры Разработчик Infini …   Википедия

  • Call of Duty: Modern Warfare 2 — MW2 redirects here. For the MechWarrior game, see MechWarrior 2: 31st Century Combat. Call of Duty: Modern Warfare 2 …   Wikipedia

  • Call centre — A very large collections call centre in Lakeland, Florida. A call centre or call center is a centralised office used for the purpose of receiving and transmitting a large volume of requests by telephone. A call centre is operated by a company to… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”