mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
picoev: fix the incompatible pointer type cast error in the C.epoll_wait call (#22785)
This commit is contained in:
parent
dab25cad49
commit
31d6c473da
1 changed files with 6 additions and 7 deletions
|
@ -6,12 +6,12 @@ $if !musl ? {
|
||||||
#include <sys/cdefs.h> // needed for cross compiling to linux
|
#include <sys/cdefs.h> // needed for cross compiling to linux
|
||||||
}
|
}
|
||||||
|
|
||||||
fn C.epoll_create(int) int
|
fn C.epoll_create(__flags int) int
|
||||||
fn C.epoll_wait(int, voidptr, int, int) int
|
fn C.epoll_wait(__epfd int, __events &C.epoll_event, __maxevents int, __timeout int) int
|
||||||
fn C.epoll_ctl(int, int, int, voidptr) int
|
fn C.epoll_ctl(__epfd int, __op int, __fd int, __event &C.epoll_event) int
|
||||||
|
|
||||||
@[typedef]
|
@[typedef]
|
||||||
pub union C.epoll_data_t {
|
union C.epoll_data {
|
||||||
mut:
|
mut:
|
||||||
ptr voidptr
|
ptr voidptr
|
||||||
fd int
|
fd int
|
||||||
|
@ -21,9 +21,8 @@ mut:
|
||||||
|
|
||||||
@[packed]
|
@[packed]
|
||||||
pub struct C.epoll_event {
|
pub struct C.epoll_event {
|
||||||
mut:
|
|
||||||
events u32
|
events u32
|
||||||
data C.epoll_data_t
|
data C.epoll_data
|
||||||
}
|
}
|
||||||
|
|
||||||
@[heap]
|
@[heap]
|
||||||
|
@ -106,7 +105,7 @@ fn (mut pv Picoev) update_events(fd int, events int) int {
|
||||||
|
|
||||||
@[direct_array_access]
|
@[direct_array_access]
|
||||||
fn (mut pv Picoev) poll_once(max_wait_in_sec int) int {
|
fn (mut pv Picoev) poll_once(max_wait_in_sec int) int {
|
||||||
nevents := C.epoll_wait(pv.loop.epoll_fd, &pv.loop.events, max_fds, max_wait_in_sec * 1000)
|
nevents := C.epoll_wait(pv.loop.epoll_fd, &pv.loop.events[0], max_fds, max_wait_in_sec * 1000)
|
||||||
|
|
||||||
if nevents == -1 {
|
if nevents == -1 {
|
||||||
// timeout has occurred
|
// timeout has occurred
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue