xref: /titanic_44/usr/src/lib/libast/common/man/preroot.3 (revision 1e49577a7fcde812700ded04431b49d67cc57d6d)
.fp 5 CW .. .nr ;G \\n(.f .Af "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9" \\*(;G .. .aF 5 \\n(.f "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" .. .aF 5 1 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" .. .aF 1 5 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" ..

0

..

..

PREROOT 3
NAME
preroot - preroot support
SYNOPSIS
.EX #include <preroot.h> char* getpreroot(char* path, char* cmd); int ispreroot(char* dir); int realopen(char* path, int mode, int perm); void setpreroot(char** argv, char* dir);
DESCRIPTION
The preroot routines manipulate the process preroot. preroot is a kernel supported per-process two level viewpath. All pathnames rooted at .L / are first searched for in the process preroot directory and then in the system root directory. Setting the process preroot is a priveleged operation controlled by the /etc/preroot (1) command.

.L <preroot.h> defines the symbol FS_PREROOT for those systems that support preroot. The following routines are valid only when FS_PREROOT is defined:

.L getpreroot returns a pointer to the absolute pathname of the preroot directory for the executable cmd . The result is placed in path . If path is 0 then malloc (3) is used to allocate the pathname space. 0 is returned if cmd has no preroot or if an error was encountered. In this case errno is set to indicate the error.

.L ispreroot Non-zero is returned if dir is the current process preroot. If dir is 0 then non-zero is returned if the current process has a preroot.

.L realopen temporarily disables the process preroot and does an open (3) relative to the system root directory. The return value from open is returned. If there is no preroot then realopen is equivalent to open .

.L setpreroot calls execvp (3) as .L "execvp(argv[0],argv)" with the process preroot set to dir . argv must be a 0 -terminated argument array. If argv is 0 then the value of opt_argv from optget (3) is used. .L setpreroot returns immediately if dir is already the process preroot.

"SEE ALSO"
/etc/preroot(1)
BUGS
Preroot semantics should be preserved when reading directories. The ast directory (3) routines do this. 3d (1) viewpathing does preroot the right way.