aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-11-30 12:14:58 -0500
committerGitHub <noreply@github.com>2017-11-30 12:14:58 -0500
commit779cccf8b421b99031884f4d2886e788ac77a6eb (patch)
tree6a6278ee1b8ad6a38d16471d07202f67a776353c
parent5d7eb438d9dde68ce185daf977a0c27a1398bbc9 (diff)
parentcef6d7549131cfee7cd60ada0388a2766335c70a (diff)
Merge pull request #452 from moritz31/move-os-compatibility
Moved os-compatibility and added header
-rw-r--r--backend/meson.build1
-rw-r--r--examples/meson.build3
-rw-r--r--examples/screenshot.c2
-rw-r--r--include/util/os-compatibility.h12
-rw-r--r--util/meson.build1
-rw-r--r--util/os-compatibility.c (renamed from backend/wayland/os-compatibility.c)16
6 files changed, 21 insertions, 14 deletions
diff --git a/backend/meson.build b/backend/meson.build
index 5ed7b227..c9d47317 100644
--- a/backend/meson.build
+++ b/backend/meson.build
@@ -21,7 +21,6 @@ backend_files = files(
'wayland/output.c',
'wayland/registry.c',
'wayland/wl_seat.c',
- 'wayland/os-compatibility.c',
'x11/backend.c',
)
diff --git a/examples/meson.build b/examples/meson.build
index 89fc6211..af0f5a18 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -29,5 +29,6 @@ executable(
executable(
'screenshot',
'screenshot.c',
- dependencies: [wayland_client, wlr_protos],
+ dependencies: [wayland_client, wlr_protos, wlroots],
+ link_with: lib_shared,
)
diff --git a/examples/screenshot.c b/examples/screenshot.c
index fc7f3cb3..a887d1d7 100644
--- a/examples/screenshot.c
+++ b/examples/screenshot.c
@@ -35,7 +35,7 @@
#include <limits.h>
#include <sys/param.h>
#include <screenshooter-client-protocol.h>
-#include "../backend/wayland/os-compatibility.c"
+#include "util/os-compatibility.h"
static struct wl_shm *shm = NULL;
static struct orbital_screenshooter *screenshooter = NULL;
diff --git a/include/util/os-compatibility.h b/include/util/os-compatibility.h
new file mode 100644
index 00000000..b2ec2db9
--- /dev/null
+++ b/include/util/os-compatibility.h
@@ -0,0 +1,12 @@
+#ifndef _WLR_UTIL_OS_COMPATIBILITY_H
+#define _WLR_UTIL_OS_COMPATIBILITY_H
+
+int os_fd_set_cloexec(int fd);
+
+int set_cloexec_or_close(int fd);
+
+int create_tmpfile_cloexec(char *tmpname);
+
+int os_create_anonymous_file(off_t size);
+
+#endif
diff --git a/util/meson.build b/util/meson.build
index dd620818..21930693 100644
--- a/util/meson.build
+++ b/util/meson.build
@@ -2,6 +2,7 @@ lib_wlr_util = static_library(
'wlr_util',
files(
'log.c',
+ 'os-compatibility.c',
),
include_directories: wlr_inc,
)
diff --git a/backend/wayland/os-compatibility.c b/util/os-compatibility.c
index cbd7988d..98aeab3d 100644
--- a/backend/wayland/os-compatibility.c
+++ b/util/os-compatibility.c
@@ -31,10 +31,9 @@
#include <errno.h>
#include <string.h>
#include <stdlib.h>
+#include "util/os-compatibility.h"
-int
-os_fd_set_cloexec(int fd)
-{
+int os_fd_set_cloexec(int fd) {
long flags;
if (fd == -1)
@@ -50,9 +49,7 @@ os_fd_set_cloexec(int fd)
return 0;
}
-static int
-set_cloexec_or_close(int fd)
-{
+int set_cloexec_or_close(int fd) {
if (os_fd_set_cloexec(fd) != 0) {
close(fd);
return -1;
@@ -60,8 +57,7 @@ set_cloexec_or_close(int fd)
return fd;
}
-static int
-create_tmpfile_cloexec(char *tmpname)
+int create_tmpfile_cloexec(char *tmpname)
{
int fd;
@@ -101,9 +97,7 @@ create_tmpfile_cloexec(char *tmpname)
* If posix_fallocate() is not supported, program may receive
* SIGBUS on accessing mmap()'ed file contents instead.
*/
-int
-os_create_anonymous_file(off_t size)
-{
+int os_create_anonymous_file(off_t size) {
static const char template[] = "/wlroots-shared-XXXXXX";
const char *path;
char *name;