Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)
System Functions (a - d) chroot(2)
NAME
chroot - Changes the effective root directory
LIBRARY
G-series native Guardian processes: system library
G-series native OSS processes: system library
H-series and J-series native Guardian processes: implicit libraries
H-series and J-series OSS processes: implicit libraries
SYNOPSIS
#include <unistd.h>
int chroot(
const char *path);
PARAMETERS
path Specifies the new effective root directory. If the path parameter refers to a sym-
bolic link, the chroot() function sets the effective root directory to the directory
pointed to by the symbolic link.
The path parameter cannot specify /E, and the current working directory of the
calling process cannot be a directory in /E. If either condition is not met, the call
fails and errno is set to the value [EINVAL].
DESCRIPTION
The chroot() function causes the directory named by the path parameter to become the effective
root directory. The effective root directory is the starting point when searching for a file with an
absolute pathname.
The current working directory is not changed by a call to the chroot() function. However, if an
absolute pathname is specified in a subsequent call to the chdir( ) function, that pathname is
resolved using the effective root directory.
The calling process must have appropriate privileges in order to change the effective root direc-
tory. The calling process must also have search access to the new effective root directory.
The ..(dot-dot) entry in the effective root directory is interpreted to mean the effective root
directory itself. Thus, ..(dot-dot) cannot be used to access files outside the subtree rooted at the
effective root directory.
Use on Guardian Objects
The path parameter can specify /G or any volume or subvolume in /G.
Guardian process names are directories; however, they cannot be opened using chroot().
Attempts to do so fail and set errno to the value [EPERM].
A call to the chroot() function with a path parameter that points to a subprocess in the Guardian
file system fails when the process is not of subtype 30. Such a call sets errno to the value
[ENOENT].
A call to the chroot() function with a path parameter that points to an empty Guardian disk sub-
volume (for example, /G/vol/subvol) succeeds.
A call to the chroot() function with a path parameter that points to a Guardian subvolume with a
reserved name (for example, /G/vol1/zyq00001) fails. Such a call sets errno to the value
[EPERM].
527186-023 Hewlett-Packard Company 1−31