mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-04-28 12:52:23 +00:00
build: improve meson build
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
parent
ad447e353d
commit
db4af8c57e
@ -49,7 +49,7 @@
|
||||
#endif
|
||||
|
||||
/* Define setns() if missing from the C library */
|
||||
#ifndef HAVE_SETNS
|
||||
#if !HAVE_SETNS
|
||||
static inline int setns(int fd, int nstype)
|
||||
{
|
||||
#ifdef __NR_setns
|
||||
|
208
meson.build
208
meson.build
@ -206,15 +206,24 @@ foreach ident : [
|
||||
#include <unistd.h>'''],
|
||||
['close_range', '''#include <unistd.h>'''],
|
||||
['execveat', '''#include <unistd.h>'''],
|
||||
['endmntent', '''#include <stdio.h>
|
||||
#include <mntent.h>'''],
|
||||
['faccessat', '''#include <fcntl.h>
|
||||
#include <unistd.h>'''],
|
||||
['fexecve', '''#include <unistd.h>'''],
|
||||
['fgetln', '''#include <stdio.h>'''],
|
||||
['fsconfig', '''#include <sys/mount.h>'''],
|
||||
['fsmount', '''#include <sys/mount.h>'''],
|
||||
['fsopen', '''#include <sys/mount.h>'''],
|
||||
['fspick', '''#include <sys/mount.h>'''],
|
||||
['getgrgid_r', '''#include <sys/types.h>
|
||||
#include <grp.h>'''],
|
||||
['getline', '''#include <stdio.h>'''],
|
||||
['getsubopt', '''#include <stdlib.h>'''],
|
||||
['gettid', '''#include <sys/types.h>
|
||||
#include <unistd.h>'''],
|
||||
['hasmntopt', '''#include <stdio.h>
|
||||
#include <mntent.h>'''],
|
||||
['kcmp', '''#include <linux/kcmp.h>'''],
|
||||
['keyctl', '''#include <sys/types.h>
|
||||
#include <keyutils.h>'''],
|
||||
@ -243,19 +252,21 @@ foreach ident : [
|
||||
['renameat2', '''#include <stdio.h>
|
||||
#include <fcntl.h>'''],
|
||||
['sethostname', '''#include <unistd.h>'''],
|
||||
['setmntent', '''#include <stdio.h>
|
||||
#include <mntent.h>'''],
|
||||
['setns', '''#include <sched.h>'''],
|
||||
['signalfd', '''#include <sys/signalfd.h>'''],
|
||||
['statx', '''#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>'''],
|
||||
['strchrnul', '''#include <string.h>'''],
|
||||
['strlcat', '''#include <string.h>'''],
|
||||
['strlcpy', '''#include <string.h>'''],
|
||||
['unshare', '''#include <sched.h>'''],
|
||||
]
|
||||
|
||||
if cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
|
||||
conf.set10('HAVE_' + ident[0].to_upper(), true)
|
||||
endif
|
||||
have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
|
||||
conf.set10('HAVE_' + ident[0].to_upper(), have)
|
||||
endforeach
|
||||
|
||||
sh = find_program('sh')
|
||||
@ -335,32 +346,37 @@ if libcap_static.found()
|
||||
conf.set10('HAVE_STATIC_LIBCAP', libcap_static.found())
|
||||
endif
|
||||
|
||||
have = cc.has_function('strchrnul', prefix : '#include <string.h>', args : '-D_GNU_SOURCE')
|
||||
conf.set10('HAVE_STRCHRNUL', have)
|
||||
|
||||
have = cc.has_function('openpty', prefix : '#include <pty.h>', args : '-D_GNU_SOURCE')
|
||||
conf.set10('HAVE_OPENPTY', have)
|
||||
|
||||
config_h = configure_file(
|
||||
output : 'config.h',
|
||||
configuration : conf)
|
||||
|
||||
add_project_arguments('-include', 'config.h', language : 'c')
|
||||
|
||||
basic_includes = include_directories(
|
||||
'.',
|
||||
'src',
|
||||
'src/include',
|
||||
'.')
|
||||
'src/include')
|
||||
|
||||
liblxc_includes = [basic_includes, include_directories(
|
||||
'src/lxc/cgroups',
|
||||
'src/lxc/lsm',
|
||||
'src/lxc/storage')]
|
||||
|
||||
add_project_arguments('-include', 'config.h', language : 'c')
|
||||
|
||||
subdir('hooks')
|
||||
subdir('src/include')
|
||||
subdir('src/lxc/tools/include')
|
||||
subdir('hooks')
|
||||
subdir('src/lxc')
|
||||
subdir('src/lxc/cmd')
|
||||
subdir('src/lxc/tools')
|
||||
|
||||
config_h = configure_file(
|
||||
output : 'config.h',
|
||||
configuration : conf)
|
||||
|
||||
liblxc = shared_library(
|
||||
'lxc',
|
||||
version : liblxc_version,
|
||||
include_directories : tools_liblxc_includes,
|
||||
include_directories: liblxc_includes,
|
||||
link_args : ['-DPIC'],
|
||||
c_args : ['-DPIC'],
|
||||
link_whole : [liblxc_static],
|
||||
@ -381,156 +397,11 @@ liblxc_dep = declare_dependency(
|
||||
libselinux,
|
||||
libapparmor])
|
||||
|
||||
public_programs = []
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-autostart',
|
||||
tools_lxc_autostart_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-cgroup',
|
||||
tools_lxc_cgroup_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-checkpoint',
|
||||
tools_lxc_checkpoint_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-config',
|
||||
tools_lxc_config_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-console',
|
||||
tools_lxc_console_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-copy',
|
||||
tools_lxc_copy_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-create',
|
||||
tools_lxc_create_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-destroy',
|
||||
tools_lxc_destroy_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-device',
|
||||
tools_lxc_device_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-execute',
|
||||
tools_lxc_execute_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-freeze',
|
||||
tools_lxc_freeze_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-info',
|
||||
tools_lxc_info_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-ls',
|
||||
tools_lxc_ls_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-monitor',
|
||||
tools_lxc_monitor_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-snapshot',
|
||||
tools_lxc_snapshot_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-start',
|
||||
tools_lxc_start_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-stop',
|
||||
tools_lxc_stop_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-top',
|
||||
tools_lxc_top_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-unfreeze',
|
||||
tools_lxc_unfreeze_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-unshare',
|
||||
tools_lxc_unshare_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-wait',
|
||||
tools_lxc_wait_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
cmd_programs = []
|
||||
subdir('src/lxc/cmd')
|
||||
|
||||
public_programs = []
|
||||
subdir('src/lxc/tools')
|
||||
|
||||
cmd_programs += executable(
|
||||
'lxc-init',
|
||||
@ -564,14 +435,20 @@ missing_syscalls = []
|
||||
foreach tuple : [
|
||||
['bpf'],
|
||||
['close_range'],
|
||||
['endmntent'],
|
||||
['execveat'],
|
||||
['faccessat'],
|
||||
['fexecve'],
|
||||
['strchrnul'],
|
||||
['fgetln'],
|
||||
['fsconfig'],
|
||||
['fsmount'],
|
||||
['fsopen'],
|
||||
['fspick'],
|
||||
['getgrgid_r'],
|
||||
['getline'],
|
||||
['getsubopt'],
|
||||
['gettid'],
|
||||
['hasmntopt'],
|
||||
['kcmp'],
|
||||
['keyctl'],
|
||||
['memfd_create'],
|
||||
@ -587,6 +464,7 @@ foreach tuple : [
|
||||
['prlimit64'],
|
||||
['renameat2'],
|
||||
['sethostname'],
|
||||
['setmntent'],
|
||||
['setns'],
|
||||
['signalfd'],
|
||||
['statx'],
|
||||
|
@ -8,89 +8,50 @@ netns_ifaddrs_sources = files(
|
||||
'netns_ifaddrs.c',
|
||||
'netns_ifaddrs.h')
|
||||
|
||||
if cc.has_function('getline', prefix : '#include <stdio.h>', args : '-D_GNU_SOURCE')
|
||||
conf.set10('HAVE_GETLINE', true)
|
||||
else
|
||||
if conf.get('HAVE_GETLINE') == 0
|
||||
include_sources += files(
|
||||
'getline.c',
|
||||
'getline.h')
|
||||
endif
|
||||
|
||||
if cc.has_function('fexecve', prefix : '#include <unistd.h>', args : '-D_GNU_SOURCE')
|
||||
conf.set10('HAVE_FEXECVE', true)
|
||||
else
|
||||
if conf.get('HAVE_FEXECVE') == 0
|
||||
include_sources += files(
|
||||
'fexecve.c',
|
||||
'fexecve.h')
|
||||
endif
|
||||
|
||||
|
||||
getgr_headers = '''
|
||||
#include <sys/types.h>
|
||||
#include <grp.h>
|
||||
'''
|
||||
|
||||
if cc.has_function('getgrgid_r', prefix : getgr_headers, args : '-D_GNU_SOURCE')
|
||||
conf.set10('HAVE_GETGRGID_R', true)
|
||||
else
|
||||
if conf.get('HAVE_GETGRGID_R') == 0
|
||||
include_sources += files(
|
||||
'getgrgid_r.c',
|
||||
'getgrgid_r.h')
|
||||
endif
|
||||
|
||||
mntent_headers = '''
|
||||
#include <stdio.h>
|
||||
#include <mntent.h>
|
||||
'''
|
||||
|
||||
have_hasmntopt = cc.has_function('hasmntopt', prefix : mntent_headers, args : '-D_GNU_SOURCE')
|
||||
if have_hasmntopt
|
||||
conf.set10('HAVE_HASMNTOPT', true)
|
||||
endif
|
||||
|
||||
have_setmntent = cc.has_function('setmntent', prefix : mntent_headers, args : '-D_GNU_SOURCE')
|
||||
if have_setmntent
|
||||
conf.set10('HAVE_SETMNTENT', true)
|
||||
endif
|
||||
|
||||
have_endmntent = cc.has_function('endmntent', prefix : mntent_headers, args : '-D_GNU_SOURCE')
|
||||
if have_endmntent
|
||||
conf.set10('HAVE_ENDMNTENT', true)
|
||||
endif
|
||||
|
||||
if have_hasmntopt == false or have_setmntent == false or have_endmntent == false
|
||||
if conf.get('HAVE_HASMNTOPT') == 0 or conf.get('HAVE_SETMNTENT') == 0 or conf.get('HAVE_ENDMNTENT') == 0
|
||||
include_sources += files(
|
||||
'lxcmntent.c',
|
||||
'lxcmntent.h')
|
||||
endif
|
||||
|
||||
if cc.has_function('strlcpy', prefix : '#include <string.h>', args : '-D_GNU_SOURCE')
|
||||
conf.set10('HAVE_STRLCPY', true)
|
||||
else
|
||||
if conf.get('HAVE_STRLCPY') == 0
|
||||
include_sources += files(
|
||||
'strlcpy.c',
|
||||
'strlcpy.h')
|
||||
endif
|
||||
|
||||
if cc.has_function('strlcat', prefix : '#include <string.h>', args : '-D_GNU_SOURCE')
|
||||
conf.set10('HAVE_STRLCAT', true)
|
||||
else
|
||||
if conf.get('HAVE_STRLCAT') == 0
|
||||
include_sources += files(
|
||||
'strlcat.c',
|
||||
'strlcat.h')
|
||||
endif
|
||||
|
||||
if cc.has_function('strchrnul', prefix : '#include <string.h>', args : '-D_GNU_SOURCE')
|
||||
conf.set10('HAVE_STRCHRNUL', true)
|
||||
else
|
||||
if conf.get('HAVE_STRCHRNUL') == 0
|
||||
include_sources += files(
|
||||
'strchrnul.c',
|
||||
'strchrnul.h')
|
||||
endif
|
||||
|
||||
if cc.has_function('openpty', prefix : '#include <pty.h>', args : '-D_GNU_SOURCE')
|
||||
conf.set10('HAVE_OPENPTY', true)
|
||||
else
|
||||
if conf.get('HAVE_OPENPTY') == 0
|
||||
include_sources += files(
|
||||
'openpty.c',
|
||||
'openpty.h')
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef HAVE_STRLCPY
|
||||
#if !HAVE_STRLCPY
|
||||
#include "strlcpy.h"
|
||||
#endif
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "process_utils.h"
|
||||
#include "utils.h"
|
||||
|
||||
#ifndef HAVE_STRLCPY
|
||||
#if !HAVE_STRLCPY
|
||||
#include "strlcpy.h"
|
||||
#endif
|
||||
|
||||
|
@ -49,11 +49,11 @@
|
||||
#include "syscall_wrappers.h"
|
||||
#include "utils.h"
|
||||
|
||||
#ifndef HAVE_STRLCPY
|
||||
#if !HAVE_STRLCPY
|
||||
#include "strlcpy.h"
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRLCAT
|
||||
#if !HAVE_STRLCAT
|
||||
#include "strlcat.h"
|
||||
#endif
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "bpf.h"
|
||||
#include "bpf_common.h"
|
||||
|
||||
#ifndef HAVE_BPF
|
||||
#if !HAVE_BPF
|
||||
static inline int bpf_lxc(int cmd, union bpf_attr *attr, size_t size)
|
||||
{
|
||||
return syscall(__NR_bpf, cmd, attr, size);
|
||||
|
@ -80,7 +80,7 @@
|
||||
#include <sys/capability.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRLCAT
|
||||
#if !HAVE_STRLCAT
|
||||
#include "strlcat.h"
|
||||
#endif
|
||||
|
||||
@ -94,11 +94,11 @@
|
||||
#include "prlimit.h"
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRLCPY
|
||||
#if !HAVE_STRLCPY
|
||||
#include "strlcpy.h"
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRCHRNUL
|
||||
#if !HAVE_STRCHRNUL
|
||||
#include "strchrnul.h"
|
||||
#endif
|
||||
|
||||
|
@ -35,11 +35,11 @@
|
||||
#include "parse.h"
|
||||
#include "utils.h"
|
||||
|
||||
#ifndef HAVE_STRLCPY
|
||||
#if !HAVE_STRLCPY
|
||||
#include "strlcpy.h"
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRLCAT
|
||||
#if !HAVE_STRLCAT
|
||||
#include "strlcat.h"
|
||||
#endif
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "parse.h"
|
||||
#include "utils.h"
|
||||
|
||||
#ifndef HAVE_STRLCPY
|
||||
#if !HAVE_STRLCPY
|
||||
#include "strlcpy.h"
|
||||
#endif
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include <mntent.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRLCPY
|
||||
#if !HAVE_STRLCPY
|
||||
#include "strlcpy.h"
|
||||
#endif
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "memory_utils.h"
|
||||
#include "utils.h"
|
||||
|
||||
#ifndef HAVE_STRLCPY
|
||||
#if !HAVE_STRLCPY
|
||||
#include "strlcpy.h"
|
||||
#endif
|
||||
|
||||
|
@ -76,7 +76,7 @@
|
||||
#include <mntent.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRLCPY
|
||||
#if !HAVE_STRLCPY
|
||||
#include "include/strlcpy.h"
|
||||
#endif
|
||||
|
||||
|
@ -731,7 +731,7 @@ enum {
|
||||
#define hweight32(w) __const_hweight32(w)
|
||||
#define hweight64(w) __const_hweight64(w)
|
||||
|
||||
#ifndef HAVE___ALIGNED_U64
|
||||
#if !HAVE___ALIGNED_U64
|
||||
#define __aligned_u64 __u64 __attribute__((aligned(8)))
|
||||
#endif
|
||||
|
||||
@ -739,7 +739,7 @@ enum {
|
||||
#define BITS_PER_TYPE(type) (sizeof(type) * 8)
|
||||
#define LAST_BIT_PER_TYPE(type) (BITS_PER_TYPE(type) - 1)
|
||||
|
||||
#ifndef HAVE_SYS_PERSONALITY_H
|
||||
#if !HAVE_SYS_PERSONALITY_H
|
||||
#define PER_LINUX 0x0000
|
||||
#define PER_LINUX32 0x0008
|
||||
#endif
|
||||
|
@ -254,7 +254,7 @@ __hidden extern pid_t lxc_raw_legacy_clone(unsigned long flags, int *pidfd);
|
||||
__hidden extern pid_t lxc_raw_clone_cb(int (*fn)(void *), void *args, unsigned long flags,
|
||||
int *pidfd);
|
||||
|
||||
#ifndef HAVE_EXECVEAT
|
||||
#if !HAVE_EXECVEAT
|
||||
static inline int execveat(int dirfd, const char *pathname, char *const argv[],
|
||||
char *const envp[], int flags)
|
||||
{
|
||||
|
@ -62,7 +62,7 @@
|
||||
#include <sys/capability.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRLCPY
|
||||
#if !HAVE_STRLCPY
|
||||
#include "strlcpy.h"
|
||||
#endif
|
||||
|
||||
|
@ -28,11 +28,11 @@
|
||||
#include "macro.h"
|
||||
#include "memory_utils.h"
|
||||
|
||||
#ifndef HAVE_STRLCPY
|
||||
#if !HAVE_STRLCPY
|
||||
#include "strlcpy.h"
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRLCAT
|
||||
#if !HAVE_STRLCAT
|
||||
#include "strlcat.h"
|
||||
#endif
|
||||
|
||||
|
@ -10,15 +10,15 @@
|
||||
#include "initutils.h"
|
||||
#include "macro.h"
|
||||
|
||||
#ifndef HAVE_STRLCAT
|
||||
#if !HAVE_STRLCAT
|
||||
#include "strlcat.h"
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRLCPY
|
||||
#if !HAVE_STRLCPY
|
||||
#include "strlcpy.h"
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRCHRNUL
|
||||
#if !HAVE_STRCHRNUL
|
||||
#include "strchrnul.h"
|
||||
#endif
|
||||
|
||||
|
@ -54,7 +54,7 @@ static inline long __keyctl(int cmd, unsigned long arg2, unsigned long arg3,
|
||||
#define F_SEAL_WRITE 0x0008
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_MEMFD_CREATE
|
||||
#if !HAVE_MEMFD_CREATE
|
||||
static inline int memfd_create_lxc(const char *name, unsigned int flags)
|
||||
{
|
||||
return syscall(__NR_memfd_create, name, flags);
|
||||
@ -64,7 +64,7 @@ static inline int memfd_create_lxc(const char *name, unsigned int flags)
|
||||
extern int memfd_create(const char *name, unsigned int flags);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_PIVOT_ROOT
|
||||
#if !HAVE_PIVOT_ROOT
|
||||
static inline int pivot_root(const char *new_root, const char *put_old)
|
||||
{
|
||||
return syscall(__NR_pivot_root, new_root, put_old);
|
||||
@ -74,7 +74,7 @@ extern int pivot_root(const char *new_root, const char *put_old);
|
||||
#endif
|
||||
|
||||
/* Define sethostname() if missing from the C library */
|
||||
#ifndef HAVE_SETHOSTNAME
|
||||
#if !HAVE_SETHOSTNAME
|
||||
static inline int sethostname(const char *name, size_t len)
|
||||
{
|
||||
return syscall(__NR_sethostname, name, len);
|
||||
@ -82,14 +82,14 @@ static inline int sethostname(const char *name, size_t len)
|
||||
#endif
|
||||
|
||||
/* Define setns() if missing from the C library */
|
||||
#ifndef HAVE_SETNS
|
||||
#if !HAVE_SETNS
|
||||
static inline int setns(int fd, int nstype)
|
||||
{
|
||||
return syscall(__NR_setns, fd, nstype);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_SYS_SIGNALFD_H
|
||||
#if !HAVE_SYS_SIGNALFD_H
|
||||
struct signalfd_siginfo {
|
||||
uint32_t ssi_signo;
|
||||
int32_t ssi_errno;
|
||||
@ -125,7 +125,7 @@ static inline int signalfd(int fd, const sigset_t *mask, int flags)
|
||||
#endif
|
||||
|
||||
/* Define unshare() if missing from the C library */
|
||||
#ifndef HAVE_UNSHARE
|
||||
#if !HAVE_UNSHARE
|
||||
static inline int unshare(int flags)
|
||||
{
|
||||
return syscall(__NR_unshare, flags);
|
||||
@ -135,14 +135,14 @@ extern int unshare(int);
|
||||
#endif
|
||||
|
||||
/* Define faccessat() if missing from the C library */
|
||||
#ifndef HAVE_FACCESSAT
|
||||
#if !HAVE_FACCESSAT
|
||||
static int faccessat(int __fd, const char *__file, int __type, int __flag)
|
||||
{
|
||||
return syscall(__NR_faccessat, __fd, __file, __type, __flag);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_MOVE_MOUNT
|
||||
#if !HAVE_MOVE_MOUNT
|
||||
static inline int move_mount_lxc(int from_dfd, const char *from_pathname,
|
||||
int to_dfd, const char *to_pathname,
|
||||
unsigned int flags)
|
||||
@ -156,7 +156,7 @@ extern int move_mount(int from_dfd, const char *from_pathname, int to_dfd,
|
||||
const char *to_pathname, unsigned int flags);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_OPEN_TREE
|
||||
#if !HAVE_OPEN_TREE
|
||||
static inline int open_tree_lxc(int dfd, const char *filename, unsigned int flags)
|
||||
{
|
||||
return syscall(__NR_open_tree, dfd, filename, flags);
|
||||
@ -166,7 +166,7 @@ static inline int open_tree_lxc(int dfd, const char *filename, unsigned int flag
|
||||
extern int open_tree(int dfd, const char *filename, unsigned int flags);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_FSOPEN
|
||||
#if !HAVE_FSOPEN
|
||||
static inline int fsopen_lxc(const char *fs_name, unsigned int flags)
|
||||
{
|
||||
return syscall(__NR_fsopen, fs_name, flags);
|
||||
@ -176,7 +176,7 @@ static inline int fsopen_lxc(const char *fs_name, unsigned int flags)
|
||||
extern int fsopen(const char *fs_name, unsigned int flags);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_FSPICK
|
||||
#if !HAVE_FSPICK
|
||||
static inline int fspick_lxc(int dfd, const char *path, unsigned int flags)
|
||||
{
|
||||
return syscall(__NR_fspick, dfd, path, flags);
|
||||
@ -186,7 +186,7 @@ static inline int fspick_lxc(int dfd, const char *path, unsigned int flags)
|
||||
extern int fspick(int dfd, const char *path, unsigned int flags);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_FSCONFIG
|
||||
#if !HAVE_FSCONFIG
|
||||
static inline int fsconfig_lxc(int fd, unsigned int cmd, const char *key, const void *value, int aux)
|
||||
{
|
||||
return syscall(__NR_fsconfig, fd, cmd, key, value, aux);
|
||||
@ -196,7 +196,7 @@ static inline int fsconfig_lxc(int fd, unsigned int cmd, const char *key, const
|
||||
extern int fsconfig(int fd, unsigned int cmd, const char *key, const void *value, int aux);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_FSMOUNT
|
||||
#if !HAVE_FSMOUNT
|
||||
static inline int fsmount_lxc(int fs_fd, unsigned int flags, unsigned int attr_flags)
|
||||
{
|
||||
return syscall(__NR_fsmount, fs_fd, flags, attr_flags);
|
||||
@ -216,7 +216,7 @@ struct lxc_mount_attr {
|
||||
__u64 userns_fd;
|
||||
};
|
||||
|
||||
#ifndef HAVE_MOUNT_SETATTR
|
||||
#if !HAVE_MOUNT_SETATTR
|
||||
static inline int mount_setattr(int dfd, const char *path, unsigned int flags,
|
||||
struct lxc_mount_attr *attr, size_t size)
|
||||
{
|
||||
@ -291,7 +291,7 @@ struct lxc_open_how {
|
||||
#define PROTECT_OPEN_W (PROTECT_OPEN_W_WITH_TRAILING_SYMLINKS | O_NOFOLLOW)
|
||||
#define PROTECT_OPEN_RW (O_CLOEXEC | O_NOCTTY | O_RDWR | O_NOFOLLOW)
|
||||
|
||||
#ifndef HAVE_OPENAT2
|
||||
#if !HAVE_OPENAT2
|
||||
static inline int openat2(int dfd, const char *filename, struct lxc_open_how *how, size_t size)
|
||||
{
|
||||
return syscall(__NR_openat2, dfd, filename, how, size);
|
||||
@ -306,14 +306,14 @@ static inline int openat2(int dfd, const char *filename, struct lxc_open_how *ho
|
||||
#define CLOSE_RANGE_CLOEXEC (1U << 2)
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_CLOSE_RANGE
|
||||
#if !HAVE_CLOSE_RANGE
|
||||
static inline int close_range(unsigned int fd, unsigned int max_fd, unsigned int flags)
|
||||
{
|
||||
return syscall(__NR_close_range, fd, max_fd, flags);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_SYS_PERSONALITY_H
|
||||
#if !HAVE_SYS_PERSONALITY_H
|
||||
static inline int personality(unsigned long persona)
|
||||
{
|
||||
return syscall(__NR_personality, persona);
|
||||
|
7
src/lxc/tools/include/meson.build
Normal file
7
src/lxc/tools/include/meson.build
Normal file
@ -0,0 +1,7 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
if conf.get('HAVE_GETSUBOPT') == 0
|
||||
include_sources += files(
|
||||
'getsubopt.c',
|
||||
'getsubopt.h')
|
||||
endif
|
@ -6,7 +6,8 @@ tools_liblxc_includes = include_directories(
|
||||
'../cgroups',
|
||||
'../lsm',
|
||||
'../storage',
|
||||
'../../include')
|
||||
'../../include',
|
||||
'../../../')
|
||||
|
||||
tools_common_sources = files(
|
||||
'arguments.c',
|
||||
@ -123,14 +124,6 @@ tools_lxc_config_sources = files(
|
||||
tools_lxc_console_sources = files(
|
||||
'lxc_console.c') + tools_common_sources
|
||||
|
||||
if cc.has_function('getsubopt', prefix : '#include <stdlib.h>', args : '-D_GNU_SOURCE')
|
||||
conf.set10('HAVE_GETSUBOPT', true)
|
||||
else
|
||||
include_sources += files(
|
||||
'tools/include/getsubopt.c',
|
||||
'tools/include/getsubopt.h')
|
||||
endif
|
||||
|
||||
tools_lxc_copy_sources = files(
|
||||
'lxc_copy.c') + tools_common_sources
|
||||
|
||||
@ -178,3 +171,150 @@ tools_lxc_unshare_sources = files(
|
||||
|
||||
tools_lxc_wait_sources = files(
|
||||
'lxc_wait.c') + tools_common_sources
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-autostart',
|
||||
tools_lxc_autostart_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-cgroup',
|
||||
tools_lxc_cgroup_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-checkpoint',
|
||||
tools_lxc_checkpoint_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-config',
|
||||
tools_lxc_config_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-console',
|
||||
tools_lxc_console_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-copy',
|
||||
tools_lxc_copy_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-create',
|
||||
tools_lxc_create_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-destroy',
|
||||
tools_lxc_destroy_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-device',
|
||||
tools_lxc_device_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-execute',
|
||||
tools_lxc_execute_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-freeze',
|
||||
tools_lxc_freeze_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-info',
|
||||
tools_lxc_info_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-ls',
|
||||
tools_lxc_ls_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-monitor',
|
||||
tools_lxc_monitor_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-snapshot',
|
||||
tools_lxc_snapshot_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-start',
|
||||
tools_lxc_start_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-stop',
|
||||
tools_lxc_stop_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-top',
|
||||
tools_lxc_top_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-unfreeze',
|
||||
tools_lxc_unfreeze_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-unshare',
|
||||
tools_lxc_unshare_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
||||
public_programs += executable(
|
||||
'lxc-wait',
|
||||
tools_lxc_wait_sources,
|
||||
include_directories : tools_liblxc_includes,
|
||||
dependencies : liblxc_dep,
|
||||
install : true)
|
||||
|
@ -39,11 +39,11 @@
|
||||
#include "syscall_wrappers.h"
|
||||
#include "utils.h"
|
||||
|
||||
#ifndef HAVE_STRLCPY
|
||||
#if !HAVE_STRLCPY
|
||||
#include "strlcpy.h"
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRLCAT
|
||||
#if !HAVE_STRLCAT
|
||||
#include "strlcat.h"
|
||||
#endif
|
||||
|
||||
|
@ -33,8 +33,8 @@ __hidden extern int mkdir_p(const char *dir, mode_t mode);
|
||||
__hidden extern char *get_rundir(void);
|
||||
|
||||
/* Define getline() if missing from the C library */
|
||||
#ifndef HAVE_GETLINE
|
||||
#ifdef HAVE_FGETLN
|
||||
#if !HAVE_GETLINE
|
||||
#if !HAVE_FGETLN
|
||||
#include "getline.h"
|
||||
#endif
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user