Lines Matching refs:path
38 use std::path::PathBuf;
480 pub fn chdir<P: ?Sized + NixPath>(path: &P) -> Result<()> {
481 let res = path.with_nix_path(|cstr| {
502 /// Creates new directory `path` with access rights `mode`. (see [mkdir(2)](https://pubs.opengroup.org/onlinepubs/9699919799/functions/mkdir.html))
509 /// - the path already exists
510 /// - the path name is too long (longer than `PATH_MAX`, usually 4096 on linux, 1024 on OS X)
520 /// let tmp_dir2 = tmp_dir1.path().join("new_dir");
529 pub fn mkdir<P: ?Sized + NixPath>(path: &P, mode: Mode) -> Result<()> {
530 let res = path.with_nix_path(|cstr| {
537 /// Creates new fifo special file (named pipe) with path `path` and access rights `mode`.
544 /// - the path already exists
545 /// - the path name is too long (longer than `PATH_MAX`, usually 4096 on linux, 1024 on OS X)
558 /// let fifo_path = tmp_dir.path().join("foo.pipe");
568 pub fn mkfifo<P: ?Sized + NixPath>(path: &P, mode: Mode) -> Result<()> {
569 let res = path.with_nix_path(|cstr| {
576 /// Creates new fifo special file (named pipe) with path `path` and access rights `mode`.
578 /// If `dirfd` has a value, then `path` is relative to directory associated with the file descriptor.
580 /// If `dirfd` is `None`, then `path` is relative to the current working directory.
590 pub fn mkfifoat<P: ?Sized + NixPath>(dirfd: Option<RawFd>, path: &P, mode: Mode) -> Result<()> {
591 let res = path.with_nix_path(|cstr| unsafe {
650 /// of the current path.
709 /// Change the ownership of the file at `path` to be owned by the specified
713 /// The owner/group for the provided path name will not be modified if `None` is
714 /// provided for that argument. Ownership change will be attempted for the path
717 pub fn chown<P: ?Sized + NixPath>(path: &P, owner: Option<Uid>, group: Option<Gid>) -> Result<()> {
718 let res = path.with_nix_path(|cstr| {
731 /// provided for that argument. Ownership change will be attempted for the path
747 /// Change the ownership of the file at `path` to be owned by the specified
750 /// The owner/group for the provided path name will not be modified if `None` is
751 /// provided for that argument. Ownership change will be attempted for the path
758 /// If `flag` is `FchownatFlags::NoFollowSymlink` and `path` names a symbolic link,
761 /// `fchownat(None, path, owner, group, FchownatFlags::NoFollowSymlink)` is identical to
762 /// a call `libc::lchown(path, owner, group)`. That's why `lchown` is unimplemented in
771 path: &P,
781 let res = path.with_nix_path(|cstr| unsafe {
808 pub fn execv<S: AsRef<CStr>>(path: &CStr, argv: &[S]) -> Result<Infallible> {
812 libc::execv(path.as_ptr(), args_p.as_ptr())
832 pub fn execve<SA: AsRef<CStr>, SE: AsRef<CStr>>(path: &CStr, args: &[SA], env: &[SE]) -> Result<Infallible> {
837 libc::execve(path.as_ptr(), args_p.as_ptr(), env_p.as_ptr())
850 /// would not work if "bash" was specified for the path argument, but `execvp`
868 /// environment and have a search path. See these two for additional
893 /// is referenced as a file descriptor instead of a path.
919 /// is referenced as a file descriptor to the base directory plus a path.
1198 pub fn truncate<P: ?Sized + NixPath>(path: &P, len: off_t) -> Result<()> {
1199 let res = path.with_nix_path(|cstr| {
1241 /// case of a relative `oldpath`, the path is interpreted relative to the directory associated
1287 pub fn unlink<P: ?Sized + NixPath>(path: &P) -> Result<()> {
1288 let res = path.with_nix_path(|cstr| {
1305 /// In the case of a relative path, the directory entry to be removed is determined relative to
1307 /// if `dirfd` is `None`. In the case of an absolute `path` `dirfd` is ignored. If `flag` is
1308 /// `UnlinkatFlags::RemoveDir` then removal of the directory entry specified by `dirfd` and `path`
1316 path: &P,
1324 let res = path.with_nix_path(|cstr| {
1335 pub fn chroot<P: ?Sized + NixPath>(path: &P) -> Result<()> {
1336 let res = path.with_nix_path(|cstr| {
1884 /// * `template`: a path whose 6 rightmost characters must be X, e.g. `/tmp/tmpfile_XXXXXX`
1898 /// Ok((fd, path)) => {
1899 /// unistd::unlink(path.as_path()).unwrap(); // flag file to be deleted at app termination
1908 let mut path = template.with_nix_path(|path| {path.to_bytes_with_nul().to_owned()})?;
1909 let p = path.as_mut_ptr() as *mut _;
1911 let last = path.pop(); // drop the trailing nul
1913 let pathname = OsString::from_vec(path);
2075 /// Get path-dependent configurable system variables (see
2078 /// Returns the value of a path-dependent configurable system variable. Most
2085 /// - `path`: Lookup the value of `var` for this file or directory
2096 pub fn pathconf<P: ?Sized + NixPath>(path: &P, var: PathconfVar) -> Result<Option<c_long>> {
2097 let raw = path.with_nix_path(|cstr| {
2904 /// Checks the file named by `path` for accessibility according to the flags given by `amode`
2906 pub fn access<P: ?Sized + NixPath>(path: &P, amode: AccessFlags) -> Result<()> {
2907 let res = path.with_nix_path(|cstr| {
2915 /// Checks the file named by `path` for accessibility according to the flags given by `mode`
2917 /// If `dirfd` has a value, then `path` is relative to directory associated with the file descriptor.
2919 /// If `dirfd` is `None`, then `path` is relative to the current working directory.
2926 pub fn faccessat<P: ?Sized + NixPath>(dirfd: Option<RawFd>, path: &P, mode: AccessFlags, flags: AtFlags) -> Result<()> {
2927 let res = path.with_nix_path(|cstr| {
2935 /// Checks the file named by `path` for accessibility according to the flags given
2947 pub fn eaccess<P: ?Sized + NixPath>(path: &P, mode: AccessFlags) -> Result<()> {
2948 let res = path.with_nix_path(|cstr| {
3376 pub fn chflags<P: ?Sized + NixPath>(path: &P, flags: FileFlag) -> Result<()> {
3377 let res = path.with_nix_path(|cstr| unsafe {