[−][src]Struct linux_taskstats::taskstats
This is custom copy of the generated struct taskstats
from linux version 3.10.0 and in this crate
this type is used to read binary data transferred from linux kernel.
The reason of doing this despite the bindgen
generates rust bindings including struct taskstats
is due to potential corruption of on-memory struct layout likely caused by old clang version.
ref: https://github.com/rust-lang/rust-bindgen/issues/867
Specifically, when bindgen
generates struct taskstats
with older clang version, the resulting
struct defined in generated rust source code contains size padding as the last member of the struct
causing offset of members after ac_uid
to shift 4-byte or more and the result data becomes unreliable.
The bindgen
generated definition works well in environment that uses newer clang versions, but I
decided to use copied definition of this struct for the time being by following considerations:
- The struct definition rarely evolves.
- Returning corrupted data silently is critical and much worse than not providing from the beginning.
- If user of this crate still needs to access the exactly original definition generated by
bindgen
, it might still be possible by casting type to__bindgen_taskstats
exported by this crate.
Fields
version: c_ushort
ac_exitcode: c_uint
ac_flag: c_uchar
ac_nice: c_uchar
cpu_count: c_ulonglong
cpu_delay_total: c_ulonglong
blkio_count: c_ulonglong
blkio_delay_total: c_ulonglong
swapin_count: c_ulonglong
swapin_delay_total: c_ulonglong
cpu_run_real_total: c_ulonglong
cpu_run_virtual_total: c_ulonglong
ac_comm: [c_char; 32]
ac_sched: c_uchar
ac_pad: [c_uchar; 3]
__unused_padding: u32
ac_uid: c_uint
ac_gid: c_uint
ac_pid: c_uint
ac_ppid: c_uint
ac_btime: c_uint
ac_etime: c_ulonglong
ac_utime: c_ulonglong
ac_stime: c_ulonglong
ac_minflt: c_ulonglong
ac_majflt: c_ulonglong
coremem: c_ulonglong
virtmem: c_ulonglong
hiwater_rss: c_ulonglong
hiwater_vm: c_ulonglong
read_char: c_ulonglong
write_char: c_ulonglong
read_syscalls: c_ulonglong
write_syscalls: c_ulonglong
read_bytes: c_ulonglong
write_bytes: c_ulonglong
cancelled_write_bytes: c_ulonglong
nvcsw: c_ulonglong
nivcsw: c_ulonglong
ac_utimescaled: c_ulonglong
ac_stimescaled: c_ulonglong
cpu_scaled_run_real_total: c_ulonglong
freepages_count: c_ulonglong
freepages_delay_total: c_ulonglong
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for taskstats
impl Send for taskstats
impl Sync for taskstats
impl Unpin for taskstats
impl UnwindSafe for taskstats
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,