Skip to content

Commit

Permalink
espidf: fix stat
Browse files Browse the repository at this point in the history
* corect type usage with new type definitions in libc
  • Loading branch information
MabezDev committed Apr 11, 2022
1 parent f565016 commit 4f6b3a6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
24 changes: 12 additions & 12 deletions library/std/src/os/unix/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,26 @@ pub trait CommandExt: Sealed {
#[stable(feature = "rust1", since = "1.0.0")]
fn uid(
&mut self,
#[cfg(not(target_os = "vxworks"))] id: u32,
#[cfg(target_os = "vxworks")] id: u16,
#[cfg(not(any(target_os = "vxworks", target_os = "espidf")))] id: u32,
#[cfg(any(target_os = "vxworks", target_os = "espidf"))] id: u16,
) -> &mut process::Command;

/// Similar to `uid`, but sets the group ID of the child process. This has
/// the same semantics as the `uid` field.
#[stable(feature = "rust1", since = "1.0.0")]
fn gid(
&mut self,
#[cfg(not(target_os = "vxworks"))] id: u32,
#[cfg(target_os = "vxworks")] id: u16,
#[cfg(not(any(target_os = "vxworks", target_os = "espidf")))] id: u32,
#[cfg(any(target_os = "vxworks", target_os = "espidf"))] id: u16,
) -> &mut process::Command;

/// Sets the supplementary group IDs for the calling process. Translates to
/// a `setgroups` call in the child process.
#[unstable(feature = "setgroups", issue = "90747")]
fn groups(
&mut self,
#[cfg(not(target_os = "vxworks"))] groups: &[u32],
#[cfg(target_os = "vxworks")] groups: &[u16],
#[cfg(not(any(target_os = "vxworks", target_os = "espidf")))] groups: &[u32],
#[cfg(any(target_os = "vxworks", target_os = "espidf"))] groups: &[u16],
) -> &mut process::Command;

/// Schedules a closure to be run just before the `exec` function is
Expand Down Expand Up @@ -160,26 +160,26 @@ pub trait CommandExt: Sealed {
impl CommandExt for process::Command {
fn uid(
&mut self,
#[cfg(not(target_os = "vxworks"))] id: u32,
#[cfg(target_os = "vxworks")] id: u16,
#[cfg(not(any(target_os = "vxworks", target_os = "espidf")))] id: u32,
#[cfg(any(target_os = "vxworks", target_os = "espidf"))] id: u16,
) -> &mut process::Command {
self.as_inner_mut().uid(id);
self
}

fn gid(
&mut self,
#[cfg(not(target_os = "vxworks"))] id: u32,
#[cfg(target_os = "vxworks")] id: u16,
#[cfg(not(any(target_os = "vxworks", target_os = "espidf")))] id: u32,
#[cfg(any(target_os = "vxworks", target_os = "espidf"))] id: u16,
) -> &mut process::Command {
self.as_inner_mut().gid(id);
self
}

fn groups(
&mut self,
#[cfg(not(target_os = "vxworks"))] groups: &[u32],
#[cfg(target_os = "vxworks")] groups: &[u16],
#[cfg(not(any(target_os = "vxworks", target_os = "espidf")))] groups: &[u32],
#[cfg(any(target_os = "vxworks", target_os = "espidf"))] groups: &[u16],
) -> &mut process::Command {
self.as_inner_mut().groups(groups);
self
Expand Down
4 changes: 2 additions & 2 deletions library/std/src/sys/unix/fd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl FileDesc {
self.as_raw_fd(),
buf.as_mut_ptr() as *mut c_void,
cmp::min(buf.len(), READ_LIMIT),
offset as i64,
offset as libc::off64_t,
))
.map(|n| n as usize)
}
Expand Down Expand Up @@ -176,7 +176,7 @@ impl FileDesc {
self.as_raw_fd(),
buf.as_ptr() as *const c_void,
cmp::min(buf.len(), READ_LIMIT),
offset as i64,
offset as libc::off64_t,
))
.map(|n| n as usize)
}
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/unix/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ impl File {
SeekFrom::End(off) => (libc::SEEK_END, off),
SeekFrom::Current(off) => (libc::SEEK_CUR, off),
};
let n = cvt(unsafe { lseek64(self.as_raw_fd(), pos, whence) })?;
let n = cvt(unsafe { lseek64(self.as_raw_fd(), pos as libc::off64_t, whence) })?;
Ok(n as u64)
}

Expand Down

0 comments on commit 4f6b3a6

Please sign in to comment.