summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-05-30 13:57:31 +0000
committerbors <bors@rust-lang.org>2017-05-30 13:57:31 +0000
commit80e1422851d45015ebd6d351ebc16db55ee24be4 (patch)
tree8515bfa777cfacc68ce1df2c1c5662b213ce50d1
parent3c28e47459bc62218a1034819328277aeca8e1dd (diff)
parent6acbf873dbc9fe3d3cd751bd58b26d742eaf994b (diff)
downloadrust-libc-80e1422851d45015ebd6d351ebc16db55ee24be4.tar.gz
Auto merge of #599 - xd009642:master, r=alexcrichton
Adding missing structs from linux/user.h Adding structs from linux/user.h (or sys/user.h depending on OS version). This adds the linux user_regs_struct and user struct from sys/user.h into libc for x86 and x86_64. Also, bumping the version number. As an aside, I was wondering if this was also the right place to add the bit offsets for the [EFLAGS register ](https://en.wikibooks.org/wiki/X86_Assembly/X86_Architecture#EFLAGS_Register)? These aren't defined anywhere in the linux system libraries instead the definition seems to just be in the x86 and x86_64 documentation but they are useful for anyone looking to interpret eflags. If libc is the right place for these constants I'd like the opportunity to add them before it's merged in. :)
-rw-r--r--Cargo.lock6
-rw-r--r--libc-test/build.rs1
-rw-r--r--src/unix/notbsd/linux/other/b32/x86.rs65
-rw-r--r--src/unix/notbsd/linux/other/b64/x86_64.rs62
4 files changed, 131 insertions, 3 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 19d2108b73..da8cdf8cb7 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -52,7 +52,7 @@ version = "0.2.23"
[[package]]
name = "log"
-version = "0.3.7"
+version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@@ -67,7 +67,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
- "log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
"term 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -103,7 +103,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum gcc 0.3.46 (registry+https://github.com/rust-lang/crates.io-index)" = "181e3cebba1d663bd92eb90e2da787e10597e027eb00de8d742b260a7850948f"
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
"checksum libc 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "e32a70cf75e5846d53a673923498228bbec6a8624708a9ea5645f075d6276122"
-"checksum log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "5141eca02775a762cc6cd564d8d2c50f67c0ea3a372cbf1c51592b3e029e10ad"
+"checksum log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "880f77541efa6e5cc74e76910c9884d9859683118839d6a1dc3b11e63512565b"
"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda"
"checksum syntex_syntax 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8739e1a8b53efe7349917259f8ced15f797c89bf788a86e44f61addc0d1ecf68"
"checksum term 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "f2077e54d38055cf1ca0fd7933a2e00cd3ec8f6fed352b2a377f06dcdaaf3281"
diff --git a/libc-test/build.rs b/libc-test/build.rs
index 0fad65ad3f..619b8d3446 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -177,6 +177,7 @@ fn main() {
cfg.header("sys/sem.h");
cfg.header("sys/msg.h");
cfg.header("sys/shm.h");
+ cfg.header("sys/user.h");
cfg.header("sys/fsuid.h");
cfg.header("pty.h");
cfg.header("shadow.h");
diff --git a/src/unix/notbsd/linux/other/b32/x86.rs b/src/unix/notbsd/linux/other/b32/x86.rs
index 263e1406b7..04a3caad12 100644
--- a/src/unix/notbsd/linux/other/b32/x86.rs
+++ b/src/unix/notbsd/linux/other/b32/x86.rs
@@ -20,6 +20,71 @@ s! {
pub status: ::c_ulong,
}
+ pub struct user_fpregs_struct {
+ pub cwd: ::c_long,
+ pub swd: ::c_long,
+ pub twd: ::c_long,
+ pub fip: ::c_long,
+ pub fcs: ::c_long,
+ pub foo: ::c_long,
+ pub fos: ::c_long,
+ pub st_space: [::c_long; 20],
+ }
+
+ pub struct user_fpxregs_struct {
+ pub cwd: ::c_ushort,
+ pub swd: ::c_ushort,
+ pub twd: ::c_ushort,
+ pub fop: ::c_ushort,
+ pub fip: ::c_long,
+ pub fcs: ::c_long,
+ pub foo: ::c_long,
+ pub fos: ::c_long,
+ pub mxcsr: ::c_long,
+ __reserved: ::c_long,
+ pub st_space: [::c_long; 32],
+ pub xmm_space: [::c_long; 32],
+ padding: [::c_long; 56],
+ }
+
+ pub struct user_regs_struct {
+ pub ebx: ::c_long,
+ pub ecx: ::c_long,
+ pub edx: ::c_long,
+ pub esi: ::c_long,
+ pub edi: ::c_long,
+ pub ebp: ::c_long,
+ pub eax: ::c_long,
+ pub xds: ::c_long,
+ pub xes: ::c_long,
+ pub xfs: ::c_long,
+ pub xgs: ::c_long,
+ pub orig_eax: ::c_long,
+ pub eip: ::c_long,
+ pub xcs: ::c_long,
+ pub eflags: ::c_long,
+ pub esp: ::c_long,
+ pub xss: ::c_long,
+ }
+
+ pub struct user {
+ pub regs: user_regs_struct,
+ pub u_fpvalid: ::c_int,
+ pub i387: user_fpregs_struct,
+ pub u_tsize: ::c_ulong,
+ pub u_dsize: ::c_ulong,
+ pub u_ssize: ::c_ulong,
+ pub start_code: ::c_ulong,
+ pub start_stack: ::c_ulong,
+ pub signal: ::c_long,
+ __reserved: ::c_int,
+ pub u_ar0: *mut user_regs_struct,
+ pub u_fpstate: *mut user_fpregs_struct,
+ pub magic: ::c_ulong,
+ pub u_comm: [c_char; 32],
+ pub u_debugreg: [::c_int; 8],
+ }
+
pub struct mcontext_t {
pub gregs: [greg_t; 19],
pub fpregs: *mut _libc_fpstate,
diff --git a/src/unix/notbsd/linux/other/b64/x86_64.rs b/src/unix/notbsd/linux/other/b64/x86_64.rs
index b39ccb3916..ac72359980 100644
--- a/src/unix/notbsd/linux/other/b64/x86_64.rs
+++ b/src/unix/notbsd/linux/other/b64/x86_64.rs
@@ -78,6 +78,68 @@ s! {
__private: [u64; 12],
}
+ pub struct user_fpregs_struct {
+ pub cwd: ::c_ushort,
+ pub swd: ::c_ushort,
+ pub ftw: ::c_ushort,
+ pub fop: ::c_ushort,
+ pub rip: ::c_ulonglong,
+ pub rdp: ::c_ulonglong,
+ pub mxcsr: ::c_uint,
+ pub mxcr_mask: ::c_uint,
+ pub st_space: [::c_uint; 32],
+ pub xmm_space: [::c_uint; 64],
+ padding: [::c_uint; 24],
+ }
+
+ pub struct user_regs_struct {
+ pub r15: ::c_ulonglong,
+ pub r14: ::c_ulonglong,
+ pub r13: ::c_ulonglong,
+ pub r12: ::c_ulonglong,
+ pub rbp: ::c_ulonglong,
+ pub rbx: ::c_ulonglong,
+ pub r11: ::c_ulonglong,
+ pub r10: ::c_ulonglong,
+ pub r9: ::c_ulonglong,
+ pub r8: ::c_ulonglong,
+ pub rax: ::c_ulonglong,
+ pub rcx: ::c_ulonglong,
+ pub rdx: ::c_ulonglong,
+ pub rsi: ::c_ulonglong,
+ pub rdi: ::c_ulonglong,
+ pub orig_rax: ::c_ulonglong,
+ pub rip: ::c_ulonglong,
+ pub cs: ::c_ulonglong,
+ pub eflags: ::c_ulonglong,
+ pub rsp: ::c_ulonglong,
+ pub ss: ::c_ulonglong,
+ pub fs_base: ::c_ulonglong,
+ pub gs_base: ::c_ulonglong,
+ pub ds: ::c_ulonglong,
+ pub es: ::c_ulonglong,
+ pub fs: ::c_ulonglong,
+ pub gs: ::c_ulonglong,
+ }
+
+ pub struct user {
+ pub regs: user_regs_struct,
+ pub u_fpvalid: ::c_int,
+ pub i387: user_fpregs_struct,
+ pub u_tsize: ::c_ulonglong,
+ pub u_dsize: ::c_ulonglong,
+ pub u_ssize: ::c_ulonglong,
+ pub start_code: ::c_ulonglong,
+ pub start_stack: ::c_ulonglong,
+ pub signal: ::c_longlong,
+ __reserved: ::c_int,
+ pub u_ar0: *mut user_regs_struct,
+ pub u_fpstate: *mut user_fpregs_struct,
+ pub magic: ::c_ulonglong,
+ pub u_comm: [::c_char; 32],
+ pub u_debugreg: [::c_ulonglong; 8],
+ }
+
pub struct mcontext_t {
pub gregs: [greg_t; 23],
pub fpregs: *mut _libc_fpstate,