PIVOT_ROOT(2) | Linux Programmer's Manual | PIVOT_ROOT(2) |
NAME
pivot_root - change the root file systemSYNOPSIS
int pivot_root(const char * new_root , const char * put_old );DESCRIPTION
pivot_root() moves the root file system of the calling process to the directory put_old and makes new_root the new root file system of the calling process.- -
- They must be directories.
- -
- new_root and put_old must not be on the same file system as the current root.
- -
- put_old must be underneath new_root, that is, adding a nonzero number of /.. to the string pointed to by put_old must yield the same directory as new_root.
- -
- No other file system may be mounted on put_old.
See also pivot_root(8) for additional usage examples.
If the current root is not a mount point (e.g., after chroot(2) or pivot_root(), see also below), not the old root directory, but the mount point of that file system is mounted on put_old.
new_root does not have to be a mount point. In this case, /proc/mounts will show the mount point of the file system containing new_root as root ( /).
RETURN VALUE
On success, zero is returned. On error, -1 is returned, and errno is set appropriately.ERRORS
pivot_root() may return (in errno) any of the errors returned by stat(2). Additionally, it may return:- EBUSY
- new_root or put_old are on the current root file system, or a file system is already mounted on put_old.
- EINVAL
- put_old is not underneath new_root.
- ENOTDIR
- new_root or put_old is not a directory.
- EPERM
- The calling process does not have the CAP_SYS_ADMIN capability.
VERSIONS
pivot_root() was introduced in Linux 2.3.41.CONFORMING TO
pivot_root() is Linux-specific and hence is not portable.NOTES
Glibc does not provide a wrapper for this system call; call it using syscall(2).BUGS
pivot_root() should not have to change root and current working directory of all other processes in the system.SEE ALSO
chdir(2), chroot(2), stat(2), initrd(4), pivot_root(8)COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/.2012-07-13 | Linux |