Skip to content

Commit 7ec5677

Browse files
committed
Replace most Linux man page links with Open Group man page links
But leave in place Linux links for non-standard functions. Also, add brief docs for some functions that were lacking them.
1 parent 9f4db8a commit 7ec5677

File tree

8 files changed

+132
-80
lines changed

8 files changed

+132
-80
lines changed

src/mqueue.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ impl MqAttr {
6363
}
6464

6565

66+
/// Open a message queue
67+
///
68+
/// See also [mq_open(2)](http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_open.html)
6669
pub fn mq_open(name: &CString,
6770
oflag: MQ_OFlag,
6871
mode: Mode,
@@ -80,16 +83,25 @@ pub fn mq_open(name: &CString,
8083
Errno::result(res)
8184
}
8285

86+
/// Remove a message queue
87+
///
88+
/// See also [mq_unlink(2)](http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_unlink.html)
8389
pub fn mq_unlink(name: &CString) -> Result<()> {
8490
let res = unsafe { libc::mq_unlink(name.as_ptr()) };
8591
Errno::result(res).map(drop)
8692
}
8793

94+
/// Close a message queue
95+
///
96+
/// See also [mq_close(2)](http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_close.html)
8897
pub fn mq_close(mqdes: mqd_t) -> Result<()> {
8998
let res = unsafe { libc::mq_close(mqdes) };
9099
Errno::result(res).map(drop)
91100
}
92101

102+
/// Receive a message from a message queue
103+
///
104+
/// See also [mq_receive(2)](http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_receive.html)
93105
pub fn mq_receive(mqdes: mqd_t, message: &mut [u8], msg_prio: &mut u32) -> Result<usize> {
94106
let len = message.len() as size_t;
95107
let res = unsafe {
@@ -101,6 +113,9 @@ pub fn mq_receive(mqdes: mqd_t, message: &mut [u8], msg_prio: &mut u32) -> Resul
101113
Errno::result(res).map(|r| r as usize)
102114
}
103115

116+
/// Send a message to a message queue
117+
///
118+
/// See also [mq_send(2)](http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_send.html)
104119
pub fn mq_send(mqdes: mqd_t, message: &[u8], msq_prio: u32) -> Result<()> {
105120
let res = unsafe {
106121
libc::mq_send(mqdes,
@@ -111,6 +126,9 @@ pub fn mq_send(mqdes: mqd_t, message: &[u8], msq_prio: u32) -> Result<()> {
111126
Errno::result(res).map(drop)
112127
}
113128

129+
/// Get message queue attributes
130+
///
131+
/// See also [mq_getattr(2)](http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_getattr.html)
114132
pub fn mq_getattr(mqd: mqd_t) -> Result<MqAttr> {
115133
let mut attr = unsafe { mem::uninitialized::<libc::mq_attr>() };
116134
let res = unsafe { libc::mq_getattr(mqd, &mut attr) };
@@ -121,7 +139,7 @@ pub fn mq_getattr(mqd: mqd_t) -> Result<MqAttr> {
121139
/// Returns the old attributes
122140
/// It is recommend to use the `mq_set_nonblock()` and `mq_remove_nonblock()` convenience functions as they are easier to use
123141
///
124-
/// [Further reading](http://man7.org/linux/man-pages/man3/mq_setattr.3.html)
142+
/// [Further reading](http://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_setattr.html)
125143
pub fn mq_setattr(mqd: mqd_t, newattr: &MqAttr) -> Result<MqAttr> {
126144
let mut attr = unsafe { mem::uninitialized::<libc::mq_attr>() };
127145
let res = unsafe { libc::mq_setattr(mqd, &newattr.mq_attr as *const libc::mq_attr, &mut attr) };

src/poll.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ libc_bitflags! {
9191
}
9292

9393
/// `poll` waits for one of a set of file descriptors to become ready to perform I/O.
94-
/// ([`poll(2)`](http://man7.org/linux/man-pages/man2/poll.2.html))
94+
/// ([`poll(2)`](http://pubs.opengroup.org/onlinepubs/9699919799/functions/poll.html))
9595
///
9696
/// `fds` contains all [`PollFd`](struct.PollFd.html) to poll.
9797
/// The function will return as soon as any event occur for any of these `PollFd`s.

src/pty.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl Drop for PtyMaster {
6161
}
6262

6363
/// Grant access to a slave pseudoterminal (see
64-
/// [grantpt(3)](http://man7.org/linux/man-pages/man3/grantpt.3.html))
64+
/// [grantpt(3)](http://pubs.opengroup.org/onlinepubs/9699919799/functions/grantpt.html))
6565
///
6666
/// `grantpt()` changes the mode and owner of the slave pseudoterminal device corresponding to the
6767
/// master pseudoterminal referred to by `fd`. This is a necessary step towards opening the slave.
@@ -75,7 +75,7 @@ pub fn grantpt(fd: &PtyMaster) -> Result<()> {
7575
}
7676

7777
/// Open a pseudoterminal device (see
78-
/// [posix_openpt(3)](http://man7.org/linux/man-pages/man3/posix_openpt.3.html))
78+
/// [posix_openpt(3)](http://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_openpt.html))
7979
///
8080
/// `posix_openpt()` returns a file descriptor to an existing unused pseuterminal master device.
8181
///
@@ -176,7 +176,7 @@ pub fn ptsname_r(fd: &PtyMaster) -> Result<String> {
176176
}
177177

178178
/// Unlock a pseudoterminal master/slave pseudoterminal pair (see
179-
/// [unlockpt(3)](http://man7.org/linux/man-pages/man3/unlockpt.3.html))
179+
/// [unlockpt(3)](http://pubs.opengroup.org/onlinepubs/9699919799/functions/unlockpt.html))
180180
///
181181
/// `unlockpt()` unlocks the slave pseudoterminal device corresponding to the master pseudoterminal
182182
/// referred to by `fd`. This must be called before trying to open the slave side of a

src/sys/pthread.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use libc::{self, pthread_t};
33
pub type Pthread = pthread_t;
44

55
/// Obtain ID of the calling thread (see
6-
/// [pthread_self(3)](http://man7.org/linux/man-pages/man3/pthread_self.3.html)
6+
/// [pthread_self(3)](http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_self.html)
77
///
88
/// The thread ID returned by pthread_self() is not the same thing as
99
/// the kernel thread ID returned by a call to gettid(2).

src/sys/select.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl FdSet {
6666
}
6767
}
6868

69-
/// Monitors file descriptors for readiness (see [select(2)]).
69+
/// Monitors file descriptors for readiness
7070
///
7171
/// Returns the total number of ready file descriptors in all sets. The sets are changed so that all
7272
/// file descriptors that are ready for the given operation are set.
@@ -84,7 +84,9 @@ impl FdSet {
8484
/// * `timeout`: Maximum time to wait for descriptors to become ready (`None` to block
8585
/// indefinitely).
8686
///
87-
/// [select(2)]: http://man7.org/linux/man-pages/man2/select.2.html
87+
/// # References
88+
///
89+
/// [select(2)](http://pubs.opengroup.org/onlinepubs/9699919799/functions/select.html)
8890
/// [`FdSet::highest`]: struct.FdSet.html#method.highest
8991
pub fn select<'a, N, R, W, E, T>(nfds: N,
9092
readfds: R,

src/sys/signal.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,8 @@ pub unsafe fn sigaction(signal: Signal, sigaction: &SigAction) -> Result<SigActi
419419
///
420420
/// If both `set` and `oldset` is None, this function is a no-op.
421421
///
422-
/// For more information, visit the [pthread_sigmask](http://man7.org/linux/man-pages/man3/pthread_sigmask.3.html),
423-
/// or [sigprocmask](http://man7.org/linux/man-pages/man2/sigprocmask.2.html) man pages.
422+
/// For more information, visit the [pthread_sigmask](http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_sigmask.html),
423+
/// or [sigprocmask](http://pubs.opengroup.org/onlinepubs/9699919799/functions/sigprocmask.html) man pages.
424424
pub fn pthread_sigmask(how: SigmaskHow,
425425
set: Option<&SigSet>,
426426
oldset: Option<&mut SigSet>) -> Result<()> {

src/sys/socket/mod.rs

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ libc_bitflags!{
165165
/// file descriptor using the `SCM_RIGHTS` operation (described in
166166
/// [unix(7)](https://linux.die.net/man/7/unix)).
167167
/// This flag is useful for the same reasons as the `O_CLOEXEC` flag of
168-
/// [open(2)](https://linux.die.net/man/2/open).
168+
/// [open(2)](http://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html).
169169
///
170170
/// Only used in [`recvmsg`](fn.recvmsg.html) function.
171171
#[cfg(any(target_os = "linux", target_os = "android"))]
@@ -548,7 +548,7 @@ pub fn recvmsg<'a, T>(fd: RawFd, iov: &[IoVec<&mut [u8]>], cmsg_buffer: Option<&
548548
/// protocols may exist, in which case a particular protocol must be
549549
/// specified in this manner.
550550
///
551-
/// [Further reading](http://man7.org/linux/man-pages/man2/socket.2.html)
551+
/// [Further reading](http://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html)
552552
pub fn socket<T: Into<Option<SockProtocol>>>(domain: AddressFamily, ty: SockType, flags: SockFlag, protocol: T) -> Result<RawFd> {
553553
let mut ty = ty as c_int;
554554
let protocol = match protocol.into() {
@@ -590,7 +590,7 @@ pub fn socket<T: Into<Option<SockProtocol>>>(domain: AddressFamily, ty: SockType
590590

591591
/// Create a pair of connected sockets
592592
///
593-
/// [Further reading](http://man7.org/linux/man-pages/man2/socketpair.2.html)
593+
/// [Further reading](http://pubs.opengroup.org/onlinepubs/9699919799/functions/socketpair.html)
594594
pub fn socketpair<T: Into<Option<SockProtocol>>>(domain: AddressFamily, ty: SockType, protocol: T,
595595
flags: SockFlag) -> Result<(RawFd, RawFd)> {
596596
let mut ty = ty as c_int;
@@ -636,7 +636,7 @@ pub fn socketpair<T: Into<Option<SockProtocol>>>(domain: AddressFamily, ty: Sock
636636

637637
/// Listen for connections on a socket
638638
///
639-
/// [Further reading](http://man7.org/linux/man-pages/man2/listen.2.html)
639+
/// [Further reading](http://pubs.opengroup.org/onlinepubs/9699919799/functions/listen.html)
640640
pub fn listen(sockfd: RawFd, backlog: usize) -> Result<()> {
641641
let res = unsafe { libc::listen(sockfd, backlog as c_int) };
642642

@@ -645,7 +645,7 @@ pub fn listen(sockfd: RawFd, backlog: usize) -> Result<()> {
645645

646646
/// Bind a name to a socket
647647
///
648-
/// [Further reading](http://man7.org/linux/man-pages/man2/bind.2.html)
648+
/// [Further reading](http://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html)
649649
#[cfg(not(all(target_os="android", target_pointer_width="64")))]
650650
pub fn bind(fd: RawFd, addr: &SockAddr) -> Result<()> {
651651
let res = unsafe {
@@ -673,7 +673,7 @@ pub fn bind(fd: RawFd, addr: &SockAddr) -> Result<()> {
673673

674674
/// Accept a connection on a socket
675675
///
676-
/// [Further reading](http://man7.org/linux/man-pages/man2/accept.2.html)
676+
/// [Further reading](http://pubs.opengroup.org/onlinepubs/9699919799/functions/accept.html)
677677
pub fn accept(sockfd: RawFd) -> Result<RawFd> {
678678
let res = unsafe { libc::accept(sockfd, ptr::null_mut(), ptr::null_mut()) };
679679

@@ -727,7 +727,7 @@ fn accept4_polyfill(sockfd: RawFd, flags: SockFlag) -> Result<RawFd> {
727727

728728
/// Initiate a connection on a socket
729729
///
730-
/// [Further reading](http://man7.org/linux/man-pages/man2/connect.2.html)
730+
/// [Further reading](http://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html)
731731
pub fn connect(fd: RawFd, addr: &SockAddr) -> Result<()> {
732732
let res = unsafe {
733733
let (ptr, len) = addr.as_ffi_pair();
@@ -740,7 +740,7 @@ pub fn connect(fd: RawFd, addr: &SockAddr) -> Result<()> {
740740
/// Receive data from a connection-oriented socket. Returns the number of
741741
/// bytes read
742742
///
743-
/// [Further reading](http://man7.org/linux/man-pages/man2/recv.2.html)
743+
/// [Further reading](http://pubs.opengroup.org/onlinepubs/9699919799/functions/recv.html)
744744
pub fn recv(sockfd: RawFd, buf: &mut [u8], flags: MsgFlags) -> Result<usize> {
745745
unsafe {
746746
let ret = ffi::recv(
@@ -756,7 +756,7 @@ pub fn recv(sockfd: RawFd, buf: &mut [u8], flags: MsgFlags) -> Result<usize> {
756756
/// Receive data from a connectionless or connection-oriented socket. Returns
757757
/// the number of bytes read and the socket address of the sender.
758758
///
759-
/// [Further reading](http://man7.org/linux/man-pages/man2/recvmsg.2.html)
759+
/// [Further reading](http://pubs.opengroup.org/onlinepubs/9699919799/functions/recvfrom.html)
760760
pub fn recvfrom(sockfd: RawFd, buf: &mut [u8]) -> Result<(usize, SockAddr)> {
761761
unsafe {
762762
let addr: sockaddr_storage = mem::zeroed();
@@ -775,6 +775,9 @@ pub fn recvfrom(sockfd: RawFd, buf: &mut [u8]) -> Result<(usize, SockAddr)> {
775775
}
776776
}
777777

778+
/// Send a message to a socket
779+
///
780+
/// [Further reading](http://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html)
778781
pub fn sendto(fd: RawFd, buf: &[u8], addr: &SockAddr, flags: MsgFlags) -> Result<usize> {
779782
let ret = unsafe {
780783
let (ptr, len) = addr.as_ffi_pair();
@@ -786,7 +789,7 @@ pub fn sendto(fd: RawFd, buf: &[u8], addr: &SockAddr, flags: MsgFlags) -> Result
786789

787790
/// Send data to a connection-oriented socket. Returns the number of bytes read
788791
///
789-
/// [Further reading](http://man7.org/linux/man-pages/man2/send.2.html)
792+
/// [Further reading](http://pubs.opengroup.org/onlinepubs/9699919799/functions/send.html)
790793
pub fn send(fd: RawFd, buf: &[u8], flags: MsgFlags) -> Result<usize> {
791794
let ret = unsafe {
792795
libc::send(fd, buf.as_ptr() as *const c_void, buf.len() as size_t, flags.bits())
@@ -819,7 +822,7 @@ pub struct ucred {
819822
/// The protocol level at which to get / set socket options. Used as an
820823
/// argument to `getsockopt` and `setsockopt`.
821824
///
822-
/// [Further reading](http://man7.org/linux/man-pages/man2/setsockopt.2.html)
825+
/// [Further reading](http://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html)
823826
#[repr(i32)]
824827
pub enum SockLevel {
825828
Socket = libc::SOL_SOCKET,
@@ -851,21 +854,21 @@ pub trait SetSockOpt : Copy {
851854

852855
/// Get the current value for the requested socket option
853856
///
854-
/// [Further reading](http://man7.org/linux/man-pages/man2/getsockopt.2.html)
857+
/// [Further reading](http://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html)
855858
pub fn getsockopt<O: GetSockOpt>(fd: RawFd, opt: O) -> Result<O::Val> {
856859
opt.get(fd)
857860
}
858861

859862
/// Sets the value for the requested socket option
860863
///
861-
/// [Further reading](http://man7.org/linux/man-pages/man2/setsockopt.2.html)
864+
/// [Further reading](http://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html)
862865
pub fn setsockopt<O: SetSockOpt>(fd: RawFd, opt: O, val: &O::Val) -> Result<()> {
863866
opt.set(fd, val)
864867
}
865868

866869
/// Get the address of the peer connected to the socket `fd`.
867870
///
868-
/// [Further reading](http://man7.org/linux/man-pages/man2/getpeername.2.html)
871+
/// [Further reading](http://pubs.opengroup.org/onlinepubs/9699919799/functions/getpeername.html)
869872
pub fn getpeername(fd: RawFd) -> Result<SockAddr> {
870873
unsafe {
871874
let addr: sockaddr_storage = mem::uninitialized();
@@ -881,7 +884,7 @@ pub fn getpeername(fd: RawFd) -> Result<SockAddr> {
881884

882885
/// Get the current address to which the socket `fd` is bound.
883886
///
884-
/// [Further reading](http://man7.org/linux/man-pages/man2/getsockname.2.html)
887+
/// [Further reading](http://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockname.html)
885888
pub fn getsockname(fd: RawFd) -> Result<SockAddr> {
886889
unsafe {
887890
let addr: sockaddr_storage = mem::uninitialized();
@@ -946,7 +949,7 @@ pub enum Shutdown {
946949

947950
/// Shut down part of a full-duplex connection.
948951
///
949-
/// [Further reading](http://man7.org/linux/man-pages/man2/shutdown.2.html)
952+
/// [Further reading](http://pubs.opengroup.org/onlinepubs/9699919799/functions/shutdown.html)
950953
pub fn shutdown(df: RawFd, how: Shutdown) -> Result<()> {
951954
unsafe {
952955
use libc::shutdown;

0 commit comments

Comments
 (0)