mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-02 11:55:59 +01:00
Merge pull request #1361 from sghctoma/fix-shm
Force ftruncate for shared memory objects on FreeBSD
This commit is contained in:
commit
e70a552203
3 changed files with 0 additions and 18 deletions
|
@ -14,6 +14,4 @@
|
|||
#mesondefine WLR_HAS_XCB_ICCCM
|
||||
#mesondefine WLR_HAS_XCB_XKB
|
||||
|
||||
#mesondefine WLR_HAS_POSIX_FALLOCATE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -72,10 +72,6 @@ if logind.found()
|
|||
wlr_deps += logind
|
||||
endif
|
||||
|
||||
if cc.has_header_symbol('fcntl.h', 'posix_fallocate', prefix: '#define _POSIX_C_SOURCE 200112L')
|
||||
conf_data.set('WLR_HAS_POSIX_FALLOCATE', true)
|
||||
endif
|
||||
|
||||
subdir('protocol')
|
||||
subdir('render')
|
||||
|
||||
|
|
12
util/shm.c
12
util/shm.c
|
@ -42,17 +42,6 @@ int allocate_shm_file(size_t size) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
#ifdef WLR_HAS_POSIX_FALLOCATE
|
||||
int ret;
|
||||
do {
|
||||
ret = posix_fallocate(fd, 0, size);
|
||||
} while (ret == EINTR);
|
||||
if (ret != 0) {
|
||||
close(fd);
|
||||
errno = ret;
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
int ret;
|
||||
do {
|
||||
ret = ftruncate(fd, size);
|
||||
|
@ -61,7 +50,6 @@ int allocate_shm_file(size_t size) {
|
|||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue