Add SCML for `poll` and `select`

This commit is contained in:
Tao Su 2025-12-10 11:19:04 +00:00 committed by Tate, Hongliang Tian
parent 273bf7306a
commit 05c43dd6c5
4 changed files with 29 additions and 5 deletions

View File

@ -27,7 +27,7 @@ which are summarized in the table below.
| 4 | stat | ✅ | 💯 |
| 5 | fstat | ✅ | 💯 |
| 6 | lstat | ✅ | 💯 |
| 7 | poll | ✅ | 💯 |
| 7 | poll | ✅ | [⚠️](syscall-flag-coverage/file-descriptor-and-io-control/#poll) |
| 8 | lseek | ✅ | [⚠️](syscall-flag-coverage/file-and-directory-operations/#lseek) |
| 9 | mmap | ✅ | [⚠️](syscall-flag-coverage/memory-management/#mmap-and-munmap) |
| 10 | mprotect | ✅ | [⚠️](syscall-flag-coverage/memory-management/#mprotect) |
@ -43,7 +43,7 @@ which are summarized in the table below.
| 20 | writev | ✅ | 💯 |
| 21 | access | ✅ | 💯 |
| 22 | pipe | ✅ | 💯 |
| 23 | select | ✅ | |
| 23 | select | ✅ | 💯 |
| 24 | sched_yield | ✅ | 💯 |
| 25 | mremap | ✅ | [⚠️](syscall-flag-coverage/memory-management/#mremap) |
| 26 | msync | ✅ | [⚠️](syscall-flag-coverage/memory-management/#msync) |

View File

@ -100,3 +100,19 @@ Unsupported flags in events:
For more information,
see [the man page](https://man7.org/linux/man-pages/man2/epoll_ctl.2.html).
### `poll`
Supported functionality in SCML:
```c
{{#include poll.scml}}
```
Unsupported events:
* `POLLRDBAND`
* `POLLWRNORM`
* `POLLWRBAND`
For more information,
see [the man page](https://man7.org/linux/man-pages/man2/poll.2.html).

View File

@ -6,9 +6,6 @@ dup3(oldfd, newfd, flags);
// Monitor multiplexed I/O with signal safety and precise timeout handling
pselect6(nfds, readfds, writefds, exceptfds, timeout, sigmask);
// Wait for some event on a file descriptor
poll(fds, nfds, timeout);
// Transfer data between file descriptors
sendfile(out_fd, in_fd, offset, count);
@ -28,3 +25,6 @@ signalfd4(fd, mask, sizemask, flags = SFD_NONBLOCK | SFD_CLOEXEC);
epoll_wait(epfd, events, maxevents, timeout);
epoll_pwait(epfd, events, maxevents, timeout, sigmask);
epoll_pwait2(epfd, events, maxevents, timeout, sigmask);
// Wait for I/O event on the file descriptors set in read, write or except bitmaps
select(nfds, readfds, writefds, exceptfds, timeout);

View File

@ -0,0 +1,8 @@
struct pollfd = {
events = POLLIN | POLLPRI | POLLOUT | POLLRDHUP | POLLERR |
POLLHUP | POLLNVAL | POLLRDNORM,
..
};
// Wait for I/O event on a set of file descriptors
poll(fds = [ <pollfd> ], nfds, timeout);