The chroot service changes the root directory from the current one to a new one. The root directory is the starting point for path searches of pathnames beginning with a slash. The working directory of the process is unaffected by chroot().
Operation | Environment |
---|---|
Authorization: | Supervisor state or problem state, any PSW key |
Dispatchable unit mode: | Task |
Cross memory mode: | PASN = HASN |
AMODE (BPX1CRT): | 31-bit |
AMODE (BPX4CRT): | 64-bit |
ASC mode: | Primary mode |
Interrupt status: | Enabled for interrupts |
Locks: | Unlocked |
Control parameters: | All parameters must be addressable by the caller and in the primary address space. |
|
AMODE 64 callers use BPX4CRT with the same parameters.
The name of a fullword that contains the length of the pathname of the directory that is to become your root directory.
The name of a field that contains the pathname of the new directory. This field has the length that is specified in Pathname_length.
The name of a fullword in which the chroot service returns 0 if the request is successful, or -1 if it is not successful.
Return_code | Explanation |
---|---|
EACCES | The calling process does not have permission to search one of the components of Pathname. |
EINVAL | The Pathname parameter is not valid; it contains nulls. |
ELOOP | A loop exists in symbolic links that were encountered during resolution of the Pathname argument. This error is issued if more than 24 symbolic links are detected in the resolution of Pathname. |
ENAMETOOLONG | Pathname is longer than 1023 characters, or a component of Pathname is longer than 255 characters. Name truncation is not supported. |
ENOENT | No directory named Pathname was found, or no Pathname was specified. The following reason codes can accompany the return code: JRChdNoEnt and JRQuiescing. |
ENOTDIR | Some component of Pathname is not a directory. The following reason code can accompany the return code: JRChdNotDir. |
EPERM | The calling process is not a superuser. The following reason code can accompany the return code: JRUserNotPrivileged. |
The name of a fullword in which the chroot service stores the reason code. The chroot service returns a Reason_code only if Return_value is -1. Reason_code further qualifies the Return_code value. See z/OS UNIX System Services Messages and Codes for the reason codes.
To change the root directory, the caller must have appropriate privileges (see Authorization).
See BPX1CRT (chroot) example for an example using this callable service.