Merge pull request #1361 from sghctoma/fix-shm

Force ftruncate for shared memory objects on FreeBSD
master
emersion 6 years ago committed by GitHub
commit e70a552203
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -14,6 +14,4 @@
#mesondefine WLR_HAS_XCB_ICCCM #mesondefine WLR_HAS_XCB_ICCCM
#mesondefine WLR_HAS_XCB_XKB #mesondefine WLR_HAS_XCB_XKB
#mesondefine WLR_HAS_POSIX_FALLOCATE
#endif #endif

@ -72,10 +72,6 @@ if logind.found()
wlr_deps += logind wlr_deps += logind
endif 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('protocol')
subdir('render') subdir('render')

@ -42,17 +42,6 @@ int allocate_shm_file(size_t size) {
return -1; 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; int ret;
do { do {
ret = ftruncate(fd, size); ret = ftruncate(fd, size);
@ -61,7 +50,6 @@ int allocate_shm_file(size_t size) {
close(fd); close(fd);
return -1; return -1;
} }
#endif
return fd; return fd;
} }

Loading…
Cancel
Save