|
XenevaOS
|
#include <Sync/poll.h>#include <bordoisila_ptr.h>#include <Log/klog.h>#include <Log/_print.h>#include <Hal/AA64/sched.h>#include <timer.h>#include <Fs/vfs.h>#include <process.h>#include <Drivers/uart.h>#include <_null.h>#include <Mm/kmalloc.h>#include <fixup.h>
Macros | |
| #define | POLL_MAX_FD_MONITOR 1024 |
Functions | |
| AuVFSNode * | AuPollGetFile (AA64Thread *thr, int fd) |
| void | AuPollWait (AuWaitQueue *q, AuPollTable *pt) |
| AuPollWait – helper function to create a wait queue. | |
| int | AuPoll (_AuUser_PollFD fds[], nfds_t num_fd, int timeout) |
| AuPoll – poll system call. | |
| #define POLL_MAX_FD_MONITOR 1024 |
BSD 2-Clause License
Copyright (c) 2022 - 2026, Manas Kamal Choudhury All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
| int AuPoll | ( | _AuUser_PollFD | fds[], |
| nfds_t | num_fd, | ||
| int | timeout | ||
| ) |
AuPoll – poll system call.
| fds | – Pointer to file descriptor array |
| num_fd | – number of file descriptor to monitor |
| timeout | – timeout in millisecond |
copy it from user
check all file descriptors
the poll system call suggest that it revent should have POLLERR | POLLHUP | POLLNVAL present
check for timeout value , 0 means non-blocking and non sleeping, -1 means forever
we should also check for signal, but skipping for now
| AuVFSNode * AuPollGetFile | ( | AA64Thread * | thr, |
| int | fd | ||
| ) |
| void AuPollWait | ( | AuWaitQueue * | q, |
| AuPollTable * | pt | ||
| ) |
AuPollWait – helper function to create a wait queue.
| q | – Pointer to queue |
| pt | – Pointer to PollTable |