6#ifndef ZEPHYR_INCLUDE_SYS_FDTABLE_H_
7#define ZEPHYR_INCLUDE_SYS_FDTABLE_H_
18#define ZVFS_O_APPEND 0x0400
19#define ZVFS_O_CREAT 0x0040
20#define ZVFS_O_TRUNC 0x0200
22#define ZVFS_O_APPEND 0x0008
23#define ZVFS_O_CREAT 0x0200
24#define ZVFS_O_TRUNC 0x0400
27#define ZVFS_O_RDONLY 00
28#define ZVFS_O_WRONLY 01
31#define ZVFS_O_EXCL 0x0800
32#define ZVFS_O_NONBLOCK 0x4000
39#define ZVFS_MODE_IFMT 0170000
40#define ZVFS_MODE_UNSPEC 0000000
41#define ZVFS_MODE_IFIFO 0010000
42#define ZVFS_MODE_IFCHR 0020000
43#define ZVFS_MODE_IMSGQ 0030000
44#define ZVFS_MODE_IFDIR 0040000
45#define ZVFS_MODE_IFSEM 0050000
46#define ZVFS_MODE_IFBLK 0060000
47#define ZVFS_MODE_IFSHM 0070000
48#define ZVFS_MODE_IFREG 0100000
49#define ZVFS_MODE_IFLNK 0120000
50#define ZVFS_MODE_IFSOCK 0140000
52#define ZVFS_POLLIN BIT(0)
53#define ZVFS_POLLPRI BIT(1)
54#define ZVFS_POLLOUT BIT(2)
55#define ZVFS_POLLERR BIT(3)
56#define ZVFS_POLLHUP BIT(4)
57#define ZVFS_POLLNVAL BIT(5)
64#ifdef CONFIG_NEWLIB_LIBC
65#ifndef _OFF_T_DECLARED
67#define _OFF_T_DECLARED
69#ifndef _SSIZE_T_DECLARED
71#define _SSIZE_T_DECLARED
92 int (*
ioctl)(
void *obj,
unsigned int request, va_list args);
227 unsigned long request, ...)
232 va_start(args, request);
233 res = vtable->
ioctl(obj, request, args);
252#define ZVFS_FD_SETSIZE (sizeof(((struct zvfs_fd_set *)0)->bitset) * 8)
293#include <zephyr/syscalls/fdtable.h>
int zvfs_alloc_fd(void *obj, const struct fd_op_vtable *vtable)
Allocate file descriptor for underlying I/O object.
void ZVFS_FD_CLR(int fd, struct zvfs_fd_set *fdset)
int zvfs_reserve_fd(void)
Reserve file descriptor.
void * zvfs_get_fd_obj_and_vtable(int fd, const struct fd_op_vtable **vtable, struct k_mutex **lock)
Get underlying object pointer and vtable pointer from file descriptor.
static void zvfs_finalize_fd(int fd, void *obj, const struct fd_op_vtable *vtable)
Finalize creation of file descriptor.
Definition fdtable.h:135
int zvfs_poll(struct zvfs_pollfd *fds, int nfds, int poll_timeout)
@ ZFD_IOCTL_SET_LOCK
Definition fdtable.h:279
@ ZFD_IOCTL_FIONREAD
Definition fdtable.h:285
@ ZFD_IOCTL_POLL_PREPARE
Definition fdtable.h:276
@ ZFD_IOCTL_FSYNC
Definition fdtable.h:274
@ ZFD_IOCTL_LSEEK
Definition fdtable.h:275
@ ZFD_IOCTL_FIONBIO
Definition fdtable.h:286
@ ZFD_IOCTL_POLL_OFFLOAD
Definition fdtable.h:278
@ ZFD_IOCTL_POLL_UPDATE
Definition fdtable.h:277
@ ZFD_IOCTL_TRUNCATE
Definition fdtable.h:281
@ ZFD_IOCTL_STAT
Definition fdtable.h:280
@ ZFD_IOCTL_MMAP
Definition fdtable.h:282
void zvfs_finalize_typed_fd(int fd, void *obj, const struct fd_op_vtable *vtable, uint32_t mode)
Finalize creation of file descriptor, with type.
#define ZVFS_MODE_UNSPEC
Definition fdtable.h:40
void ZVFS_FD_ZERO(struct zvfs_fd_set *fdset)
bool zvfs_get_obj_lock_and_cond(void *obj, const struct fd_op_vtable *vtable, struct k_mutex **lock, struct k_condvar **cond)
Get the mutex and condition variable associated with the given object and vtable.
void zvfs_free_fd(int fd)
Release reserved file descriptor.
static int zvfs_fdtable_call_ioctl(const struct fd_op_vtable *vtable, void *obj, unsigned long request,...)
Call ioctl vmethod on an object using varargs.
Definition fdtable.h:226
int ZVFS_FD_ISSET(int fd, struct zvfs_fd_set *fdset)
void * zvfs_get_fd_obj(int fd, const struct fd_op_vtable *vtable, int err)
Get underlying object pointer from file descriptor.
int zvfs_select(int nfds, struct zvfs_fd_set *ZRESTRICT readfds, struct zvfs_fd_set *ZRESTRICT writefds, struct zvfs_fd_set *ZRESTRICT errorfds, const struct timespec *ZRESTRICT timeout, const void *ZRESTRICT sigmask)
void ZVFS_FD_SET(int fd, struct zvfs_fd_set *fdset)
__SIZE_TYPE__ ssize_t
Definition types.h:28
__INTPTR_TYPE__ off_t
Definition types.h:36
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
File descriptor virtual method table.
Definition fdtable.h:79
int(* close2)(void *obj, int fd)
Definition fdtable.h:90
ssize_t(* write_offs)(void *obj, const void *buf, size_t sz, size_t offset)
Definition fdtable.h:86
ssize_t(* read_offs)(void *obj, void *buf, size_t sz, size_t offset)
Definition fdtable.h:82
int(* close)(void *obj)
Definition fdtable.h:89
ssize_t(* read)(void *obj, void *buf, size_t sz)
Definition fdtable.h:81
ssize_t(* write)(void *obj, const void *buf, size_t sz)
Definition fdtable.h:85
int(* ioctl)(void *obj, unsigned int request, va_list args)
Definition fdtable.h:92
Mutex Structure.
Definition kernel.h:3025
Definition _timespec.h:22
uint32_t bitset[(CONFIG_ZVFS_OPEN_MAX+31)/32]
Definition fdtable.h:248
short events
Definition fdtable.h:241
short revents
Definition fdtable.h:242
int fd
Definition fdtable.h:240