Coding Guidelines/Filesystem Manipulation: Difference between revisions
m (Coding Guidelines/File Descriptor Manipulation moved to Coding Guidelines/Filesystem Manipulation: more general name) |
(we use gnulib functions now) |
||
(One intermediate revision by the same user not shown) | |||
Line 9: | Line 9: | ||
This function wraps ''close'' to retry on certain failures. | This function wraps ''close'' to retry on certain failures. | ||
= | = full_read = | ||
: in | : in gnulib/full-read.c | ||
This function calls ''read'' repeatedly until the given buffer is full, or an EOF or an error occurs. It handles interrupted syscalls appropriately. | This function calls ''read'' repeatedly until the given buffer is full, or an EOF or an error occurs. It handles interrupted syscalls appropriately. | ||
= | = full_write = | ||
: in | : in gnulib/full-read.c | ||
Similarly, this function calls ''write'' repeatedly, until the entire buffer has been writte, or an error occurs. | Similarly, this function calls ''write'' repeatedly, until the entire buffer has been writte, or an error occurs. | ||
Line 20: | Line 20: | ||
: in common-src/util.c | : in common-src/util.c | ||
This function wraps the various readdir implementations that might be available, including re-entrant and 64-bit versions, preferring 64-bit compatibility and re-entrancy. | This function wraps the various readdir implementations that might be available, including re-entrant and 64-bit versions, preferring 64-bit compatibility and re-entrancy. | ||
= safe_getcwd = | |||
: in common-src/getcwd.c | |||
This file provides an implementation of the getcwd procedure that uses getwd, for systems with getwd but without getcwd. It adds re-entrancy as well, by avoiding the use of static buffers. |
Latest revision as of 14:12, 15 August 2008
Amanda supplies a few wrapper functions around the ordinary descriptor operations to handle a few common cases. In most cases, these functions are preferred over calling the wrapped function directly.
robust_open
- in common-src/file.c
This function wraps open to retry on certain failures, and sets the close-on-exec flag.
robust_close
- in common-src/file.c
This function wraps close to retry on certain failures.
full_read
- in gnulib/full-read.c
This function calls read repeatedly until the given buffer is full, or an EOF or an error occurs. It handles interrupted syscalls appropriately.
full_write
- in gnulib/full-read.c
Similarly, this function calls write repeatedly, until the entire buffer has been writte, or an error occurs.
portable_readdir
- in common-src/util.c
This function wraps the various readdir implementations that might be available, including re-entrant and 64-bit versions, preferring 64-bit compatibility and re-entrancy.
safe_getcwd
- in common-src/getcwd.c
This file provides an implementation of the getcwd procedure that uses getwd, for systems with getwd but without getcwd. It adds re-entrancy as well, by avoiding the use of static buffers.