Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
connor4312 committed Mar 7, 2023
1 parent 06698f4 commit e0aeeda
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 18 deletions.
6 changes: 0 additions & 6 deletions .vscode/settings.json

This file was deleted.

6 changes: 3 additions & 3 deletions src/fcntl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ feature! {
#![feature = "fs"]

#[cfg(unix)]
pub const PATH_MAX: usize = libc::PATH_MAX;
pub const PATH_MAX: usize = libc::PATH_MAX as usize;

#[cfg(target_os = "wasi")]
pub const PATH_MAX: usize = 4096; // max is whatever the host system is... so guess posix?
Expand Down Expand Up @@ -318,7 +318,7 @@ fn inner_readlink<P: ?Sized + NixPath>(
dirfd: Option<RawFd>,
path: &P,
) -> Result<OsString> {
let mut v = Vec::with_capacity(libc::PATH_MAX as usize);
let mut v = Vec::with_capacity(PATH_MAX as usize);

{
// simple case: result is strictly less than `PATH_MAX`
Expand Down Expand Up @@ -371,7 +371,7 @@ fn inner_readlink<P: ?Sized + NixPath>(
} else {
// If lstat doesn't cooperate, or reports an error, be a little less
// precise.
(libc::PATH_MAX as usize).max(128) << 1
(PATH_MAX as usize).max(128) << 1
}
};

Expand Down
13 changes: 6 additions & 7 deletions src/sys/stat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub use libc::{dev_t, mode_t};
#[cfg(not(target_os = "redox"))]
use crate::fcntl::{at_rawfd, AtFlags};
use crate::sys::time::{TimeSpec, TimeVal};
use crate::{errno::Errno, NixPath, Result, RawFd};
use crate::{errno::Errno, NixPath, RawFd, Result};
use std::mem;

libc_bitflags!(
Expand All @@ -32,7 +32,6 @@ libc_bitflags!(
libc_bitflags! {
/// "File mode / permissions" flags.
pub struct Mode: mode_t {
#[cfg(not(target_os = "redox"))]
/// Read, write and execute for owner.
S_IRWXU;
/// Read for owner.
Expand Down Expand Up @@ -367,12 +366,12 @@ pub fn utimes<P: ?Sized + NixPath>(
atime: &TimeVal,
mtime: &TimeVal,
) -> Result<()> {
let times: [libc::timeval; 2] = [*atime.as_ref(), *mtime.as_ref()];
let res = path.with_nix_path(|cstr| unsafe {
libc::utimes(cstr.as_ptr(), &times[0])
})?;
let times: [libc::timeval; 2] = [*atime.as_ref(), *mtime.as_ref()];
let res = path.with_nix_path(|cstr| unsafe {
libc::utimes(cstr.as_ptr(), &times[0])
})?;

Errno::result(res).map(drop)
Errno::result(res).map(drop)
}

/// Change the access and modification times of a file without following symlinks.
Expand Down
5 changes: 4 additions & 1 deletion src/sys/uio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ use crate::errno::Errno;
use crate::{Result, RawFd};
use libc::{self, c_int, c_void, off_t, size_t};
use std::io::{IoSlice, IoSliceMut};
use std::os::fd::{AsFd, AsRawFd};
#[cfg(unix)]
use std::os::unix::prelude::{AsFd, AsRawFd};
#[cfg(target_os = "wasi")]
use std::os::wasi::prelude::{AsFd, AsRawFd};

/// Low-level vectored write to a raw file descriptor
///
Expand Down
1 change: 0 additions & 1 deletion src/unistd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3917,7 +3917,6 @@ feature! {
/// (see [`ttyname(3)`](https://man7.org/linux/man-pages/man3/ttyname.3.html)).
#[cfg(not(target_os = "fuchsia"))]
pub fn ttyname(fd: RawFd) -> Result<PathBuf> {
const PATH_MAX: usize = libc::PATH_MAX as usize;
let mut buf = vec![0_u8; PATH_MAX];
let c_buf = buf.as_mut_ptr() as *mut libc::c_char;

Expand Down

0 comments on commit e0aeeda

Please sign in to comment.