![]() |
posix-next API 0.1.0
Out-of-tree Zephyr POSIX module
|
POSIX Device Input and Output option group. More...
Files | |
| file | poll.h |
| POSIX poll API (<poll.h>) | |
| file | select.h |
| POSIX select API (<sys/select.h>) | |
Macros | |
| #define | O_CLOEXEC ZVFS_O_CLOEXEC |
| Close file descriptor on exec (open() flag). | |
| #define | O_CREAT ZVFS_O_CREAT |
| Create file if it does not exist (open() flag). | |
| #define | O_DIRECTORY ZVFS_O_DIRECTORY |
| Fail if path does not name a directory (open() flag). | |
| #define | O_EXCL ZVFS_O_EXCL |
| Exclusive creation: fail if file already exists (open() flag, with O_CREAT). | |
| #define | O_NOCTTY ZVFS_O_NOCTTY |
| Do not assign a controlling terminal (open() flag). | |
| #define | O_NOFOLLOW ZVFS_O_NOFOLLOW |
| Do not follow symbolic links (open() flag). | |
| #define | O_TRUNC ZVFS_O_TRUNC |
| Truncate file to zero length on open (open() flag). | |
| #define | O_TTY_INIT ZVFS_O_TTY_INIT |
| Initialise terminal to conforming state (open() flag). | |
| #define | O_APPEND ZVFS_O_APPEND |
| Write operations append to end of file. | |
| #define | O_DSYNC ZVFS_O_DSYNC |
| Write I/O completes as defined for synchronised I/O data integrity. | |
| #define | O_NONBLOCK ZVFS_O_NONBLOCK |
| Non-blocking I/O mode. | |
| #define | O_RSYNC ZVFS_O_RSYNC |
| Synchronised read I/O (same as O_SYNC for reads). | |
| #define | O_SYNC ZVFS_O_SYNC |
| Write I/O completes as defined for synchronised I/O file integrity. | |
| #define | O_EXEC ZVFS_O_EXEC |
| Open for execute only (no read, write, or search). | |
| #define | O_RDONLY ZVFS_O_RDONLY |
| Open for reading only. | |
| #define | O_RDWR ZVFS_O_RDWR |
| Open for reading and writing. | |
| #define | O_SEARCH ZVFS_O_SEARCH |
| Open directory for search only. | |
| #define | O_WRONLY ZVFS_O_WRONLY |
| Open for writing only. | |
| #define | O_ACCMODE (ZVFS_O_RDONLY | ZVFS_O_RDWR | ZVFS_O_WRONLY) |
| Mask to extract the file access mode from open flags. | |
| #define | pollfd zvfs_pollfd |
| Poll file descriptor structure (alias for zvfs_pollfd). | |
| #define | POLLIN ZVFS_POLLIN |
| Data other than high-priority data may be read without blocking. | |
| #define | POLLRDNORM ZVFS_POLLRDNORM |
| Normal data may be read without blocking. | |
| #define | POLLRDBAND ZVFS_POLLRDBAND |
| Priority data may be read without blocking. | |
| #define | POLLPRI ZVFS_POLLPRI |
| High-priority data may be read without blocking. | |
| #define | POLLOUT ZVFS_POLLOUT |
| Normal data may be written without blocking. | |
| #define | POLLWRNORM ZVFS_POLLWRNORM |
| Equivalent to POLLOUT. | |
| #define | POLLWRBAND ZVFS_POLLWRBAND |
| Priority data may be written. | |
| #define | POLLERR ZVFS_POLLERR |
| An error has occurred on the file descriptor (output only). | |
| #define | POLLHUP ZVFS_POLLHUP |
| The file descriptor has been hung up (output only). | |
| #define | POLLNVAL ZVFS_POLLNVAL |
| The file descriptor is not open (output only). | |
| #define | FD_SETSIZE ZVFS_FD_SETSIZE |
| Maximum number of file descriptors in an fd_set. | |
| #define | STDERR_FILENO 2 |
| File descriptor for standard error. | |
| #define | STDIN_FILENO 0 |
| File descriptor for standard input. | |
| #define | STDOUT_FILENO 1 |
| File descriptor for standard output. | |
Typedefs | |
| typedef int | nfds_t |
| Type for the number of file descriptors passed to poll(). | |
| typedef long | suseconds_t |
| Microsecond time component type. | |
| typedef struct zvfs_fd_set | fd_set |
| Set of file descriptors for select()/pselect(). | |
Functions | |
| int | open (const char *name, int flags,...) |
| Open or create a file. | |
| int | openat (int fd, const char *path, int oflag,...) |
| Open or create a file relative to a directory file descriptor. | |
| int | poll (struct zvfs_pollfd *fds, nfds_t nfds, int timeout) |
| Wait for events on a set of file descriptors. | |
| FILE * | fdopen (int fd, const char *mode) |
| Associate a stream with an open file descriptor. | |
| int | fileno (FILE *stream) |
| Return the file descriptor associated with a stream. | |
| int | pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timespec *timeout, const sigset_t *sigmask) |
| Synchronous multiplexed I/O with signal-mask and nanosecond timeout. | |
| int | select (int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout) |
| Synchronous multiplexed I/O (legacy interface, use pselect() for new code). | |
| void | FD_CLR (int fd, fd_set *fdset) |
| Remove a file descriptor from an fd_set. | |
| int | FD_ISSET (int fd, fd_set *fdset) |
| Test whether a file descriptor is in an fd_set. | |
| void | FD_SET (int fd, fd_set *fdset) |
| Add a file descriptor to an fd_set. | |
| void | FD_ZERO (fd_set *fdset) |
| Clear all file descriptors from an fd_set. | |
| int | close (int fildes) |
| Close a file descriptor. | |
| ssize_t | pread (int fildes, void *buf, size_t nbyte, off_t offset) |
| Read from a file at a given offset without changing the file offset. | |
| ssize_t | pwrite (int fildes, const void *buf, size_t nbyte, off_t offset) |
| Write to a file at a given offset without changing the file offset. | |
| ssize_t | read (int fildes, void *buf, size_t nbyte) |
| Read from a file descriptor. | |
| ssize_t | write (int fildes, const void *buf, size_t nbyte) |
| Write to a file descriptor. | |
POSIX Device Input and Output option group.
Covers open(), close(), read(), write(), pread(), pwrite(), select(), poll(), and related device-I/O primitives.
| #define FD_SETSIZE ZVFS_FD_SETSIZE |
| #define O_ACCMODE (ZVFS_O_RDONLY | ZVFS_O_RDWR | ZVFS_O_WRONLY) |
| #define O_APPEND ZVFS_O_APPEND |
| #define O_CLOEXEC ZVFS_O_CLOEXEC |
| #define O_CREAT ZVFS_O_CREAT |
| #define O_DIRECTORY ZVFS_O_DIRECTORY |
| #define O_DSYNC ZVFS_O_DSYNC |
| #define O_EXCL ZVFS_O_EXCL |
| #define O_EXEC ZVFS_O_EXEC |
| #define O_NOCTTY ZVFS_O_NOCTTY |
| #define O_NOFOLLOW ZVFS_O_NOFOLLOW |
| #define O_RSYNC ZVFS_O_RSYNC |
| #define O_SEARCH ZVFS_O_SEARCH |
| #define O_SYNC ZVFS_O_SYNC |
| #define O_TRUNC ZVFS_O_TRUNC |
| #define O_TTY_INIT ZVFS_O_TTY_INIT |
| #define POLLERR ZVFS_POLLERR |
| #define pollfd zvfs_pollfd |
| #define POLLHUP ZVFS_POLLHUP |
| #define POLLIN ZVFS_POLLIN |
| #define POLLNVAL ZVFS_POLLNVAL |
| #define POLLOUT ZVFS_POLLOUT |
| #define POLLPRI ZVFS_POLLPRI |
| #define POLLRDBAND ZVFS_POLLRDBAND |
| #define POLLRDNORM ZVFS_POLLRDNORM |
| #define POLLWRBAND ZVFS_POLLWRBAND |
| #define STDERR_FILENO 2 |
| #define STDOUT_FILENO 1 |
| typedef struct zvfs_fd_set fd_set |
| typedef int nfds_t |
| typedef long suseconds_t |
| int close | ( | int | fildes | ) |
Close a file descriptor.
| void FD_CLR | ( | int | fd, |
| fd_set * | fdset | ||
| ) |
Remove a file descriptor from an fd_set.
| fd | File descriptor to clear. |
| fdset | File descriptor set to modify. |
| int FD_ISSET | ( | int | fd, |
| fd_set * | fdset | ||
| ) |
Test whether a file descriptor is in an fd_set.
| fd | File descriptor to test. |
| fdset | File descriptor set. |
fd is set, 0 otherwise. | void FD_SET | ( | int | fd, |
| fd_set * | fdset | ||
| ) |
Add a file descriptor to an fd_set.
| fd | File descriptor to add. |
| fdset | File descriptor set to modify. |
| void FD_ZERO | ( | fd_set * | fdset | ) |
Clear all file descriptors from an fd_set.
| fdset | File descriptor set to clear. |
| FILE * fdopen | ( | int | fd, |
| const char * | mode | ||
| ) |
Associate a stream with an open file descriptor.
| fd | File descriptor to associate with the stream. |
| mode | Mode string as for fopen(). |
NULL on failure. | int fileno | ( | FILE * | stream | ) |
Return the file descriptor associated with a stream.
| stream | Stream to query. |
stream. | int open | ( | const char * | name, |
| int | flags, | ||
| ... | |||
| ) |
Open or create a file.
| name | File path. |
| flags | Access and creation flags (O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, …). |
| ... | If O_CREAT: mode_t mode. |
| int openat | ( | int | fd, |
| const char * | path, | ||
| int | oflag, | ||
| ... | |||
| ) |
Open or create a file relative to a directory file descriptor.
| fd | Directory file descriptor, or AT_FDCWD. |
| path | File path (relative to fd, or absolute). |
| oflag | Access and creation flags. |
| ... | If O_CREAT: mode_t mode. |
| int poll | ( | struct zvfs_pollfd * | fds, |
| nfds_t | nfds, | ||
| int | timeout | ||
| ) |
Wait for events on a set of file descriptors.
Examines each file descriptor in fds for the events specified in its events field. Blocks until at least one descriptor is ready, the timeout expires, or a signal is caught.
| fds | Array of struct pollfd descriptors to monitor. |
| nfds | Number of entries in fds. |
| timeout | Timeout in milliseconds; -1 to block indefinitely, 0 to return immediately. |
revents on success, 0 on timeout, or -1 with errno set on failure. | ssize_t pread | ( | int | fildes, |
| void * | buf, | ||
| size_t | nbyte, | ||
| off_t | offset | ||
| ) |
Read from a file at a given offset without changing the file offset.
| int pselect | ( | int | nfds, |
| fd_set * | readfds, | ||
| fd_set * | writefds, | ||
| fd_set * | exceptfds, | ||
| const struct timespec * | timeout, | ||
| const sigset_t * | sigmask | ||
| ) |
Synchronous multiplexed I/O with signal-mask and nanosecond timeout.
| nfds | Highest-numbered file descriptor in any set + 1. |
| readfds | Set of file descriptors to watch for readability, or NULL. |
| writefds | Set of file descriptors to watch for writability, or NULL. |
| exceptfds | Set of file descriptors to watch for exceptions, or NULL. |
| timeout | Maximum wait time, or NULL to block indefinitely. |
| sigmask | Signal mask to apply during the wait, or NULL. |
| ssize_t pwrite | ( | int | fildes, |
| const void * | buf, | ||
| size_t | nbyte, | ||
| off_t | offset | ||
| ) |
Write to a file at a given offset without changing the file offset.
| ssize_t read | ( | int | fildes, |
| void * | buf, | ||
| size_t | nbyte | ||
| ) |
Read from a file descriptor.
| int select | ( | int | nfds, |
| fd_set * | readfds, | ||
| fd_set * | writefds, | ||
| fd_set * | errorfds, | ||
| struct timeval * | timeout | ||
| ) |
Synchronous multiplexed I/O (legacy interface, use pselect() for new code).
| nfds | Highest-numbered file descriptor in any set + 1. |
| readfds | Set of file descriptors to watch for readability, or NULL. |
| writefds | Set of file descriptors to watch for writability, or NULL. |
| errorfds | Set of file descriptors to watch for errors, or NULL. |
| timeout | Maximum wait time, or NULL to block indefinitely. |
| ssize_t write | ( | int | fildes, |
| const void * | buf, | ||
| size_t | nbyte | ||
| ) |
Write to a file descriptor.