From 5db605ad599a56ed79969b929732fabf03374ae1 Mon Sep 17 00:00:00 2001 From: Bryant Mairs Date: Sun, 14 Jan 2018 09:58:24 -0800 Subject: Implement Copy/Clone for all types missing it --- src/sys/select.rs | 1 + src/sys/signal.rs | 3 +++ src/sys/socket/addr.rs | 2 +- src/sys/statvfs.rs | 1 + src/sys/uio.rs | 1 + 5 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src/sys') diff --git a/src/sys/select.rs b/src/sys/select.rs index 5b88c997..aece239c 100644 --- a/src/sys/select.rs +++ b/src/sys/select.rs @@ -10,6 +10,7 @@ pub use libc::FD_SETSIZE; // FIXME: Change to repr(transparent) once it's stable #[repr(C)] +#[derive(Clone, Copy)] pub struct FdSet(libc::fd_set); impl FdSet { diff --git a/src/sys/signal.rs b/src/sys/signal.rs index f533b1b2..fbd3e2d1 100644 --- a/src/sys/signal.rs +++ b/src/sys/signal.rs @@ -163,6 +163,7 @@ const SIGNALS: [Signal; 31] = [ pub const NSIG: libc::c_int = 32; +#[derive(Clone, Copy)] pub struct SignalIterator { next: usize, } @@ -359,6 +360,7 @@ pub enum SigHandler { SigAction(extern fn(libc::c_int, *mut libc::siginfo_t, *mut libc::c_void)) } +#[derive(Clone, Copy)] pub struct SigAction { sigaction: libc::sigaction } @@ -528,6 +530,7 @@ mod sigevent { /// Used to request asynchronous notification of the completion of certain /// events, such as POSIX AIO and timers. #[repr(C)] + #[derive(Clone, Copy)] pub struct SigEvent { sigevent: libc::sigevent } diff --git a/src/sys/socket/addr.rs b/src/sys/socket/addr.rs index af8db15a..6b3438a6 100644 --- a/src/sys/socket/addr.rs +++ b/src/sys/socket/addr.rs @@ -392,7 +392,7 @@ impl fmt::Debug for InetAddr { * ===== IpAddr ===== * */ - +#[derive(Clone, Copy)] pub enum IpAddr { V4(Ipv4Addr), V6(Ipv6Addr), diff --git a/src/sys/statvfs.rs b/src/sys/statvfs.rs index e4b00b37..dc7327d9 100644 --- a/src/sys/statvfs.rs +++ b/src/sys/statvfs.rs @@ -57,6 +57,7 @@ libc_bitflags!( /// For more information see the [`statvfs(3)` man pages](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_statvfs.h.html). // FIXME: Replace with repr(transparent) #[repr(C)] +#[derive(Clone, Copy)] pub struct Statvfs(libc::statvfs); impl Statvfs { diff --git a/src/sys/uio.rs b/src/sys/uio.rs index 7447f3ff..00ba1050 100644 --- a/src/sys/uio.rs +++ b/src/sys/uio.rs @@ -67,6 +67,7 @@ pub fn pread(fd: RawFd, buf: &mut [u8], offset: off_t) -> Result{ /// and [`process_vm_writev`](fn.process_vm_writev.html). #[cfg(target_os = "linux")] #[repr(C)] +#[derive(Clone, Copy)] pub struct RemoteIoVec { /// The starting address of this slice (`iov_base`). pub base: usize, -- cgit v1.2.3