PREROOT(3)
okay so bestie, welcome to PREROOT(3) from the Library Functions Manual β the page about preroot support, and yes weβre gonna get into all of it π
πΈ NAME πΈ
preroot β preroot support, aka the whole per-process root situation. periodt.
β¨ SYNOPSIS β¨
#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 π¦
okay so the preroot routines manipulate the process preroot. and what is preroot? itβs a kernel supported per-process two level viewpath. literally all pathnames rooted at / are first searched for in the process preroot directory and then in the system root directory. setting the process preroot is a privileged operation controlled by the /etc/preroot(1) command. slay.
<preroot.h> defines the symbol FS_PREROOT for those systems that support preroot. the following routines are valid only when FS_PREROOT is defined:
getprerootβ returns a pointer to the absolute pathname of the preroot directory for the executablecmd. the result is placed inpath. ifpathis0, thenmalloc(3)is used to allocate the pathname space.0is returned ifcmdhas no preroot or if an error was encountered. in that case,errnois set to indicate the error. no cap.isprerootβ non-zero is returned ifdiris the current process preroot. ifdiris0, then non-zero is returned if the current process has a preroot. vibe check: zero means no, nonzero means yes.realopenβ temporarily disables the process preroot and does anopen(3)relative to the system root directory. the return value fromopenis returned. if there is no preroot, thenrealopenis equivalent toopen. iconic.setprerootβ callsexecvp(3)asexecvp(argv[0],argv)with the process preroot set todir.argvmust be a0-terminated argument array. ifargvis0, then the value ofopt_argvfromoptget(3)is used.setprerootreturns immediately ifdiris already the process preroot. sheβs efficient, okay?
π SEE ALSO π
/etc/preroot(1)
π BUGS π
preroot semantics should be preserved when reading directories. theastdirectory(3)routines do this.3d(1)viewpathing does preroot the right way.
okay bye bestie β this was the PREROOT(3) page from the Library Functions Manual, and thereβs no extra version/date footer text beyond that, so thatβs the whole thing. stay rooted π
β¨
π¦ where this page comes from
- opensuse-leap 16.0: ksh-devel 93vu-bp160.1.33 Β· CPL-1.0
- opensuse-leap 16.0: ksh-devel 93vu-bp160.1.33 Β· CPL-1.0
- opensuse-leap 16.0: ksh-devel 93vu-bp160.1.33 Β· CPL-1.0
- opensuse-leap 16.0: ksh-devel 93vu-bp160.1.33 Β· CPL-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms