diff options
-rw-r--r-- | src/features.rs | 12 | ||||
-rw-r--r-- | src/mqueue.rs | 8 | ||||
-rw-r--r-- | src/sys/ptrace.rs | 2 | ||||
-rw-r--r-- | src/sys/socket/addr.rs | 4 | ||||
-rw-r--r-- | src/unistd.rs | 2 |
5 files changed, 14 insertions, 14 deletions
diff --git a/src/features.rs b/src/features.rs index e6c5612d..1448fdd0 100644 --- a/src/features.rs +++ b/src/features.rs @@ -15,15 +15,15 @@ mod os { static VERS_2_6_28: usize = 4; static VERS_3: usize = 5; + #[inline] + fn digit(dst: &mut usize, b: u8) { + *dst *= 10; + *dst += (b - b'0') as usize; + } + fn parse_kernel_version() -> usize { let u = uname(); - #[inline] - fn digit(dst: &mut usize, b: u8) { - *dst *= 10; - *dst += (b - b'0') as usize; - } - let mut curr: usize = 0; let mut major: usize = 0; let mut minor: usize = 0; diff --git a/src/mqueue.rs b/src/mqueue.rs index 5539f777..b8a2250e 100644 --- a/src/mqueue.rs +++ b/src/mqueue.rs @@ -114,9 +114,9 @@ pub fn mq_getattr(mqd: MQd) -> Result<MqAttr> { Ok(attr) } -/// Set the attributes of the message queue. Only O_NONBLOCK can be set, everything else will be ignored +/// Set the attributes of the message queue. Only `O_NONBLOCK` can be set, everything else will be ignored /// Returns the old attributes -/// It is recommend to use the mq_set_nonblock() and mq_remove_nonblock() convenience functions as they are easier to use +/// It is recommend to use the `mq_set_nonblock()` and `mq_remove_nonblock()` convenience functions as they are easier to use /// /// [Further reading](http://man7.org/linux/man-pages/man3/mq_setattr.3.html) pub fn mq_setattr(mqd: MQd, newattr: &MqAttr) -> Result<MqAttr> { @@ -127,7 +127,7 @@ pub fn mq_setattr(mqd: MQd, newattr: &MqAttr) -> Result<MqAttr> { } /// Convenience function. -/// Sets the O_NONBLOCK attribute for a given message queue descriptor +/// Sets the `O_NONBLOCK` attribute for a given message queue descriptor /// Returns the old attributes pub fn mq_set_nonblock(mqd: MQd) -> Result<(MqAttr)> { let oldattr = try!(mq_getattr(mqd)); @@ -136,7 +136,7 @@ pub fn mq_set_nonblock(mqd: MQd) -> Result<(MqAttr)> { } /// Convenience function. -/// Removes O_NONBLOCK attribute for a given message queue descriptor +/// Removes `O_NONBLOCK` attribute for a given message queue descriptor /// Returns the old attributes pub fn mq_remove_nonblock(mqd: MQd) -> Result<(MqAttr)> { let oldattr = try!(mq_getattr(mqd)); diff --git a/src/sys/ptrace.rs b/src/sys/ptrace.rs index 63c7482d..edbc9734 100644 --- a/src/sys/ptrace.rs +++ b/src/sys/ptrace.rs @@ -95,7 +95,7 @@ fn ptrace_other(request: ptrace::PtraceRequest, pid: pid_t, addr: *mut c_void, d Errno::result(unsafe { ffi::ptrace(request, pid, addr, data) }).map(|_| 0) } -/// Set options, as with ptrace(PTRACE_SETOPTIONS,...). +/// Set options, as with `ptrace(PTRACE_SETOPTIONS,...)`. pub fn ptrace_setoptions(pid: pid_t, options: ptrace::PtraceOptions) -> Result<()> { use self::ptrace::*; use std::ptr; diff --git a/src/sys/socket/addr.rs b/src/sys/socket/addr.rs index 4854517f..22970d8b 100644 --- a/src/sys/socket/addr.rs +++ b/src/sys/socket/addr.rs @@ -348,10 +348,10 @@ impl fmt::Display for Ipv6Addr { * */ -/// A wrapper around sockaddr_un. We track the length of sun_path, +/// A wrapper around `sockaddr_un`. We track the length of `sun_path`, /// because it may not be null-terminated (unconnected and abstract /// sockets). Note that the actual sockaddr length is greater by -/// size_of::<sa_family_t>(). +/// `size_of::<sa_family_t>()`. #[derive(Copy)] pub struct UnixAddr(pub libc::sockaddr_un, pub usize); diff --git a/src/unistd.rs b/src/unistd.rs index 4a7359cc..eb138528 100644 --- a/src/unistd.rs +++ b/src/unistd.rs @@ -255,7 +255,7 @@ fn pipe2_setflags(fd1: RawFd, fd2: RawFd, flags: OFlag) -> Result<()> { Err(e) => { let _ = close(fd1); let _ = close(fd2); - return Err(e); + Err(e) } } } |