Skip to content

Commit e0aeeda

Browse files
committed
updates
1 parent 06698f4 commit e0aeeda

File tree

5 files changed

+13
-18
lines changed

5 files changed

+13
-18
lines changed

.vscode/settings.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/fcntl.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ feature! {
193193
#![feature = "fs"]
194194

195195
#[cfg(unix)]
196-
pub const PATH_MAX: usize = libc::PATH_MAX;
196+
pub const PATH_MAX: usize = libc::PATH_MAX as usize;
197197

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

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

src/sys/stat.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub use libc::{dev_t, mode_t};
1212
#[cfg(not(target_os = "redox"))]
1313
use crate::fcntl::{at_rawfd, AtFlags};
1414
use crate::sys::time::{TimeSpec, TimeVal};
15-
use crate::{errno::Errno, NixPath, Result, RawFd};
15+
use crate::{errno::Errno, NixPath, RawFd, Result};
1616
use std::mem;
1717

1818
libc_bitflags!(
@@ -32,7 +32,6 @@ libc_bitflags!(
3232
libc_bitflags! {
3333
/// "File mode / permissions" flags.
3434
pub struct Mode: mode_t {
35-
#[cfg(not(target_os = "redox"))]
3635
/// Read, write and execute for owner.
3736
S_IRWXU;
3837
/// Read for owner.
@@ -367,12 +366,12 @@ pub fn utimes<P: ?Sized + NixPath>(
367366
atime: &TimeVal,
368367
mtime: &TimeVal,
369368
) -> Result<()> {
370-
let times: [libc::timeval; 2] = [*atime.as_ref(), *mtime.as_ref()];
371-
let res = path.with_nix_path(|cstr| unsafe {
372-
libc::utimes(cstr.as_ptr(), &times[0])
373-
})?;
369+
let times: [libc::timeval; 2] = [*atime.as_ref(), *mtime.as_ref()];
370+
let res = path.with_nix_path(|cstr| unsafe {
371+
libc::utimes(cstr.as_ptr(), &times[0])
372+
})?;
374373

375-
Errno::result(res).map(drop)
374+
Errno::result(res).map(drop)
376375
}
377376

378377
/// Change the access and modification times of a file without following symlinks.

src/sys/uio.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ use crate::errno::Errno;
44
use crate::{Result, RawFd};
55
use libc::{self, c_int, c_void, off_t, size_t};
66
use std::io::{IoSlice, IoSliceMut};
7-
use std::os::fd::{AsFd, AsRawFd};
7+
#[cfg(unix)]
8+
use std::os::unix::prelude::{AsFd, AsRawFd};
9+
#[cfg(target_os = "wasi")]
10+
use std::os::wasi::prelude::{AsFd, AsRawFd};
811

912
/// Low-level vectored write to a raw file descriptor
1013
///

src/unistd.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3917,7 +3917,6 @@ feature! {
39173917
/// (see [`ttyname(3)`](https://man7.org/linux/man-pages/man3/ttyname.3.html)).
39183918
#[cfg(not(target_os = "fuchsia"))]
39193919
pub fn ttyname(fd: RawFd) -> Result<PathBuf> {
3920-
const PATH_MAX: usize = libc::PATH_MAX as usize;
39213920
let mut buf = vec![0_u8; PATH_MAX];
39223921
let c_buf = buf.as_mut_ptr() as *mut libc::c_char;
39233922

0 commit comments

Comments
 (0)