Skip to content

Commit 55c58c9

Browse files
jackpot51tgross35
authored andcommitted
Add more redox sys/socket.h and sys/uio.h definitions
(backport <#4388>) (cherry picked from commit a27b5a6)
1 parent 08f8414 commit 55c58c9

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

src/unix/redox/mod.rs

+44
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,22 @@ s! {
131131
pub thousands_sep: *const c_char,
132132
}
133133

134+
pub struct msghdr {
135+
pub msg_name: *mut c_void,
136+
pub msg_namelen: crate::socklen_t,
137+
pub msg_iov: *mut crate::iovec,
138+
pub msg_iovlen: size_t,
139+
pub msg_control: *mut c_void,
140+
pub msg_controllen: size_t,
141+
pub msg_flags: c_int,
142+
}
143+
144+
pub struct cmsghdr {
145+
pub cmsg_len: size_t,
146+
pub cmsg_level: c_int,
147+
pub cmsg_type: c_int,
148+
}
149+
134150
pub struct passwd {
135151
pub pw_name: *mut c_char,
136152
pub pw_passwd: *mut c_char,
@@ -1212,6 +1228,12 @@ extern "C" {
12121228
pub fn setrlimit(resource: c_int, rlim: *const crate::rlimit) -> c_int;
12131229

12141230
// sys/socket.h
1231+
pub fn CMSG_ALIGN(len: size_t) -> size_t;
1232+
pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar;
1233+
pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr;
1234+
pub fn CMSG_LEN(len: c_uint) -> c_uint;
1235+
pub fn CMSG_NXTHDR(mhdr: *const msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr;
1236+
pub fn CMSG_SPACE(len: c_uint) -> c_uint;
12151237
pub fn bind(
12161238
socket: c_int,
12171239
address: *const crate::sockaddr,
@@ -1225,11 +1247,33 @@ extern "C" {
12251247
addr: *mut crate::sockaddr,
12261248
addrlen: *mut crate::socklen_t,
12271249
) -> ssize_t;
1250+
pub fn recvmsg(socket: c_int, msg: *mut msghdr, flags: c_int) -> ssize_t;
1251+
pub fn sendmsg(socket: c_int, msg: *const msghdr, flags: c_int) -> ssize_t;
1252+
pub fn sendto(
1253+
socket: c_int,
1254+
buf: *const c_void,
1255+
len: size_t,
1256+
flags: c_int,
1257+
addr: *const crate::sockaddr,
1258+
addrlen: crate::socklen_t,
1259+
) -> ssize_t;
12281260

12291261
// sys/stat.h
12301262
pub fn futimens(fd: c_int, times: *const crate::timespec) -> c_int;
12311263

12321264
// sys/uio.h
1265+
pub fn preadv(
1266+
fd: c_int,
1267+
iov: *const crate::iovec,
1268+
iovcnt: c_int,
1269+
offset: off_t,
1270+
) -> ssize_t;
1271+
pub fn pwritev(
1272+
fd: c_int,
1273+
iov: *const crate::iovec,
1274+
iovcnt: c_int,
1275+
offset: off_t,
1276+
) -> ssize_t;
12331277
pub fn readv(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t;
12341278
pub fn writev(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t;
12351279

0 commit comments

Comments
 (0)