mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2024-11-29 18:42:21 +00:00
Merge pull request #452 from moritz31/move-os-compatibility
Moved os-compatibility and added header
This commit is contained in:
commit
779cccf8b4
@ -21,7 +21,6 @@ backend_files = files(
|
||||
'wayland/output.c',
|
||||
'wayland/registry.c',
|
||||
'wayland/wl_seat.c',
|
||||
'wayland/os-compatibility.c',
|
||||
'x11/backend.c',
|
||||
)
|
||||
|
||||
|
@ -29,5 +29,6 @@ executable(
|
||||
executable(
|
||||
'screenshot',
|
||||
'screenshot.c',
|
||||
dependencies: [wayland_client, wlr_protos],
|
||||
dependencies: [wayland_client, wlr_protos, wlroots],
|
||||
link_with: lib_shared,
|
||||
)
|
||||
|
@ -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;
|
||||
|
12
include/util/os-compatibility.h
Normal file
12
include/util/os-compatibility.h
Normal file
@ -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
|
@ -2,6 +2,7 @@ lib_wlr_util = static_library(
|
||||
'wlr_util',
|
||||
files(
|
||||
'log.c',
|
||||
'os-compatibility.c',
|
||||
),
|
||||
include_directories: wlr_inc,
|
||||
)
|
||||
|
@ -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;
|
Loading…
Reference in New Issue
Block a user