1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-30 04:27:45 +00:00

Add repr(C) to c structs

This commit is contained in:
Michael Gehring 2014-08-22 12:21:30 +02:00
parent 8c8a3757bd
commit 83974be06f
2 changed files with 10 additions and 0 deletions

View file

@ -18,6 +18,7 @@ use std::ptr::{mut_null, read};
use std::string::raw::from_buf;
#[cfg(target_os = "macos")]
#[repr(C)]
pub struct c_passwd {
pub pw_name: *const c_char, /* user name */
pub pw_passwd: *const c_char, /* user name */
@ -32,6 +33,7 @@ pub struct c_passwd {
}
#[cfg(target_os = "linux")]
#[repr(C)]
pub struct c_passwd {
pub pw_name: *const c_char, /* user name */
pub pw_passwd: *const c_char, /* user name */
@ -43,6 +45,7 @@ pub struct c_passwd {
}
#[cfg(target_os = "macos")]
#[repr(C)]
pub struct utsname {
pub sysname: [c_char, ..256],
pub nodename: [c_char, ..256],
@ -52,6 +55,7 @@ pub struct utsname {
}
#[cfg(target_os = "linux")]
#[repr(C)]
pub struct utsname {
pub sysname: [c_char, ..65],
pub nodename: [c_char, ..65],
@ -61,6 +65,7 @@ pub struct utsname {
pub domainame: [c_char, ..65]
}
#[repr(C)]
pub struct c_group {
pub gr_name: *const c_char, // group name
pub gr_passwd: *const c_char, // password
@ -68,6 +73,7 @@ pub struct c_group {
pub gr_mem: *const *const c_char, // member list
}
#[repr(C)]
pub struct c_tm {
pub tm_sec: c_int, /* seconds */
pub tm_min: c_int, /* minutes */

View file

@ -26,11 +26,13 @@ mod utmpx {
pub static DEAD_PROCESS: libc::c_short = 8;
pub static ACCOUNTING: libc::c_short = 9;
#[repr(C)]
pub struct c_exit_status {
pub e_termination: libc::c_short,
pub e_exit: libc::c_short,
}
#[repr(C)]
pub struct c_utmp {
pub ut_type: libc::c_short,
pub ut_pid: libc::pid_t,
@ -70,11 +72,13 @@ mod utmpx {
pub static DEAD_PROCESS: libc::c_short = 8;
pub static ACCOUNTING: libc::c_short = 9;
#[repr(C)]
pub struct c_exit_status {
pub e_termination: libc::c_short,
pub e_exit: libc::c_short,
}
#[repr(C)]
pub struct c_utmp {
pub ut_user: [libc::c_char, ..UT_NAMESIZE],
pub ut_id: [libc::c_char, ..UT_IDSIZE],