| 1 | #[cfg (feature = "fs" )] |
| 2 | #[cfg_attr (docsrs, doc(cfg(feature = "fs" )))] |
| 3 | use crate::{backend, io, path}; |
| 4 | |
| 5 | /// `pivot_root(new_root, put_old)`—Change the root mount. |
| 6 | /// |
| 7 | /// # References |
| 8 | /// - [Linux] |
| 9 | /// |
| 10 | /// [Linux]: https://man7.org/linux/man-pages/man2/pivot_root.2.html |
| 11 | #[cfg (feature = "fs" )] |
| 12 | #[cfg_attr (docsrs, doc(cfg(feature = "fs" )))] |
| 13 | #[inline ] |
| 14 | pub fn pivot_root<P: path::Arg, Q: path::Arg>(new_root: P, put_old: Q) -> io::Result<()> { |
| 15 | new_root.into_with_c_str(|new_root: &CStr| { |
| 16 | put_old.into_with_c_str(|put_old: &CStr| backend::process::syscalls::pivot_root(new_root, put_old)) |
| 17 | }) |
| 18 | } |
| 19 | |