From 14a4d154a38198e4765ed880f9a32e70a697b2cd Mon Sep 17 00:00:00 2001 From: Steffen W Date: Sun, 10 Jul 2016 10:47:04 +0200 Subject: [PATCH 1/2] Added linger struct --- src/unix/bsd/apple/mod.rs | 5 +++++ src/unix/bsd/freebsdlike/mod.rs | 5 +++++ src/unix/bsd/openbsdlike/mod.rs | 5 +++++ src/unix/notbsd/android/mod.rs | 5 +++++ src/unix/notbsd/linux/mips.rs | 5 +++++ src/unix/notbsd/linux/musl/b32/arm.rs | 5 +++++ src/unix/notbsd/linux/musl/b32/asmjs.rs | 5 +++++ src/unix/notbsd/linux/musl/b32/mips.rs | 5 +++++ src/unix/notbsd/linux/musl/b32/x86.rs | 5 +++++ src/unix/notbsd/linux/musl/b64/mod.rs | 5 +++++ src/unix/notbsd/linux/other/mod.rs | 5 +++++ src/unix/solaris/mod.rs | 5 +++++ 12 files changed, 60 insertions(+) diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index f4235fdcc095d..7851ad1969ea6 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -287,6 +287,11 @@ s! { pub int_p_sign_posn: ::c_char, pub int_n_sign_posn: ::c_char, } + + pub struct linger { + pub l_onoff: ::c_int, + pub l_linger: ::c_int, + } } pub const LC_COLLATE_MASK: ::c_int = (1 << 0); diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index e7e04a78a201b..ef860d8465d79 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -155,6 +155,11 @@ s! { pub struct _sem { data: [u32; 4], } + + pub struct linger { + pub l_onoff: ::c_int, + pub l_linger: ::c_int, + } } pub const LC_COLLATE_MASK: ::c_int = (1 << 0); diff --git a/src/unix/bsd/openbsdlike/mod.rs b/src/unix/bsd/openbsdlike/mod.rs index 53e7c3c2d14b0..c2f8d85f5ea94 100644 --- a/src/unix/bsd/openbsdlike/mod.rs +++ b/src/unix/bsd/openbsdlike/mod.rs @@ -54,6 +54,11 @@ s! { pub l_type: ::c_short, pub l_whence: ::c_short, } + + pub struct linger { + pub l_onoff: ::c_int, + pub l_linger: ::c_int, + } } pub const D_T_FMT: ::nl_item = 0; diff --git a/src/unix/notbsd/android/mod.rs b/src/unix/notbsd/android/mod.rs index 6ddcfafc5d8bf..a96d278969cb4 100644 --- a/src/unix/notbsd/android/mod.rs +++ b/src/unix/notbsd/android/mod.rs @@ -99,6 +99,11 @@ s! { pub struct sem_t { count: ::c_uint, } + + pub struct linger { + pub l_onoff: ::c_int, + pub l_linger: ::c_int, + } } pub const BUFSIZ: ::c_uint = 1024; diff --git a/src/unix/notbsd/linux/mips.rs b/src/unix/notbsd/linux/mips.rs index fa5a2a36694b1..a9611b2b118bf 100644 --- a/src/unix/notbsd/linux/mips.rs +++ b/src/unix/notbsd/linux/mips.rs @@ -198,6 +198,11 @@ s! { __size: [::c_char; 32], __align: [::c_long; 0], } + + pub struct linger { + pub l_onoff: ::c_int, + pub l_linger: ::c_int, + } } pub const BUFSIZ: ::c_uint = 8192; diff --git a/src/unix/notbsd/linux/musl/b32/arm.rs b/src/unix/notbsd/linux/musl/b32/arm.rs index 5d648618e31d4..a9dfe12d8bf59 100644 --- a/src/unix/notbsd/linux/musl/b32/arm.rs +++ b/src/unix/notbsd/linux/musl/b32/arm.rs @@ -82,6 +82,11 @@ s! { pub f_flags: ::c_ulong, pub f_spare: [::c_ulong; 4], } + + pub struct linger { + pub l_onoff: ::c_int, + pub l_linger: ::c_int, + } } pub const O_DIRECT: ::c_int = 0x4000; diff --git a/src/unix/notbsd/linux/musl/b32/asmjs.rs b/src/unix/notbsd/linux/musl/b32/asmjs.rs index 93e4ab6b6dbcc..f813150e3b9d3 100644 --- a/src/unix/notbsd/linux/musl/b32/asmjs.rs +++ b/src/unix/notbsd/linux/musl/b32/asmjs.rs @@ -82,6 +82,11 @@ s! { pub f_flags: ::c_ulong, pub f_spare: [::c_ulong; 4], } + + pub struct linger { + pub l_onoff: ::c_int, + pub l_linger: ::c_int, + } } pub const O_DIRECT: ::c_int = 0x4000; diff --git a/src/unix/notbsd/linux/musl/b32/mips.rs b/src/unix/notbsd/linux/musl/b32/mips.rs index f52d1953226e9..f59458eaa7fb9 100644 --- a/src/unix/notbsd/linux/musl/b32/mips.rs +++ b/src/unix/notbsd/linux/musl/b32/mips.rs @@ -81,6 +81,11 @@ s! { pub f_flags: ::c_ulong, pub f_spare: [::c_ulong; 5], } + + pub struct linger { + pub l_onoff: ::c_int, + pub l_linger: ::c_int, + } } pub const O_DIRECT: ::c_int = 0o100000; diff --git a/src/unix/notbsd/linux/musl/b32/x86.rs b/src/unix/notbsd/linux/musl/b32/x86.rs index 9d057de7b9058..e849efee442bd 100644 --- a/src/unix/notbsd/linux/musl/b32/x86.rs +++ b/src/unix/notbsd/linux/musl/b32/x86.rs @@ -95,6 +95,11 @@ s! { pub uc_sigmask: ::sigset_t, __private: [u8; 112], } + + pub struct linger { + pub l_onoff: ::c_int, + pub l_linger: ::c_int, + } } pub const O_DIRECT: ::c_int = 0x4000; diff --git a/src/unix/notbsd/linux/musl/b64/mod.rs b/src/unix/notbsd/linux/musl/b64/mod.rs index 0501c553c3478..8f48e0f4f7ddc 100644 --- a/src/unix/notbsd/linux/musl/b64/mod.rs +++ b/src/unix/notbsd/linux/musl/b64/mod.rs @@ -104,6 +104,11 @@ s! { pub struct sem_t { __val: [::c_int; 8], } + + pub struct linger { + pub l_onoff: ::c_int, + pub l_linger: ::c_int, + } } pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; diff --git a/src/unix/notbsd/linux/other/mod.rs b/src/unix/notbsd/linux/other/mod.rs index 2998fbc21e2ed..deda1a489d5c4 100644 --- a/src/unix/notbsd/linux/other/mod.rs +++ b/src/unix/notbsd/linux/other/mod.rs @@ -130,6 +130,11 @@ s! { __size: [::c_char; 32], __align: [::c_long; 0], } + + pub struct linger { + pub l_onoff: ::c_int, + pub l_linger: ::c_int, + } } pub const RLIMIT_RSS: ::c_int = 5; diff --git a/src/unix/solaris/mod.rs b/src/unix/solaris/mod.rs index 56cb76ea94a43..0ef2e81d3dc68 100644 --- a/src/unix/solaris/mod.rs +++ b/src/unix/solaris/mod.rs @@ -318,6 +318,11 @@ s! { pub l_pid: ::pid_t, pub l_pad: [::c_long; 4] } + + pub struct linger { + pub l_onoff: ::c_int, + pub l_linger: ::c_int, + } } pub const LC_CTYPE: ::c_int = 0; From 69e89a194ea0b9db6b6d54a70dae7d70ce4bc32d Mon Sep 17 00:00:00 2001 From: sateffen Date: Mon, 11 Jul 2016 08:36:52 +0000 Subject: [PATCH 2/2] Refactored linger struct dry --- src/unix/bsd/apple/mod.rs | 5 ----- src/unix/bsd/freebsdlike/mod.rs | 5 ----- src/unix/bsd/openbsdlike/mod.rs | 5 ----- src/unix/mod.rs | 5 +++++ src/unix/notbsd/android/mod.rs | 5 ----- src/unix/notbsd/linux/mips.rs | 5 ----- src/unix/notbsd/linux/musl/b32/arm.rs | 5 ----- src/unix/notbsd/linux/musl/b32/asmjs.rs | 5 ----- src/unix/notbsd/linux/musl/b32/mips.rs | 5 ----- src/unix/notbsd/linux/musl/b32/x86.rs | 5 ----- src/unix/notbsd/linux/musl/b64/mod.rs | 5 ----- src/unix/notbsd/linux/other/mod.rs | 5 ----- src/unix/solaris/mod.rs | 5 ----- 13 files changed, 5 insertions(+), 60 deletions(-) diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 7851ad1969ea6..f4235fdcc095d 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -287,11 +287,6 @@ s! { pub int_p_sign_posn: ::c_char, pub int_n_sign_posn: ::c_char, } - - pub struct linger { - pub l_onoff: ::c_int, - pub l_linger: ::c_int, - } } pub const LC_COLLATE_MASK: ::c_int = (1 << 0); diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index ef860d8465d79..e7e04a78a201b 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -155,11 +155,6 @@ s! { pub struct _sem { data: [u32; 4], } - - pub struct linger { - pub l_onoff: ::c_int, - pub l_linger: ::c_int, - } } pub const LC_COLLATE_MASK: ::c_int = (1 << 0); diff --git a/src/unix/bsd/openbsdlike/mod.rs b/src/unix/bsd/openbsdlike/mod.rs index c2f8d85f5ea94..53e7c3c2d14b0 100644 --- a/src/unix/bsd/openbsdlike/mod.rs +++ b/src/unix/bsd/openbsdlike/mod.rs @@ -54,11 +54,6 @@ s! { pub l_type: ::c_short, pub l_whence: ::c_short, } - - pub struct linger { - pub l_onoff: ::c_int, - pub l_linger: ::c_int, - } } pub const D_T_FMT: ::nl_item = 0; diff --git a/src/unix/mod.rs b/src/unix/mod.rs index d799ec13f3b70..214f2cc043c6a 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -109,6 +109,11 @@ s! { pub ws_xpixel: ::c_ushort, pub ws_ypixel: ::c_ushort, } + + pub struct linger { + pub l_onoff: ::c_int, + pub l_linger: ::c_int, + } } pub const SIG_DFL: sighandler_t = 0 as sighandler_t; diff --git a/src/unix/notbsd/android/mod.rs b/src/unix/notbsd/android/mod.rs index a96d278969cb4..6ddcfafc5d8bf 100644 --- a/src/unix/notbsd/android/mod.rs +++ b/src/unix/notbsd/android/mod.rs @@ -99,11 +99,6 @@ s! { pub struct sem_t { count: ::c_uint, } - - pub struct linger { - pub l_onoff: ::c_int, - pub l_linger: ::c_int, - } } pub const BUFSIZ: ::c_uint = 1024; diff --git a/src/unix/notbsd/linux/mips.rs b/src/unix/notbsd/linux/mips.rs index a9611b2b118bf..fa5a2a36694b1 100644 --- a/src/unix/notbsd/linux/mips.rs +++ b/src/unix/notbsd/linux/mips.rs @@ -198,11 +198,6 @@ s! { __size: [::c_char; 32], __align: [::c_long; 0], } - - pub struct linger { - pub l_onoff: ::c_int, - pub l_linger: ::c_int, - } } pub const BUFSIZ: ::c_uint = 8192; diff --git a/src/unix/notbsd/linux/musl/b32/arm.rs b/src/unix/notbsd/linux/musl/b32/arm.rs index a9dfe12d8bf59..5d648618e31d4 100644 --- a/src/unix/notbsd/linux/musl/b32/arm.rs +++ b/src/unix/notbsd/linux/musl/b32/arm.rs @@ -82,11 +82,6 @@ s! { pub f_flags: ::c_ulong, pub f_spare: [::c_ulong; 4], } - - pub struct linger { - pub l_onoff: ::c_int, - pub l_linger: ::c_int, - } } pub const O_DIRECT: ::c_int = 0x4000; diff --git a/src/unix/notbsd/linux/musl/b32/asmjs.rs b/src/unix/notbsd/linux/musl/b32/asmjs.rs index f813150e3b9d3..93e4ab6b6dbcc 100644 --- a/src/unix/notbsd/linux/musl/b32/asmjs.rs +++ b/src/unix/notbsd/linux/musl/b32/asmjs.rs @@ -82,11 +82,6 @@ s! { pub f_flags: ::c_ulong, pub f_spare: [::c_ulong; 4], } - - pub struct linger { - pub l_onoff: ::c_int, - pub l_linger: ::c_int, - } } pub const O_DIRECT: ::c_int = 0x4000; diff --git a/src/unix/notbsd/linux/musl/b32/mips.rs b/src/unix/notbsd/linux/musl/b32/mips.rs index f59458eaa7fb9..f52d1953226e9 100644 --- a/src/unix/notbsd/linux/musl/b32/mips.rs +++ b/src/unix/notbsd/linux/musl/b32/mips.rs @@ -81,11 +81,6 @@ s! { pub f_flags: ::c_ulong, pub f_spare: [::c_ulong; 5], } - - pub struct linger { - pub l_onoff: ::c_int, - pub l_linger: ::c_int, - } } pub const O_DIRECT: ::c_int = 0o100000; diff --git a/src/unix/notbsd/linux/musl/b32/x86.rs b/src/unix/notbsd/linux/musl/b32/x86.rs index e849efee442bd..9d057de7b9058 100644 --- a/src/unix/notbsd/linux/musl/b32/x86.rs +++ b/src/unix/notbsd/linux/musl/b32/x86.rs @@ -95,11 +95,6 @@ s! { pub uc_sigmask: ::sigset_t, __private: [u8; 112], } - - pub struct linger { - pub l_onoff: ::c_int, - pub l_linger: ::c_int, - } } pub const O_DIRECT: ::c_int = 0x4000; diff --git a/src/unix/notbsd/linux/musl/b64/mod.rs b/src/unix/notbsd/linux/musl/b64/mod.rs index 8f48e0f4f7ddc..0501c553c3478 100644 --- a/src/unix/notbsd/linux/musl/b64/mod.rs +++ b/src/unix/notbsd/linux/musl/b64/mod.rs @@ -104,11 +104,6 @@ s! { pub struct sem_t { __val: [::c_int; 8], } - - pub struct linger { - pub l_onoff: ::c_int, - pub l_linger: ::c_int, - } } pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; diff --git a/src/unix/notbsd/linux/other/mod.rs b/src/unix/notbsd/linux/other/mod.rs index deda1a489d5c4..2998fbc21e2ed 100644 --- a/src/unix/notbsd/linux/other/mod.rs +++ b/src/unix/notbsd/linux/other/mod.rs @@ -130,11 +130,6 @@ s! { __size: [::c_char; 32], __align: [::c_long; 0], } - - pub struct linger { - pub l_onoff: ::c_int, - pub l_linger: ::c_int, - } } pub const RLIMIT_RSS: ::c_int = 5; diff --git a/src/unix/solaris/mod.rs b/src/unix/solaris/mod.rs index 0ef2e81d3dc68..56cb76ea94a43 100644 --- a/src/unix/solaris/mod.rs +++ b/src/unix/solaris/mod.rs @@ -318,11 +318,6 @@ s! { pub l_pid: ::pid_t, pub l_pad: [::c_long; 4] } - - pub struct linger { - pub l_onoff: ::c_int, - pub l_linger: ::c_int, - } } pub const LC_CTYPE: ::c_int = 0;