preroot.3 revision da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.ds ;G \\*(;G\\f\\$1\\$3\\f\\$2
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.if !\\$4 .Af \\$2 \\$1 "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.ie \\$3 .ft \\$1
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.nr ;G \\n(.f
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.Af "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.ft \\n(;G \}
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.aF 5 \\n(.f "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.aF 5 1 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.aF 1 5 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.de EX \" start example
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.ta 1i 2i 3i 4i 5i 6i
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.de EE \" end example
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.TH PREROOT 3
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinpreroot \- preroot support
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.SH SYNOPSIS
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinchar* getpreroot(char* \fIpath\fP, char* \fIcmd\fP);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinint ispreroot(char* \fIdir\fP);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinint realopen(char* \fIpath\fP, int \fImode\fP, int \fIperm\fP);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinvoid setpreroot(char** \fIargv\fP, char* \fIdir\fP);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.SH DESCRIPTION
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinroutines manipulate the process preroot.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinis a kernel supported per-process two level viewpath.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinAll pathnames rooted at
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinare first searched for in the process preroot directory
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinand then in the system root directory.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinSetting the process preroot is a priveleged operation controlled by the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chindefines the symbol
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.B FS_PREROOT
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinfor those systems that support preroot.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinThe following routines are valid only when
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.B FS_PREROOT
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinis defined:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.L getpreroot
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinreturns a pointer to the absolute pathname of the preroot directory
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinfor the executable
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinThe result is placed in
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.IR malloc (3)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinis used to allocate the pathname space.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinis returned if
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinhas no preroot or if an error was encountered.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinIn this case
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinis set to indicate the error.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.L ispreroot
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinNon-zero is returned if
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinis the current process preroot.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinthen non-zero is returned if the current process has a preroot.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.L realopen
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chintemporarily disables the process preroot and does an
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.IR open (3)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinrelative to the system root directory.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinThe return value from
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinis returned.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinIf there is no preroot then
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.I realopen
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinis equivalent to
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.L setpreroot
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.IR execvp (3)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.L "execvp(a\fIrgv\fP[0],\fIargv\fP)"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinwith the process preroot set to
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.BR 0 -terminated
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinargument array.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinthen the value of
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.I opt_argv
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.IR optget (3)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.L setpreroot
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinreturns immediately if
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinis already the process preroot.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.SH "SEE ALSO"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinPreroot semantics should be preserved when reading directories.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin.IR directory (3)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinroutines do this.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinviewpathing does
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinthe right way.