Skip to content

Commit 1e80d93

Browse files
committed
Auto merge of #896 - cneira:master, r=alexcrichton
added EPOLL(5) for Illumos (Solaris fork) EPOLL(5) is being used in crates like mio and iovec , this change allows those crates and other that depends on EPOLL(5) to be built in illumos systems.
2 parents 16a0f4a + c6bb76a commit 1e80d93

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

libc-test/build.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ fn main() {
216216
cfg.header("sys/reg.h");
217217
}
218218
}
219-
219+
220220
if linux || android || emscripten {
221221
cfg.header("malloc.h");
222222
cfg.header("net/ethernet.h");
@@ -251,6 +251,9 @@ fn main() {
251251
}
252252
}
253253
}
254+
if solaris {
255+
cfg.header("sys/epoll.h");
256+
}
254257

255258
if linux || android {
256259
cfg.header("sys/fsuid.h");

src/unix/solaris/mod.rs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,11 @@ s! {
353353
pub portev_object: ::uintptr_t,
354354
pub portev_user: *mut ::c_void,
355355
}
356+
357+
pub struct epoll_event {
358+
pub events: ::uint32_t,
359+
pub u64: ::uint64_t,
360+
}
356361
}
357362

358363
pub const LC_CTYPE: ::c_int = 0;
@@ -1127,6 +1132,9 @@ pub const NCCS: usize = 19;
11271132

11281133
pub const LOG_CRON: ::c_int = 15 << 3;
11291134

1135+
pub const SYS_epoll_create: ::c_long = 213;
1136+
pub const SYS_epoll_create1: ::c_long = 291;
1137+
11301138
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
11311139
__pthread_mutex_flag1: 0,
11321140
__pthread_mutex_flag2: 0,
@@ -1182,6 +1190,25 @@ pub const PORT_SOURCE_FILE: ::c_int = 7;
11821190
pub const PORT_SOURCE_POSTWAIT: ::c_int = 8;
11831191
pub const PORT_SOURCE_SIGNAL: ::c_int = 9;
11841192

1193+
pub const EPOLLIN: ::c_int = 0x1;
1194+
pub const EPOLLPRI: ::c_int = 0x2;
1195+
pub const EPOLLOUT: ::c_int = 0x4;
1196+
pub const EPOLLRDNORM: ::c_int = 0x40;
1197+
pub const EPOLLRDBAND: ::c_int = 0x80;
1198+
pub const EPOLLWRNORM: ::c_int = 0x100;
1199+
pub const EPOLLWRBAND: ::c_int = 0x200;
1200+
pub const EPOLLMSG: ::c_int = 0x400;
1201+
pub const EPOLLERR: ::c_int = 0x8;
1202+
pub const EPOLLHUP: ::c_int = 0x10;
1203+
pub const EPOLLET: ::c_int = 0x80000000;
1204+
pub const EPOLLRDHUP: ::c_int = 0x2000;
1205+
pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000;
1206+
pub const EPOLLONESHOT: ::c_int = 0x40000000;
1207+
pub const EPOLL_CLOEXEC: ::c_int = 0x02000000;
1208+
pub const EPOLL_CTL_ADD: ::c_int = 1;
1209+
pub const EPOLL_CTL_MOD: ::c_int = 3;
1210+
pub const EPOLL_CTL_DEL: ::c_int = 2;
1211+
11851212
f! {
11861213
pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
11871214
let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8;
@@ -1361,6 +1388,23 @@ extern {
13611388
oss: *mut stack_t) -> ::c_int;
13621389
pub fn sem_close(sem: *mut sem_t) -> ::c_int;
13631390
pub fn getdtablesize() -> ::c_int;
1391+
1392+
pub fn epoll_pwait(epfd: ::c_int,
1393+
events: *mut ::epoll_event,
1394+
maxevents: ::c_int,
1395+
timeout: ::c_int,
1396+
sigmask: *const ::sigset_t) -> ::c_int;
1397+
pub fn epoll_create(size: ::c_int) -> ::c_int;
1398+
pub fn epoll_create1(flags: ::c_int) -> ::c_int;
1399+
pub fn epoll_wait(epfd: ::c_int,
1400+
events: *mut ::epoll_event,
1401+
maxevents: ::c_int,
1402+
timeout: ::c_int) -> ::c_int;
1403+
pub fn epoll_ctl(epfd: ::c_int,
1404+
op: ::c_int,
1405+
fd: ::c_int,
1406+
event: *mut ::epoll_event) -> ::c_int;
1407+
13641408
#[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")]
13651409
pub fn getgrnam_r(name: *const ::c_char,
13661410
grp: *mut ::group,

0 commit comments

Comments
 (0)