15 #include <sys/types.h>
32 #define SPA_TYPE_INTERFACE_System SPA_TYPE_INFO_INTERFACE_BASE "System"
33 #define SPA_TYPE_INTERFACE_DataSystem SPA_TYPE_INFO_INTERFACE_BASE "DataSystem"
35 #define SPA_VERSION_SYSTEM 0
39 #define SPA_IO_IN (1 << 0)
40 #define SPA_IO_OUT (1 << 2)
41 #define SPA_IO_ERR (1 << 3)
42 #define SPA_IO_HUP (1 << 4)
45 #define SPA_FD_CLOEXEC (1<<0)
46 #define SPA_FD_NONBLOCK (1<<1)
47 #define SPA_FD_EVENT_SEMAPHORE (1<<2)
48 #define SPA_FD_TIMER_ABSTIME (1<<3)
49 #define SPA_FD_TIMER_CANCEL_ON_SET (1<<4)
57 #define SPA_VERSION_SYSTEM_METHODS 0
61 ssize_t (*
read) (
void *object,
int fd,
void *buf,
size_t count);
62 ssize_t (*
write) (
void *object,
int fd,
const void *buf,
size_t count);
63 int (*
ioctl) (
void *object,
int fd,
unsigned long request, ...);
64 int (*
close) (
void *object,
int fd);
68 int clockid,
struct timespec *value);
70 int clockid,
struct timespec *res);
74 int (*
pollfd_add) (
void *object,
int pfd,
int fd, uint32_t events,
void *data);
75 int (*
pollfd_mod) (
void *object,
int pfd,
int fd, uint32_t events,
void *data);
100 #define spa_system_method_r(o,method,version,...) \
102 volatile int _res = -ENOTSUP; \
103 struct spa_system *_o = o; \
104 spa_interface_call_res(&_o->iface, \
105 struct spa_system_methods, _res, \
106 method, version, ##__VA_ARGS__); \
111 #define spa_system_read(s,...) spa_system_method_r(s,read,0,__VA_ARGS__)
112 #define spa_system_write(s,...) spa_system_method_r(s,write,0,__VA_ARGS__)
113 #define spa_system_ioctl(s,...) spa_system_method_r(s,ioctl,0,__VA_ARGS__)
114 #define spa_system_close(s,...) spa_system_method_r(s,close,0,__VA_ARGS__)
116 #define spa_system_clock_gettime(s,...) spa_system_method_r(s,clock_gettime,0,__VA_ARGS__)
117 #define spa_system_clock_getres(s,...) spa_system_method_r(s,clock_getres,0,__VA_ARGS__)
119 #define spa_system_pollfd_create(s,...) spa_system_method_r(s,pollfd_create,0,__VA_ARGS__)
120 #define spa_system_pollfd_add(s,...) spa_system_method_r(s,pollfd_add,0,__VA_ARGS__)
121 #define spa_system_pollfd_mod(s,...) spa_system_method_r(s,pollfd_mod,0,__VA_ARGS__)
122 #define spa_system_pollfd_del(s,...) spa_system_method_r(s,pollfd_del,0,__VA_ARGS__)
123 #define spa_system_pollfd_wait(s,...) spa_system_method_r(s,pollfd_wait,0,__VA_ARGS__)
125 #define spa_system_timerfd_create(s,...) spa_system_method_r(s,timerfd_create,0,__VA_ARGS__)
126 #define spa_system_timerfd_settime(s,...) spa_system_method_r(s,timerfd_settime,0,__VA_ARGS__)
127 #define spa_system_timerfd_gettime(s,...) spa_system_method_r(s,timerfd_gettime,0,__VA_ARGS__)
128 #define spa_system_timerfd_read(s,...) spa_system_method_r(s,timerfd_read,0,__VA_ARGS__)
130 #define spa_system_eventfd_create(s,...) spa_system_method_r(s,eventfd_create,0,__VA_ARGS__)
131 #define spa_system_eventfd_write(s,...) spa_system_method_r(s,eventfd_write,0,__VA_ARGS__)
132 #define spa_system_eventfd_read(s,...) spa_system_method_r(s,eventfd_read,0,__VA_ARGS__)
134 #define spa_system_signalfd_create(s,...) spa_system_method_r(s,signalfd_create,0,__VA_ARGS__)
135 #define spa_system_signalfd_read(s,...) spa_system_method_r(s,signalfd_read,0,__VA_ARGS__)
uint32_t events
Definition: system.h:70
void * data
Definition: system.h:71
int(* pollfd_del)(void *object, int pfd, int fd)
Definition: system.h:95
int(* eventfd_read)(void *object, int fd, uint64_t *count)
Definition: system.h:112
int(* signalfd_read)(void *object, int fd, int *signal)
Definition: system.h:116
int(* pollfd_wait)(void *object, int pfd, struct spa_poll_event *ev, int n_ev, int timeout)
Definition: system.h:96
int(* timerfd_create)(void *object, int clockid, int flags)
Definition: system.h:100
int(* eventfd_write)(void *object, int fd, uint64_t count)
Definition: system.h:111
int(* eventfd_create)(void *object, int flags)
Definition: system.h:110
ssize_t(* read)(void *object, int fd, void *buf, size_t count)
Definition: system.h:80
uint32_t version
Definition: system.h:77
int(* clock_getres)(void *object, int clockid, struct timespec *res)
Definition: system.h:88
int(* timerfd_read)(void *object, int fd, uint64_t *expirations)
Definition: system.h:107
int(* close)(void *object, int fd)
Definition: system.h:83
int(* pollfd_create)(void *object, int flags)
Definition: system.h:92
int(* clock_gettime)(void *object, int clockid, struct timespec *value)
Definition: system.h:86
ssize_t(* write)(void *object, int fd, const void *buf, size_t count)
Definition: system.h:81
int(* pollfd_add)(void *object, int pfd, int fd, uint32_t events, void *data)
Definition: system.h:93
int(* timerfd_gettime)(void *object, int fd, struct itimerspec *curr_value)
Definition: system.h:105
int(* signalfd_create)(void *object, int signal, int flags)
Definition: system.h:115
int(* timerfd_settime)(void *object, int fd, int flags, const struct itimerspec *new_value, struct itimerspec *old_value)
Definition: system.h:101
int(* pollfd_mod)(void *object, int pfd, int fd, uint32_t events, void *data)
Definition: system.h:94
int(* ioctl)(void *object, int fd, unsigned long request,...)
Definition: system.h:82
struct spa_interface iface
Definition: system.h:45