mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-04-07 08:21:11 -04:00
spa: system: make spa_poll_event compatible with epoll_events
spa_poll_event should have exactly same layout as epoll_events to be compatible across platforms. The structure is packed only on x86-64. Fix packing and replace the data member with similar union as epoll_data, to fix compatibility on 32-bit etc.
This commit is contained in:
parent
6b0248d68c
commit
ad0bab69a1
2 changed files with 11 additions and 2 deletions
|
|
@ -59,8 +59,15 @@ struct spa_system { struct spa_interface iface; };
|
||||||
|
|
||||||
struct spa_poll_event {
|
struct spa_poll_event {
|
||||||
uint32_t events;
|
uint32_t events;
|
||||||
|
union {
|
||||||
void *data;
|
void *data;
|
||||||
|
uint64_t data_u64;
|
||||||
|
};
|
||||||
|
#ifdef __x86_64__
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
|
#else
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
struct spa_system_methods {
|
struct spa_system_methods {
|
||||||
#define SPA_VERSION_SYSTEM_METHODS 1
|
#define SPA_VERSION_SYSTEM_METHODS 1
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,8 @@ SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.system");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SPA_STATIC_ASSERT(sizeof(struct spa_poll_event) == sizeof(struct epoll_event));
|
SPA_STATIC_ASSERT(sizeof(struct spa_poll_event) == sizeof(struct epoll_event));
|
||||||
|
SPA_STATIC_ASSERT(offsetof(struct spa_poll_event, events) == offsetof(struct epoll_event, events));
|
||||||
|
SPA_STATIC_ASSERT(offsetof(struct spa_poll_event, data) == offsetof(struct epoll_event, data.ptr));
|
||||||
|
|
||||||
struct impl {
|
struct impl {
|
||||||
struct spa_handle handle;
|
struct spa_handle handle;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue