1 year ago
#376351
varta
Use libuv to act on a module poll
I wrote a Linux module with a .poll and want to use libuv to read the signal.
This is in the poll function called by file_operations
unsigned int mask = 0;
poll_wait (file, &read_waitq, wait );
if (convert_finish_flag)
mask |= POLLIN | POLLRDNORM;
return mask;
Currently I am using a simple epoll user client to catch the signal, which works fine. But code wise it would be nicer to use libuv. Because I also use ReactPHP with EventLoops.
These are the most relevant lines in the user client.
fd = open(filename, O_RDWR | O_NONBLOCK);
ev.events = ( EPOLLIN | EPOLLET );
epoll_ctl( epoll_fd, EPOLL_CTL_ADD, fd, &ev )
epoll_wait( epoll_fd, events, MAX_EVENTS, -1 );
I tried several examples from the php_uv project like fs_poll.php, calling touch /dev/my_driver
does work. But it does not respond to a poll from the module.
Can somebody confirm this could work? Seems like it should be possible, but it's difficult for me to debug libuv/php-uv or am I missing something else?
polling
libuv
reactphp
0 Answers
Your Answer