Merge pull request #1361 from sghctoma/fix-shm

Force ftruncate for shared memory objects on FreeBSD
This commit is contained in:
emersion 2018-11-09 19:34:42 +01:00 committed by GitHub
commit e70a552203
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 18 deletions

View File

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

View File

@ -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')

View File

@ -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;
}