Coding Guidelines/Filesystem Manipulation

From wiki.zmanda.com
Revision as of 19:32, 22 May 2007 by Dustin (talk | contribs) (probably not a complete list, but a good start)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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.

robust_close

in common-src/file.c

This function wraps close to retry on certain failures.

safe_fd

in common-src/file.c

This function closes all descriptors execpt stdin, stdout, and stderr, and makes sure those three are open. Use this function when spawning a new process to ensure it isn't exec'd with any stray descriptors open.