FsOp object
Implemented in: src/fs-operations.c
FsOp is an object providing a POSIX-like filename-based interface to a filesystem. It provides methods corresponding to the POSIX calls such as open(), unlink(), etc. It deals with resolving pathnames (including following symlinks). The FsOp object is called by PlashGlibc, whose functions simply wrap FsOp's methods.
An FsOp object is created with an FsObj directory object which is used as a root directory, for the purposes of resolving filenames beginning with "/". FsOp also keeps track of the current working directory (cwd). Typically there will be one FsOp object per sandboxed process. When a sandboxed process fork()s, it will copy its FsOp object (using the fsop_copy method) so that the child process can change its cwd independently.
An FsOp object may have an "undefined" current working directory. In this case, using a pathname relative to the cwd will return an EACCES error. (Note that Unix does not normally allow a process to have an undefined current working directory.)
An FsOp object does not need to be located outside a sandbox. It could be compiled into PlashGlibc, but for efficiency reasons it is located in the ServerProcess in order to reduce the number of RPCs involved in a pathname lookup. Pathname lookup involves lots of calls through the FsObj interface.
When combined, PlashGlibc and FsOp act as an adaptor which converts the FsObj interface to a POSIX interface. FsObjReal performs the opposite conversion.
See also: PathnameResolver, DirStacks, FsOpMaker
Methods
- fsop_copy
- fsop_get_dir
- fsop_get_root_dir
- fsop_get_obj
- fsop_log
These methods correspond to POSIX calls:
- fsop_open
- fsop_stat
- fsop_readlink
- fsop_chdir
- fsop_fchdir
- fsop_dir_fstat
- fsop_getcwd
- fsop_dirlist
- fsop_access
- fsop_mkdir
- fsop_chmod
- fsop_chown
- fsop_utime
- fsop_rename
- fsop_link
- fsop_symlink
- fsop_unlink
- fsop_rmdir
- fsop_connect
- fsop_bind
- fsop_exec
