All checks were successful
Test / Hakurei (push) Successful in 10m33s
Test / Create distribution (push) Successful in 35s
Test / Sandbox (push) Successful in 1m32s
Test / Hpkg (push) Successful in 3m24s
Test / Sandbox (race detector) (push) Successful in 4m19s
Test / Hakurei (race detector) (push) Successful in 5m12s
Test / Flake checks (push) Successful in 1m36s
This is cleaner than cleaning up in internal/system as it covers the failure paths. Signed-off-by: Ophestra <cat@gensokyo.uk>
43 lines
1.3 KiB
C
43 lines
1.3 KiB
C
#include <stdbool.h>
|
|
#include <sys/un.h>
|
|
|
|
typedef enum {
|
|
HAKUREI_WAYLAND_SUCCESS,
|
|
/* wl_display_connect_to_fd failed, errno */
|
|
HAKUREI_WAYLAND_CONNECT,
|
|
/* wl_registry_add_listener failed, errno */
|
|
HAKUREI_WAYLAND_LISTENER,
|
|
/* wl_display_roundtrip failed, errno */
|
|
HAKUREI_WAYLAND_ROUNDTRIP,
|
|
/* compositor does not implement wp_security_context_v1 */
|
|
HAKUREI_WAYLAND_NOT_AVAIL,
|
|
/* socket failed, errno */
|
|
HAKUREI_WAYLAND_SOCKET,
|
|
/* bind failed, errno */
|
|
HAKUREI_WAYLAND_BIND,
|
|
/* listen failed, errno */
|
|
HAKUREI_WAYLAND_LISTEN,
|
|
|
|
/* ensure pathname failed, implemented in conn.go */
|
|
HAKUREI_WAYLAND_CREAT,
|
|
/* socket for host server failed, implemented in conn.go */
|
|
HAKUREI_WAYLAND_HOST_SOCKET,
|
|
/* connect for host server failed, implemented in conn.go */
|
|
HAKUREI_WAYLAND_HOST_CONNECT,
|
|
/* cleanup failed, implemented in conn.go */
|
|
HAKUREI_WAYLAND_CLEANUP,
|
|
} hakurei_wayland_res;
|
|
|
|
hakurei_wayland_res hakurei_security_context_bind(
|
|
char *socket_path,
|
|
int server_fd,
|
|
const char *app_id,
|
|
const char *instance_id,
|
|
int close_fd);
|
|
|
|
/* returns whether the specified size fits in the sun_path field of sockaddr_un */
|
|
static inline bool hakurei_is_valid_size_sun_path(size_t sz) {
|
|
struct sockaddr_un sockaddr;
|
|
return sz <= sizeof(sockaddr.sun_path);
|
|
};
|