Skip to content

Commit 6f7f9e3

Browse files
n-salimbpangWR
authored andcommitted
VxWorks socket and epoll definitions needed by mio and related crates
1 parent d737592 commit 6f7f9e3

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

src/vxworks/mod.rs

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,22 @@ s! {
187187
pub iov_len: ::size_t,
188188
}
189189

190+
pub struct msghdr {
191+
pub msg_name: *mut c_void,
192+
pub msg_namelen: socklen_t,
193+
pub msg_iov: *mut iovec,
194+
pub msg_iovlen: ::c_int,
195+
pub msg_control: *mut c_void,
196+
pub msg_controllen: socklen_t,
197+
pub msg_flags: ::c_int,
198+
}
199+
200+
pub struct cmsghdr {
201+
pub cmsg_len: socklen_t,
202+
pub cmsg_level: ::c_int,
203+
pub cmsg_type: ::c_int,
204+
}
205+
190206
// poll.h
191207
pub struct pollfd {
192208
pub fd : ::c_int,
@@ -438,6 +454,13 @@ s! {
438454
pub pw_shell: *mut ::c_char,
439455
}
440456

457+
// epoll.h
458+
459+
pub struct epoll_event {
460+
pub events: u32,
461+
pub u64: u64,
462+
}
463+
441464
// rtpLibCommon.h
442465
pub struct RTP_DESC {
443466
pub status : ::c_int,
@@ -805,6 +828,21 @@ pub const FIOSQUEEZE: ::c_int = 15;
805828
pub const FIONBIO: ::c_int = 16;
806829
pub const _POSIX_PATH_MAX: ::c_int = 256;
807830

831+
// epoll.h
832+
pub const EPOLLIN: ::c_int = 0x1;
833+
pub const EPOLLPRI: ::c_int = 0x2;
834+
pub const EPOLLOUT: ::c_int = 0x4;
835+
pub const EPOLLERR: ::c_int = 0x8;
836+
pub const EPOLLHUP: ::c_int = 0x10;
837+
pub const EPOLLRDHUP: ::c_int = 0x2000;
838+
pub const EPOLLONESHOT: ::c_int = 1 << 30;
839+
pub const EPOLLET: ::c_int = 1 << 31;
840+
841+
842+
pub const EPOLL_CTL_ADD: ::c_int = 1;
843+
pub const EPOLL_CTL_DEL: ::c_int = 2;
844+
pub const EPOLL_CTL_MOD: ::c_int = 3;
845+
808846
// Some poll stuff
809847
pub const POLLIN: ::c_short = 0x0001;
810848
pub const POLLPRI: ::c_short = 0x0002;
@@ -1743,6 +1781,12 @@ extern "C" {
17431781
pFromLen: *mut ::socklen_t,
17441782
) -> ::ssize_t;
17451783

1784+
pub fn recvmsg(
1785+
socket: ::c_int,
1786+
mp: *mut ::msghdr,
1787+
flags: ::c_int,
1788+
) -> ::ssize_t;
1789+
17461790
// socket.h
17471791
pub fn send(
17481792
socket: ::c_int,
@@ -1751,6 +1795,12 @@ extern "C" {
17511795
flags: ::c_int,
17521796
) -> ::ssize_t;
17531797

1798+
pub fn sendmsg(
1799+
socket: ::c_int,
1800+
mp: *const ::msghdr,
1801+
flags: ::c_int,
1802+
) -> ::ssize_t;
1803+
17541804
// socket.h
17551805
pub fn sendto(
17561806
socket: ::c_int,
@@ -2054,6 +2104,30 @@ extern "C" {
20542104
iovcnt: ::c_int,
20552105
) -> ::ssize_t;
20562106

2107+
// epoll.h
2108+
pub fn epoll_create(size: ::c_int) -> ::c_int;
2109+
pub fn epoll_create1(flags: ::c_int) -> ::c_int;
2110+
2111+
pub fn epoll_ctl(
2112+
epfd: ::c_int,
2113+
op: ::c_int,
2114+
fd: ::c_int,
2115+
event: *mut ::epoll_event
2116+
) -> ::c_int;
2117+
2118+
pub fn epoll_create_and_ctl(
2119+
num: ::c_int,
2120+
fds: *mut ::c_int,
2121+
event: *mut ::epoll_event
2122+
) -> ::c_int;
2123+
2124+
pub fn epoll_wait(
2125+
epfd: ::c_int,
2126+
events: *mut ::epoll_event,
2127+
maxevents: ::c_int,
2128+
timeout: ::c_int
2129+
) -> ::c_int;
2130+
20572131
// randomNumGen.h
20582132
pub fn randBytes(buf: *mut c_uchar, length: c_int) -> c_int;
20592133
pub fn randABytes(buf: *mut c_uchar, length: c_int) -> c_int;

0 commit comments

Comments
 (0)