Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)
chroot(2) OSS System Calls Reference Manual
Use From the Guardian Environment
The chroot() function is one of a set of functions that have the following effects when the first of
them is called from the Guardian environment:
• Two Guardian file-system file numbers (not necessarily the next two available) are allo-
cated for the root directory and the current working directory. These file numbers cannot
be closed by calling the Guardian FILE_CLOSE_ procedure.
• The current working directory is assigned from the VOLUME attribute of the Guardian
environment =_DEFAULTS DEFINE.
• The use of static memory by the process increases slightly.
These effects occur only when the first of the set of functions is called. The effects are not cumu-
lative.
NOTES
Use of this function can make an application difficult to port to another system.
If the effective root directory is not / (the local node root directory), all files in /E become una-
vailable to the program when the call is completed.
On systems running H06.24 or later H-series RVUs or J06.13 or later J-series RVUs, you can use
this function with 32-bit or 64-bit OSS applications.
RETURN VALUES
Upon successful completion, the value 0 (zero) is returned. Otherwise, the value -1 is returned
and errno is set to indicate the error.
ERRORS
If any of the following conditions occurs, the effective root directory remains unchanged and the
chroot() function sets errno to the corresponding value:
[EACCES] Search permission is denied for any component of the pathname.
[EFAULT] The path parameter points outside the process’s allocated address space.
[EFSBAD] The fileset catalog for one of the filesets involved in the operation is corrupt.
[EINVAL] One of the following conditions exists:
• The path parameter specifies a Guardian process in /G.
• The path parameter specifies a file in /E.
• The current working directory of the calling process is in /E.
[ELOOP] More than MAXSYMLINKS symbolic links were encountered while resolving
path.
[ENAMETOOLONG]
One of the following is too long:
• The pathname pointed to by the path parameter
• A component of the pathname pointed to by the path parameter
• The intermediate result of pathname resolution when a symbolic link is
part of the path parameter
The pathconf( ) function can be called to obtain the applicable limits.
1−32 Hewlett-Packard Company 527186-023