©2004 by Marc J. Rochkind. All rights reserved. Portions marked "Open Source" may be copied under
license.
Main Page Modules Namespace List Class Hierarchy Compound List File List Namespace Members Compound Members File Members
C++ Wrapper for Standard UNIX Functions
Detailed Description
- Goals
-
100% uniform error handling for all functions.
-
100% functionality for included functions.
-
Organization into UNIX objects.
-
Elimination of redundant, obsolete, or defective functions (readdir, signal, mktemp) where there is an alternative.
-
As close to native-C-interface speed as possible.
- Design Rules
-
At the level of Standard UNIX Specification v3 -- no higher, and with identical semantics (other than error handling). That is, not like iostream or Boost threads. However, additional functions (e.g., setblock, find_and_open_master) not in the standard can be included.
-
100% implementation of 290 or so interfaces out of the 1108 that are in the SUS. The 290 were selected for a book I'm working on. (Excluded are Standard C functions, pthreads, user-level functions such as bsearch and accounting, spawn stuff, trace stuff, obsolete functions, and a few others. (Details available.)
-
All errors are thrown, never returned. Thrown object is a type that includes errno and other error codes (e.g., from getaddrinfo) that are not errno-type errors.
-
No memory is dynamically allocated unless the word "alloc" appears in the member-function name, and there are very few instances of that.
-
Space and time efficiency should be very close to native C SUS, except for the member-function-call overhead.
-
Objects reflect organization of UNIX and SUS objects (e.g., File, Dir, DirStream, Process).
-
Where a reentrant and non-reentrant functions are defined (e.g., readdir and readdir_r), usually the re-entrant version is used and the buffer is in the object. If necessary, an "alloc" member function is provided to allocate storage for it (see #4, above).
-
No additional error checking over what the SUS function provides. For example, if a NULL pointer is passed to File::open, it is passed directly to the underlying open. This is because of #5, above.
-
Automatically chooses, for example, fchown over chown if object is open. Single member function File::chown for both.
-
Automatically detects whether an error occurred in some cases. For example, for pathconf, a -1 return is an error only if errno changed.
-
Some functions coalesced with use of optional arguments. For example, read/pread, write/pwrite, fsync/fdatasync.
-
No copy constructors or assignment operators other than default. Follows from #4, in part.
Generated on Fri Apr 23 10:57:16 2004 for AUP2 Example Source by
1.3.1