|
iPXE
|
POSIX-like I/O. More...
#include <stdint.h>Go to the source code of this file.
Macros | |
| #define | POSIX_FD_MIN ( 1 ) |
| Minimum file descriptor that will ever be allocated. More... | |
| #define | POSIX_FD_MAX ( 31 ) |
| Maximum file descriptor that will ever be allocated. More... | |
Typedefs | |
| typedef uint32_t | fd_set |
| File descriptor set as used for select() More... | |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| int | open (const char *uri_string) |
| Open file. More... | |
| ssize_t | read (int fd, void *buf, size_t len) |
| Read data from file. More... | |
| int | select (fd_set *readfds, int wait) |
| Check file descriptors for readiness. More... | |
| ssize_t | fsize (int fd) |
| Determine file size. More... | |
| int | close (int fd) |
| Close file. More... | |
| static | __attribute__ ((always_inline)) void FD_ZERO(fd_set *set) |
| Zero a file descriptor set. More... | |
Variables | |
| static fd_set * | set |
POSIX-like I/O.
Definition in file posix_io.h.
| #define POSIX_FD_MIN ( 1 ) |
Minimum file descriptor that will ever be allocated.
Definition at line 15 of file posix_io.h.
| #define POSIX_FD_MAX ( 31 ) |
Maximum file descriptor that will ever be allocated.
Definition at line 18 of file posix_io.h.
File descriptor set as used for select()
Definition at line 21 of file posix_io.h.
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
| int open | ( | const char * | uri_string | ) |
Open file.
| uri_string | URI string |
| fd | File descriptor, or negative error number |
Definition at line 176 of file posix_io.c.
References posix_file::data, DBG, EINPROGRESS, ENOMEM, posix_file::fd, INIT_LIST_HEAD, intf_init(), posix_file::list, list_add, list_empty, posix_file_finished(), posix_file_free(), posix_file_xfer_desc, posix_find_free_fd(), posix_file::rc, rc, ref_init, ref_put, posix_file::refcnt, step(), posix_file::xfer, xfer_open_uri_string(), and zalloc().
Referenced by int22(), peerdist_discovery_reply_values(), pxenv_file_open(), vmbus_open(), and xve_update_state().
Read data from file.
| buf | Data buffer |
| max_len | Maximum length to read |
| len | Actual length read, or negative error number |
This call is non-blocking; if no data is available to read then -EWOULDBLOCK will be returned.
Definition at line 264 of file posix_io.c.
References assert(), io_buffer::data, posix_file::data, EBADF, EINPROGRESS, EWOULDBLOCK, free_iob(), iob_len(), iob_pull, len, io_buffer::list, list_del, list_empty, list_for_each_entry, memcpy(), posix_file::pos, posix_fd_to_file(), posix_file::rc, and step().
| int select | ( | fd_set * | readfds, |
| int | wait | ||
| ) |
Check file descriptors for readiness.
| readfds | File descriptors to check |
| wait | Wait until data is ready |
| nready | Number of ready file descriptors |
Definition at line 229 of file posix_io.c.
References posix_file::data, EBADF, EINPROGRESS, posix_file::fd, list_empty, POSIX_FD_MAX, POSIX_FD_MIN, posix_fd_to_file(), posix_file::rc, and step().
Referenced by int22(), pxenv_file_select(), and show_menu().
| ssize_t fsize | ( | int | fd | ) |
Determine file size.
| fd | File descriptor |
| size | File size, or negative error number |
Definition at line 310 of file posix_io.c.
References EBADF, posix_file::fd, posix_file::filesize, and posix_fd_to_file().
Referenced by int22(), and pxenv_get_file_size().
| int close | ( | int | fd | ) |
Close file.
| fd | File descriptor |
| rc | Return status code |
Definition at line 327 of file posix_io.c.
References EBADF, posix_file::fd, posix_file::list, list_del, posix_fd_to_file(), posix_file_finished(), ref_put, and posix_file::refcnt.
|
inlinestatic |
Zero a file descriptor set.
Test a bit within a file descriptor set.
Clear a bit within a file descriptor set.
Set a bit within a file descriptor set.
| set | File descriptor set |
| fd | File descriptor |
| set | File descriptor set |
| fd | File descriptor |
| set | File descriptor set |
| is_set | Corresponding bit is set |
Definition at line 34 of file posix_io.h.
References set.
| fd_set* set |
1.8.15