summaryrefslogtreecommitdiff
path: root/shared/os-compatibility.c
AgeCommit message (Collapse)AuthorFilesLines
2017-03-24os: Check for EINTR on ftruncate()Derek Foreman1-1/+3
The man page indicates that ftruncate() can set errno to EINTR, so test for this. I have not actually been able to provoke an EINTR error from ftruncate() in testing though. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-03-24os: Check for EINTR on posix_fallocate()Derek Foreman1-1/+3
posix_fallocate() can return EINTR and need to be restarted - I've hit this when running weston-terminal under gdb. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-01-03shared: fix a typo in a commentAbdur Rehman1-1/+1
Signed-off-by: Abdur Rehman <arehmanq199@gmail.com> Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2015-07-16log: Open log file CLOEXEC so child processes don't get the fdDerek Foreman1-8/+14
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com> Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-06-15shared: Update boilerplate from MIT X11 license to MIT Expat licenseBryce Harrington1-16/+19
2013-12-02os: use posix_fallocate in creating sharable buffersPekka Paalanen1-1/+18
If posix_fallocate is available, use it instead of ftruncate. Unlike ftruncate, when posix_fallocate succeeds, it guarantees that you cannot run out of disk space, when later writing to the mmap()'ed file. With posix_fallocate, if os_create_anonymous_file() succeeds, the program cannot get a SIGBUS later from accessing this file via mmap. If there is insufficient disk space, the function fails and errno is set to ENOSPC. This is useful on systems, that limit the available buffer space by having XDG_RUNTIME_DIR on a small tmpfs. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-06-05configure.ac: Enable AC_USE_SYSTEM_EXTENSIONSDaniel Stone1-1/+1
AC_USE_SYSTEM_EXTENSIONS enables _XOPEN_SOURCE, _GNU_SOURCE and similar macros to expose the largest extent of functionality supported by the underlying system. This is required since these macros are often limiting rather than merely additive, e.g. _XOPEN_SOURCE will actually on some systems hide declarations which are not part of the X/Open spec. Since this goes into config.h rather than the command line, ensure all source is consistently including config.h before anything else, including system libraries. This doesn't need to be guarded by a HAVE_CONFIG_H ifdef, which was only ever a hangover from the X.Org modular transition. Signed-off-by: Daniel Stone <daniel@fooishbar.org> [pq: rebased and converted more files]
2012-06-12compositor: add fallback strchrnul()Pekka Paalanen1-0/+10
Android does not have this function. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-06-06Rewrite shm buffer file allocation v2Pekka Paalanen1-0/+75
We had duplicated code in many places, using hardcoded paths for temporary files into more than one path. Some cases did not bother with O_CLOEXEC, and all hardcoded paths that might not exist. Add an OS helper function for creating a unique anonymous file with close-on-exec semantics. The helper uses $XDG_RUNTIME_DIR as the directory for a file. This patch unifies the buffer file creation in both Weston and the clients. As simple clients are better not linking to libshared, as it would require e.g. Cairo, they pull the OS compatibility code directly. Android does not have mkostemp(), so a configure test is added for it, and a fallback used if it is not available. Changes in v2: remove all the alternate possible directory definitions and use XDG_RUNTIME_DIR only, and fail is it is not set. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-05-31window: add wrapper for EPOLL_CLOEXECPekka Paalanen1-0/+17
Android does not have EPOLL_CLOEXEC, so add a fallback. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-05-31compositor: work around missing SOCK_CLOEXECPekka Paalanen1-0/+78
Android does not have SOCK_CLOEXEC, so implement a wrapper that falls back. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>