Skip to content

Commit 31d6c47

Browse files
authored
picoev: fix the incompatible pointer type cast error in the C.epoll_wait call (#22785)
1 parent dab25ca commit 31d6c47

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

vlib/picoev/loop_linux.c.v

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ $if !musl ? {
66
#include <sys/cdefs.h> // needed for cross compiling to linux
77
}
88

9-
fn C.epoll_create(int) int
10-
fn C.epoll_wait(int, voidptr, int, int) int
11-
fn C.epoll_ctl(int, int, int, voidptr) int
9+
fn C.epoll_create(__flags int) int
10+
fn C.epoll_wait(__epfd int, __events &C.epoll_event, __maxevents int, __timeout int) int
11+
fn C.epoll_ctl(__epfd int, __op int, __fd int, __event &C.epoll_event) int
1212

1313
@[typedef]
14-
pub union C.epoll_data_t {
14+
union C.epoll_data {
1515
mut:
1616
ptr voidptr
1717
fd int
@@ -21,9 +21,8 @@ mut:
2121

2222
@[packed]
2323
pub struct C.epoll_event {
24-
mut:
2524
events u32
26-
data C.epoll_data_t
25+
data C.epoll_data
2726
}
2827

2928
@[heap]
@@ -106,7 +105,7 @@ fn (mut pv Picoev) update_events(fd int, events int) int {
106105

107106
@[direct_array_access]
108107
fn (mut pv Picoev) poll_once(max_wait_in_sec int) int {
109-
nevents := C.epoll_wait(pv.loop.epoll_fd, &pv.loop.events, max_fds, max_wait_in_sec * 1000)
108+
nevents := C.epoll_wait(pv.loop.epoll_fd, &pv.loop.events[0], max_fds, max_wait_in_sec * 1000)
110109

111110
if nevents == -1 {
112111
// timeout has occurred

0 commit comments

Comments
 (0)