diff options
Diffstat (limited to 'src/sys')
-rw-r--r-- | src/sys/epoll.rs | 4 | ||||
-rw-r--r-- | src/sys/event.rs | 4 | ||||
-rw-r--r-- | src/sys/ioctl.rs | 2 | ||||
-rw-r--r-- | src/sys/signal.rs | 10 | ||||
-rw-r--r-- | src/sys/socket/addr.rs | 2 | ||||
-rw-r--r-- | src/sys/socket/mod.rs | 4 | ||||
-rw-r--r-- | src/sys/socket/multicast.rs | 2 | ||||
-rw-r--r-- | src/sys/socket/sockopt.rs | 2 | ||||
-rw-r--r-- | src/sys/termios.rs | 16 | ||||
-rw-r--r-- | src/sys/utsname.rs | 3 | ||||
-rw-r--r-- | src/sys/wait.rs | 2 |
11 files changed, 27 insertions, 24 deletions
diff --git a/src/sys/epoll.rs b/src/sys/epoll.rs index a68a7b6f..1028af78 100644 --- a/src/sys/epoll.rs +++ b/src/sys/epoll.rs @@ -70,7 +70,7 @@ impl fmt::Debug for EpollEventKind { } } -#[derive(Copy)] +#[derive(Clone, Copy)] #[repr(C)] pub enum EpollOp { EpollCtlAdd = 1, @@ -94,7 +94,7 @@ fn test_epoll_event_size() { } #[cfg(any(not(target_os = "android"), target_arch = "x86_64"))] -#[derive(Copy)] +#[derive(Clone, Copy)] #[repr(C, packed)] pub struct EpollEvent { pub events: EpollEventKind, diff --git a/src/sys/event.rs b/src/sys/event.rs index 9a0ede1e..c2c65dad 100644 --- a/src/sys/event.rs +++ b/src/sys/event.rs @@ -13,7 +13,7 @@ mod ffi { pub use libc::{c_int, c_void, uintptr_t, intptr_t, timespec}; use super::{EventFilter, EventFlag, FilterFlag}; - #[derive(Copy)] + #[derive(Clone, Copy)] #[repr(C)] pub struct kevent { pub ident: uintptr_t, // 8 @@ -40,7 +40,7 @@ mod ffi { } #[repr(i16)] -#[derive(Copy, Debug, PartialEq)] +#[derive(Clone, Copy, Debug, PartialEq)] pub enum EventFilter { EVFILT_READ = -1, EVFILT_WRITE = -2, diff --git a/src/sys/ioctl.rs b/src/sys/ioctl.rs index 5003a4f6..18b8b1ab 100644 --- a/src/sys/ioctl.rs +++ b/src/sys/ioctl.rs @@ -8,7 +8,7 @@ pub use self::IoctlArg::*; mod ffi { use libc::c_ushort; - #[derive(Copy, Debug)] + #[derive(Clone, Copy, Debug)] pub struct Winsize { pub ws_row: c_ushort, pub ws_col: c_ushort, diff --git a/src/sys/signal.rs b/src/sys/signal.rs index 5dd974cc..afeb9c6c 100644 --- a/src/sys/signal.rs +++ b/src/sys/signal.rs @@ -96,7 +96,7 @@ pub mod signal { // actually a giant union. Currently we're only interested in these fields, // however. #[repr(C)] - #[derive(Copy)] + #[derive(Clone, Copy)] pub struct siginfo { si_signo: libc::c_int, si_errno: libc::c_int, @@ -117,14 +117,14 @@ pub mod signal { #[repr(C)] #[cfg(target_pointer_width = "32")] - #[derive(Copy)] + #[derive(Clone, Copy)] pub struct sigset_t { __val: [libc::c_ulong; 32], } #[repr(C)] #[cfg(target_pointer_width = "64")] - #[derive(Copy)] + #[derive(Clone, Copy)] pub struct sigset_t { __val: [libc::c_ulong; 16], } @@ -249,7 +249,7 @@ pub mod signal { // This structure has more fields, but we're not all that interested in // them. #[repr(C)] - #[derive(Copy)] + #[derive(Clone, Copy)] pub struct siginfo { pub si_signo: libc::c_int, pub si_errno: libc::c_int, @@ -297,7 +297,7 @@ mod ffi { } } -#[derive(Copy)] +#[derive(Clone, Copy)] pub struct SigSet { sigset: sigset_t } diff --git a/src/sys/socket/addr.rs b/src/sys/socket/addr.rs index 34028246..1ae5a9c3 100644 --- a/src/sys/socket/addr.rs +++ b/src/sys/socket/addr.rs @@ -275,7 +275,7 @@ impl fmt::Display for Ipv4Addr { * */ -#[derive(Copy)] +#[derive(Clone, Copy)] pub struct Ipv6Addr(pub libc::in6_addr); impl Ipv6Addr { diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs index 707a2a59..ea5c9916 100644 --- a/src/sys/socket/mod.rs +++ b/src/sys/socket/mod.rs @@ -57,7 +57,7 @@ pub struct sockaddr_storage { pub __ss_pad2: [u8; 120], } -#[derive(Copy, PartialEq, Eq, Debug, FromPrimitive)] +#[derive(Clone, Copy, PartialEq, Eq, Debug, FromPrimitive)] #[repr(i32)] pub enum SockType { Stream = consts::SOCK_STREAM, @@ -248,7 +248,7 @@ pub fn sendto(fd: RawFd, buf: &[u8], addr: &SockAddr, flags: SockMessageFlags) - } #[repr(C)] -#[derive(Copy, Debug)] +#[derive(Clone, Copy, Debug)] pub struct linger { pub l_onoff: c_int, pub l_linger: c_int diff --git a/src/sys/socket/multicast.rs b/src/sys/socket/multicast.rs index f40de762..1efac40c 100644 --- a/src/sys/socket/multicast.rs +++ b/src/sys/socket/multicast.rs @@ -3,7 +3,7 @@ use libc::in_addr; use std::fmt; #[repr(C)] -#[derive(Copy)] +#[derive(Clone, Copy)] pub struct ip_mreq { pub imr_multiaddr: in_addr, pub imr_interface: in_addr, diff --git a/src/sys/socket/sockopt.rs b/src/sys/socket/sockopt.rs index 0f6e5adc..dc93f085 100644 --- a/src/sys/socket/sockopt.rs +++ b/src/sys/socket/sockopt.rs @@ -22,7 +22,7 @@ macro_rules! sockopt_impl { }; ($name:ident, $flag:path, $get_ty:ty, $getter:ty, $set_ty:ty, $setter:ty) => { - #[derive(Copy, Debug)] + #[derive(Clone, Copy, Debug)] pub struct $name; impl<'a> SockOpt for $name { diff --git a/src/sys/termios.rs b/src/sys/termios.rs index c5758fe0..57612f0b 100644 --- a/src/sys/termios.rs +++ b/src/sys/termios.rs @@ -98,7 +98,7 @@ mod ffi { pub type speed_t = c_ulong; #[repr(C)] - #[derive(Copy)] + #[derive(Clone, Copy)] pub struct Termios { pub c_iflag: InputFlags, pub c_oflag: OutputFlags, @@ -224,7 +224,7 @@ mod ffi { // XXX: We're using `repr(C)` because `c_int` doesn't work here. // See https://github.com/rust-lang/rust/issues/10374. - #[derive(Copy)] + #[derive(Clone, Copy)] #[repr(C)] pub enum SetArg { TCSANOW = 0, @@ -235,7 +235,7 @@ mod ffi { // XXX: We're using `repr(C)` because `c_int` doesn't work here. // See https://github.com/rust-lang/rust/issues/10374. - #[derive(Copy)] + #[derive(Clone, Copy)] #[repr(C)] pub enum FlushArg { TCIFLUSH = 1, @@ -245,7 +245,7 @@ mod ffi { // XXX: We're using `repr(C)` because `c_int` doesn't work here. // See https://github.com/rust-lang/rust/issues/10374. - #[derive(Copy)] + #[derive(Clone, Copy)] #[repr(C)] pub enum FlowArg { TCOOFF = 1, @@ -264,7 +264,7 @@ mod ffi { pub type speed_t = c_uint; #[repr(C)] - #[derive(Copy)] + #[derive(Clone, Copy)] pub struct Termios { pub c_iflag: InputFlags, pub c_oflag: OutputFlags, @@ -378,7 +378,7 @@ mod ffi { // XXX: We're using `repr(C)` because `c_int` doesn't work here. // See https://github.com/rust-lang/rust/issues/10374. - #[derive(Copy)] + #[derive(Clone, Copy)] #[repr(C)] pub enum SetArg { TCSANOW = 0, @@ -388,7 +388,7 @@ mod ffi { // XXX: We're using `repr(C)` because `c_int` doesn't work here. // See https://github.com/rust-lang/rust/issues/10374. - #[derive(Copy)] + #[derive(Clone, Copy)] #[repr(C)] pub enum FlushArg { TCIFLUSH = 0, @@ -398,7 +398,7 @@ mod ffi { // XXX: We're using `repr(C)` because `c_int` doesn't work here. // See https://github.com/rust-lang/rust/issues/10374. - #[derive(Copy)] + #[derive(Clone, Copy)] #[repr(C)] pub enum FlowArg { TCOOFF = 0, diff --git a/src/sys/utsname.rs b/src/sys/utsname.rs index 69683bf6..7eeb323b 100644 --- a/src/sys/utsname.rs +++ b/src/sys/utsname.rs @@ -28,6 +28,9 @@ pub struct UtsName { domainname: [c_char; UTSNAME_LEN] } +// workaround for `derive(Clone)` not working for fixed-length arrays +impl Clone for UtsName { fn clone(&self) -> UtsName { *self } } + impl UtsName { pub fn sysname<'a>(&'a self) -> &'a str { to_str(&(&self.sysname as *const c_char ) as *const *const c_char) diff --git a/src/sys/wait.rs b/src/sys/wait.rs index 6772dd90..a6bccd8a 100644 --- a/src/sys/wait.rs +++ b/src/sys/wait.rs @@ -16,7 +16,7 @@ bitflags!( } ); -#[derive(Copy)] +#[derive(Clone, Copy)] pub enum WaitStatus { Exited(pid_t), StillAlive |