util/shm: add allocate_shm_file_pair

This function behaves like allocate_shm_file, except it also
returns a read-only FD. This is useful to share the same segment
of memory with many Wayland clients.
This commit is contained in:
Simon Ser 2021-08-07 13:46:38 +02:00 committed by Kenny Levinsen
parent 38cd1b4f4f
commit 55ca93469c
2 changed files with 42 additions and 5 deletions

View file

@ -1,7 +1,10 @@
#ifndef UTIL_SHM_H
#define UTIL_SHM_H
#include <stdbool.h>
int create_shm_file(void);
int allocate_shm_file(size_t size);
bool allocate_shm_file_pair(size_t size, int *rw_fd, int *ro_fd);
#endif