Add epoll_pwait syscall and the test case
1. Use epoll_wait to support epoll_pwait as there is no signal mechanism 2. The timeout is fixed to zero for not waiting for any signal to come to speed up 3. Change the test case of server_epoll to use epoll_pwait
This commit is contained in:
parent
7e311ed6de
commit
b0dfc1d69d
@ -135,6 +135,13 @@ pub extern "C" fn dispatch_syscall(
|
||||
arg2 as c_int,
|
||||
arg3 as c_int,
|
||||
),
|
||||
SYS_EPOLL_PWAIT => do_epoll_pwait(
|
||||
arg0 as c_int,
|
||||
arg1 as *mut libc::epoll_event,
|
||||
arg2 as c_int,
|
||||
arg3 as c_int,
|
||||
arg4 as *const usize, //TODO:add sigset_t
|
||||
),
|
||||
|
||||
// process
|
||||
SYS_EXIT => do_exit(arg0 as i32),
|
||||
@ -1418,6 +1425,18 @@ fn do_epoll_wait(
|
||||
Ok(count as isize)
|
||||
}
|
||||
|
||||
fn do_epoll_pwait(
|
||||
epfd: c_int,
|
||||
events: *mut libc::epoll_event,
|
||||
maxevents: c_int,
|
||||
timeout: c_int,
|
||||
sigmask: *const usize, //TODO:add sigset_t
|
||||
) -> Result<isize> {
|
||||
info!("epoll_pwait");
|
||||
//TODO:add signal support
|
||||
do_epoll_wait(epfd, events, maxevents, 0)
|
||||
}
|
||||
|
||||
fn do_uname(name: *mut utsname_t) -> Result<isize> {
|
||||
check_mut_ptr(name)?;
|
||||
let name = unsafe { &mut *name };
|
||||
|
@ -89,7 +89,7 @@ main(int argc, char *argv[]) {
|
||||
/* The event loop */
|
||||
int done_count = 0;
|
||||
while (done_count < proc_num) {
|
||||
int n = epoll_wait(efd, events, MAXEVENTS, -1);
|
||||
int n = epoll_pwait(efd, events, MAXEVENTS, -1, NULL);
|
||||
for (int i = 0; i < n; i++) {
|
||||
if ((events[i].events & EPOLLERR) ||
|
||||
(events[i].events & EPOLLHUP) ||
|
||||
|
Loading…
Reference in New Issue
Block a user