Next: fakefs Data Operations
Up: Data Operations
Previous: Data Operations
  Contents
Note: POSIX data operations are defined in terms of fakefs data
operations, and many are actually implemented by the host OS. They are
listed here only because they are explicitly intended to work as
described.
- open, when used with O_CREAT to create a new file,
inserts an Inode containing a file of zero length into the fakefs
filesystem, then behaves like open when used on an existing file.
- open, when used on an existing file, returns a real file
descriptor to a real inode stored on the host file system; however,
all of the fakefs functions such as stat() return information
about the virtual inode in the fakefs filesystem, not the physical
inode. When LD_PRELOAD (see chapter 14) is used, the libc
stat function is replaced with the corresponding fakefs
function.
- read, write, readv, writev,
pread, pwrite, mmap, lseek, fcntl,
flock, and ftruncate all behave in fakefs as they do in a
real Unix filesystem. fakefs does not provide these functions--since
they all work on file descriptors, and fakefs open() returns
a file descriptor, these functions do not need to be modified to work
with fakefs.
- dup, dup2, and fcntl with the F_DUPFD
flag have to be handled through fakefs when LD_PRELOAD is in use,
in order to be able to keep track of which file descriptors correspond to
files in fakefs and which do not.
- close causes the cached physical copy of a file (which may
have been modified by the fakefs user) to be reinserted into fakefs.
Note that this reinsertion may be deferred for performance reasons.
File descriptor sharing works as much as possible in fakefs as it
does in POSIX, even though this may be severely painful to implement.
Next: fakefs Data Operations
Up: Data Operations
Previous: Data Operations
  Contents
Zygo Blaxell
2003-03-04