summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryant Mairs <bryantmairs@google.com>2018-01-14 09:58:24 -0800
committerBryant Mairs <bryantmairs@google.com>2018-01-28 15:35:35 -0800
commit5db605ad599a56ed79969b929732fabf03374ae1 (patch)
tree24ad3fd11ec1c2be8849296174d5519ff3679394
parent04b0978c25d323c59d687e0ded1814b19ae7c6eb (diff)
downloadnix-5db605ad599a56ed79969b929732fabf03374ae1.zip
Implement Copy/Clone for all types missing it
-rw-r--r--src/fcntl.rs1
-rw-r--r--src/lib.rs1
-rw-r--r--src/pty.rs1
-rw-r--r--src/sys/select.rs1
-rw-r--r--src/sys/signal.rs3
-rw-r--r--src/sys/socket/addr.rs2
-rw-r--r--src/sys/statvfs.rs1
-rw-r--r--src/sys/uio.rs1
-rw-r--r--src/unistd.rs1
9 files changed, 11 insertions, 1 deletions
diff --git a/src/fcntl.rs b/src/fcntl.rs
index a42a2201..e5263627 100644
--- a/src/fcntl.rs
+++ b/src/fcntl.rs
@@ -267,6 +267,7 @@ pub fn fcntl(fd: RawFd, arg: FcntlArg) -> Result<c_int> {
Errno::result(res)
}
+#[derive(Clone, Copy)]
pub enum FlockArg {
LockShared,
LockExclusive,
diff --git a/src/lib.rs b/src/lib.rs
index 445d9386..f0510bd3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -13,6 +13,7 @@
#![deny(unused_qualifications)]
#![deny(unstable_features)]
#![deny(unused_import_braces)]
+#![deny(missing_copy_implementations)]
extern crate bytes;
#[macro_use]
diff --git a/src/pty.rs b/src/pty.rs
index ea0e543d..07afba33 100644
--- a/src/pty.rs
+++ b/src/pty.rs
@@ -17,6 +17,7 @@ use errno::Errno;
///
/// This is returned by `openpty`. Note that this type does *not* implement `Drop`, so the user
/// must manually close the file descriptors.
+#[derive(Clone, Copy)]
pub struct OpenptyResult {
pub master: RawFd,
pub slave: RawFd,
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<usize>{
/// 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,
diff --git a/src/unistd.rs b/src/unistd.rs
index e1a2b61e..2c2d7c66 100644
--- a/src/unistd.rs
+++ b/src/unistd.rs
@@ -822,6 +822,7 @@ pub fn write(fd: RawFd, buf: &[u8]) -> Result<usize> {
/// [`lseek`]: ./fn.lseek.html
/// [`lseek64`]: ./fn.lseek64.html
#[repr(i32)]
+#[derive(Clone, Copy)]
pub enum Whence {
/// Specify an offset relative to the start of the file.
SeekSet = libc::SEEK_SET,