Implement #include<sys/user.h> and #include<sys/procfs.h>

This patch implements sys/user.h file that works for both x86_64 as well
as aarch64. This include file is used by sys/procfs.h which is needed
dependency for binutils. There is bug in this patch in aarch64 implementation
which is the lack of f128 implementation in rust, thus we can't create cbinding
for long double.
This commit is contained in:
oddcoder
2020-04-24 15:39:08 +02:00
parent 763bb2488d
commit 3a923aa62d
8 changed files with 160 additions and 3 deletions
+7
View File
@@ -0,0 +1,7 @@
sys_includes = ["sys/user.h"]
include_guard = "_SYS_PROCFS_H"
language = "C"
style = "Tag"
[enum]
prefix_with_name = true
+73
View File
@@ -0,0 +1,73 @@
#[cfg(target_arch = "aarch64")]
use crate::header::arch_aarch64_user::*;
#[cfg(target_arch = "x86_64")]
use crate::header::arch_x64_user::*;
use crate::platform::types::*;
pub const ELF_PRARGSZ: size_t = 80;
#[repr(C)]
pub struct elf_siginfo {
pub si_signo: c_int,
pub si_code: c_int,
pub si_errno: c_int,
}
#[repr(C)]
pub struct time {
pub tv_sec: c_long,
pub tv_usec: c_long,
}
#[repr(C)]
pub struct elf_prstatus {
pub pr_info: elf_siginfo,
pub pr_cursig: c_short,
pub pr_sigpend: c_ulong,
pub pr_sighold: c_ulong,
pub pr_pid: pid_t,
pub pr_ppid: pid_t,
pub pr_pgrp: pid_t,
pub pr_sid: pid_t,
pub pr_utime: time,
pub pr_stime: time,
pub pr_cutime: time,
pub pr_cstime: time,
pub pr_reg: elf_gregset_t,
pub pr_fpvalid: c_int,
}
#[repr(C)]
pub struct elf_prpsinfo {
pub pr_state: c_char,
pub pr_sname: c_char,
pub pr_zomb: c_char,
pub pr_nice: c_char,
pub pr_flag: c_uint,
pub pr_uid: c_uint,
pub pr_gid: c_uint,
pub pr_pid: c_int,
pub pr_ppid: c_int,
pub pr_pgrp: c_int,
pub pr_sid: c_int,
pub pr_fname: [c_char; 16],
pub pr_psargs: [c_char; ELF_PRARGSZ],
}
pub type psaddr_t = *mut c_void;
pub type prgregset_t = elf_gregset_t;
pub type prfpregset_t = elf_fpregset_t;
pub type lwpid_t = pid_t;
pub type prstatus_t = elf_prstatus;
pub type prpsinfo_t = elf_prpsinfo;
#[no_mangle]
pub extern "C" fn _cbindgen_only_generates_structs_if_they_are_mentioned_which_is_dumb_procfs(
a: psaddr_t,
b: prgregset_t,
c: prfpregset_t,
d: lwpid_t,
e: prstatus_t,
f: prpsinfo_t,
) {
}