state.c state.h \
string_utils.c string_utils.h \
sync.c sync.h \
- terminal.c terminal.h
+ terminal.c terminal.h \
+ utils.c utils.h
if ENABLE_SECCOMP
lxc_attach_SOURCES += seccomp.c lxcseccomp.h
endif
state.c state.h \
string_utils.c string_utils.h \
sync.c sync.h \
- terminal.c terminal.h
+ terminal.c terminal.h \
+ utils.c utils.h
if ENABLE_SECCOMP
lxc_autostart_SOURCES += seccomp.c lxcseccomp.h
endif
state.c state.h \
string_utils.c string_utils.h \
sync.c sync.h \
- terminal.c terminal.h
+ terminal.c terminal.h \
+ utils.c utils.h
if ENABLE_SECCOMP
lxc_cgroup_SOURCES += seccomp.c lxcseccomp.h
endif
state.c state.h \
string_utils.c string_utils.h \
sync.c sync.h \
- terminal.c terminal.h
+ terminal.c terminal.h \
+ utils.c utils.h
if ENABLE_SECCOMP
lxc_config_SOURCES += seccomp.c lxcseccomp.h
endif
state.c state.h \
string_utils.c string_utils.h \
sync.c sync.h \
- terminal.c terminal.h
+ terminal.c terminal.h \
+ utils.c utils.h
if ENABLE_SECCOMP
lxc_console_SOURCES += seccomp.c lxcseccomp.h
endif
state.c state.h \
string_utils.c string_utils.h \
sync.c sync.h \
- terminal.c terminal.h
+ terminal.c terminal.h \
+ utils.c utils.h
if ENABLE_SECCOMP
lxc_destroy_SOURCES += seccomp.c lxcseccomp.h
endif
state.c state.h \
string_utils.c string_utils.h \
sync.c sync.h \
- terminal.c terminal.h
+ terminal.c terminal.h \
+ utils.c utils.h
if ENABLE_SECCOMP
lxc_device_SOURCES += seccomp.c lxcseccomp.h
endif
state.c state.h \
string_utils.c string_utils.h \
sync.c sync.h \
- terminal.c terminal.h
+ terminal.c terminal.h \
+ utils.c utils.h
if ENABLE_SECCOMP
lxc_execute_SOURCES += seccomp.c lxcseccomp.h
endif
state.c state.h \
string_utils.c string_utils.h \
sync.c sync.h \
- terminal.c terminal.h
+ terminal.c terminal.h \
+ utils.c utils.h
if ENABLE_SECCOMP
lxc_freeze_SOURCES += seccomp.c lxcseccomp.h
endif
state.c state.h \
string_utils.c string_utils.h \
sync.c sync.h \
- terminal.c terminal.h
+ terminal.c terminal.h \
+ utils.c utils.h
if ENABLE_SECCOMP
lxc_info_SOURCES += seccomp.c lxcseccomp.h
endif
state.c state.h \
string_utils.c string_utils.h \
sync.c sync.h \
- terminal.c terminal.h
+ terminal.c terminal.h \
+ utils.c utils.h
if ENABLE_SECCOMP
lxc_monitor_SOURCES += seccomp.c lxcseccomp.h
endif
state.c state.h \
string_utils.c string_utils.h \
sync.c sync.h \
- terminal.c terminal.h
+ terminal.c terminal.h \
+ utils.c utils.h
if ENABLE_SECCOMP
lxc_ls_SOURCES += seccomp.c lxcseccomp.h
endif
storage/storage_utils.c storage/storage_utils.h \
string_utils.c string_utils.h \
sync.c sync.h \
- terminal.c terminal.h
+ terminal.c terminal.h \
+ utils.c utils.h
if ENABLE_SECCOMP
lxc_copy_SOURCES += seccomp.c lxcseccomp.h
endif
state.c state.h \
string_utils.c string_utils.h \
sync.c sync.h \
- terminal.c terminal.h
+ terminal.c terminal.h \
+ utils.c utils.h
if ENABLE_SECCOMP
lxc_start_SOURCES += seccomp.c lxcseccomp.h
endif
state.c state.h \
string_utils.c string_utils.h \
sync.c sync.h \
- terminal.c terminal.h
+ terminal.c terminal.h \
+ utils.c utils.h
if ENABLE_SECCOMP
lxc_stop_SOURCES += seccomp.c lxcseccomp.h
endif
state.c state.h \
string_utils.c string_utils.h \
sync.c sync.h \
- terminal.c terminal.h
+ terminal.c terminal.h \
+ utils.c utils.h
if ENABLE_SECCOMP
lxc_top_SOURCES += seccomp.c lxcseccomp.h
endif
state.c state.h \
string_utils.c string_utils.h \
sync.c sync.h \
- terminal.c terminal.h
+ terminal.c terminal.h \
+ utils.c utils.h
if ENABLE_SECCOMP
lxc_unfreeze_SOURCES += seccomp.c lxcseccomp.h
endif
sync.c sync.h \
syscall_numbers.h \
syscall_wrappers.h \
- terminal.c terminal.h
+ terminal.c terminal.h \
+ utils.c utils.h
if ENABLE_SECCOMP
lxc_unshare_SOURCES += seccomp.c lxcseccomp.h
endif
state.c state.h \
string_utils.c string_utils.h \
sync.c sync.h \
- terminal.c terminal.h
+ terminal.c terminal.h \
+ utils.c utils.h
if ENABLE_SECCOMP
lxc_wait_SOURCES += seccomp.c lxcseccomp.h
endif
storage/storage_utils.c storage/storage_utils.h \
string_utils.c string_utils.h \
sync.c sync.h \
- terminal.c terminal.h
+ terminal.c terminal.h \
+ utils.c utils.h
if ENABLE_SECCOMP
lxc_create_SOURCES += seccomp.c lxcseccomp.h
endif
state.c state.h \
string_utils.c string_utils.h \
sync.c sync.h \
- terminal.c terminal.h
+ terminal.c terminal.h \
+ utils.c utils.h
if ENABLE_SECCOMP
lxc_snapshot_SOURCES += seccomp.c lxcseccomp.h
endif
state.c state.h \
string_utils.c string_utils.h \
sync.c sync.h \
- terminal.c terminal.h
+ terminal.c terminal.h \
+ utils.c utils.h
if ENABLE_SECCOMP
lxc_checkpoint_SOURCES += seccomp.c lxcseccomp.h
endif
sync.c sync.h \
syscall_numbers.h \
syscall_wrappers.h \
- terminal.c terminal.h
+ terminal.c terminal.h \
+ utils.c utils.h
if ENABLE_SECCOMP
lxc_user_nic_SOURCES += seccomp.c lxcseccomp.h
endif
#include <sys/vfs.h>
#include <unistd.h>
+#include "compiler.h"
#include "file_utils.h"
#include "initutils.h"
#include "macro.h"
#include "string_utils.h"
/* returns 1 on success, 0 if there were any failures */
-extern int lxc_rmdir_onedev(const char *path, const char *exclude);
-extern int get_u16(unsigned short *val, const char *arg, int base);
-extern int mkdir_p(const char *dir, mode_t mode);
-extern char *get_rundir(void);
+__hidden extern int lxc_rmdir_onedev(const char *path, const char *exclude);
+__hidden extern int get_u16(unsigned short *val, const char *arg, int base);
+__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
* Returns pointer to struct lxc_popen_FILE, that should be freed with lxc_pclose().
* On error returns NULL.
*/
-extern struct lxc_popen_FILE *lxc_popen(const char *command);
+__hidden extern struct lxc_popen_FILE *lxc_popen(const char *command);
/* pclose() replacement to be used on struct lxc_popen_FILE *,
* returned by lxc_popen().
* Waits for associated process to terminate, returns its exit status and
* frees resources, pointed to by struct lxc_popen_FILE *.
*/
-extern int lxc_pclose(struct lxc_popen_FILE *fp);
+__hidden extern int lxc_pclose(struct lxc_popen_FILE *fp);
static inline void __auto_lxc_pclose__(struct lxc_popen_FILE **f)
{
/*
* wait on a child we forked
*/
-extern int wait_for_pid(pid_t pid);
-extern int lxc_wait_for_pid_status(pid_t pid);
-extern int wait_for_pidfd(int pidfd);
+__hidden extern int wait_for_pid(pid_t pid);
+__hidden extern int lxc_wait_for_pid_status(pid_t pid);
+__hidden extern int wait_for_pidfd(int pidfd);
#if HAVE_OPENSSL
-extern int sha1sum_file(char *fnam, unsigned char *md_value, unsigned int *md_len);
+__hidden extern int sha1sum_file(char *fnam, unsigned char *md_value, unsigned int *md_len);
#endif
/* initialize rand with urandom */
-extern int randseed(bool);
+__hidden extern int randseed(bool);
/* are we unprivileged with respect to our namespaces */
inline static bool am_guest_unpriv(void) {
/*
* parse /proc/self/uid_map to find what @orig maps to
*/
-extern uid_t get_ns_uid(uid_t orig);
+__hidden extern uid_t get_ns_uid(uid_t orig);
/*
* parse /proc/self/gid_map to find what @orig maps to
*/
-extern gid_t get_ns_gid(gid_t orig);
+__hidden extern gid_t get_ns_gid(gid_t orig);
-extern bool dir_exists(const char *path);
+__hidden extern bool dir_exists(const char *path);
#define FNV1A_64_INIT ((uint64_t)0xcbf29ce484222325ULL)
-extern uint64_t fnv_64a_buf(void *buf, size_t len, uint64_t hval);
-
-extern bool is_shared_mountpoint(const char *path);
-extern int detect_shared_rootfs(void);
-extern bool detect_ramfs_rootfs(void);
-extern char *on_path(const char *cmd, const char *rootfs);
-extern bool cgns_supported(void);
-extern char *choose_init(const char *rootfs);
-extern bool switch_to_ns(pid_t pid, const char *ns);
-extern char *get_template_path(const char *t);
-extern int safe_mount(const char *src, const char *dest, const char *fstype,
- unsigned long flags, const void *data,
- const char *rootfs);
-extern int lxc_mount_proc_if_needed(const char *rootfs);
-extern int open_devnull(void);
-extern int set_stdfds(int fd);
-extern int null_stdfds(void);
-extern int lxc_preserve_ns(const int pid, const char *ns);
+__hidden extern uint64_t fnv_64a_buf(void *buf, size_t len, uint64_t hval);
+
+__hidden extern bool is_shared_mountpoint(const char *path);
+__hidden extern int detect_shared_rootfs(void);
+__hidden extern bool detect_ramfs_rootfs(void);
+__hidden extern char *on_path(const char *cmd, const char *rootfs);
+__hidden extern bool cgns_supported(void);
+__hidden extern char *choose_init(const char *rootfs);
+__hidden extern bool switch_to_ns(pid_t pid, const char *ns);
+__hidden extern char *get_template_path(const char *t);
+__hidden extern int safe_mount(const char *src, const char *dest, const char *fstype,
+ unsigned long flags, const void *data, const char *rootfs);
+__hidden extern int lxc_mount_proc_if_needed(const char *rootfs);
+__hidden extern int open_devnull(void);
+__hidden extern int set_stdfds(int fd);
+__hidden extern int null_stdfds(void);
+__hidden extern int lxc_preserve_ns(const int pid, const char *ns);
/* Check whether a signal is blocked by a process. */
-extern bool task_blocks_signal(pid_t pid, int signal);
+__hidden extern bool task_blocks_signal(pid_t pid, int signal);
/* Switch to a new uid and gid.
* If LXC_INVALID_{G,U}ID is passed then the set{g,u}id() will not be called.
*/
-extern bool lxc_switch_uid_gid(uid_t uid, gid_t gid);
-extern bool lxc_setgroups(int size, gid_t list[]);
+__hidden extern bool lxc_switch_uid_gid(uid_t uid, gid_t gid);
+__hidden extern bool lxc_setgroups(int size, gid_t list[]);
/* Find an unused loop device and associate it with source. */
-extern int lxc_prepare_loop_dev(const char *source, char *loop_dev, int flags);
+__hidden extern int lxc_prepare_loop_dev(const char *source, char *loop_dev, int flags);
/* Clear all mounts on a given node.
* >= 0 successfully cleared. The number returned is the number of umounts
* performed.
* < 0 error umounting. Return -errno.
*/
-extern int lxc_unstack_mountpoint(const char *path, bool lazy);
+__hidden extern int lxc_unstack_mountpoint(const char *path, bool lazy);
/*
* run_command runs a command and collect it's std{err,out} output in buf.
* function must exec.
* @param[in] args Arguments to be passed to child_fn.
*/
-extern int run_command(char *buf, size_t buf_size, int (*child_fn)(void *),
- void *args);
+__hidden extern int run_command(char *buf, size_t buf_size, int (*child_fn)(void *), void *args);
/*
* run_command runs a command and collect it's std{err,out} output in buf, returns exit status.
* function must exec.
* @param[in] args Arguments to be passed to child_fn.
*/
-extern int run_command_status(char *buf, size_t buf_size, int (*child_fn)(void *),
- void *args);
+__hidden extern int run_command_status(char *buf, size_t buf_size, int (*child_fn)(void *),
+ void *args);
-extern bool lxc_nic_exists(char *nic);
+__hidden extern bool lxc_nic_exists(char *nic);
static inline uint64_t lxc_getpagesize(void)
{
* If the caller passes in 0 they will receive 0 in return since this is invalid
* input and 0 is not a power of 2.
*/
-extern uint64_t lxc_find_next_power2(uint64_t n);
+__hidden extern uint64_t lxc_find_next_power2(uint64_t n);
/* Set a signal the child process will receive after the parent has died. */
-extern int lxc_set_death_signal(int signal, pid_t parent, int parent_status_fd);
-extern int fd_cloexec(int fd, bool cloexec);
-extern int lxc_rm_rf(const char *dirname);
-extern int lxc_setup_keyring(char *keyring_label);
-extern bool lxc_can_use_pidfd(int pidfd);
+__hidden extern int lxc_set_death_signal(int signal, pid_t parent, int parent_status_fd);
+__hidden extern int fd_cloexec(int fd, bool cloexec);
+__hidden extern int lxc_rm_rf(const char *dirname);
+__hidden extern int lxc_setup_keyring(char *keyring_label);
+__hidden extern bool lxc_can_use_pidfd(int pidfd);
-extern int fix_stdio_permissions(uid_t uid);
+__hidden extern int fix_stdio_permissions(uid_t uid);
static inline bool uid_valid(uid_t uid)
{
return gid != LXC_INVALID_GID;
}
-extern bool multiply_overflow(int64_t base, uint64_t mult, int64_t *res);
+__hidden extern bool multiply_overflow(int64_t base, uint64_t mult, int64_t *res);
#endif /* __LXC_UTILS_H */
../lxc/state.c ../lxc/state.h \
../lxc/sync.c ../lxc/sync.h \
../lxc/string_utils.c ../lxc/string_utils.h \
- ../lxc/terminal.c ../lxc/terminal.h
+ ../lxc/terminal.c ../lxc/terminal.h \
+ ../lxc/utils.c ../lxc/utils.h
if ENABLE_SECCOMP
lxc_test_api_reboot_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h
endif
-lxc_test_apparmor_SOURCES = aa.c
+lxc_test_apparmor_SOURCES = aa.c \
+ ../lxc/af_unix.c ../lxc/af_unix.h \
+ ../lxc/caps.c ../lxc/caps.h \
+ ../lxc/commands.c ../lxc/commands.h \
+ ../lxc/commands_utils.c ../lxc/commands_utils.h \
+ ../lxc/conf.c ../lxc/conf.h \
+ ../lxc/confile.c ../lxc/confile.h \
+ ../lxc/confile_utils.c ../lxc/confile_utils.h \
+ ../lxc/error.c ../lxc/error.h \
+ ../lxc/file_utils.c ../lxc/file_utils.h \
+ ../lxc/initutils.c ../lxc/initutils.h \
+ ../lxc/log.c ../lxc/log.h \
+ ../lxc/lxclock.c ../lxc/lxclock.h \
+ ../lxc/mainloop.c ../lxc/mainloop.h \
+ ../lxc/monitor.c ../lxc/monitor.h \
+ ../lxc/namespace.c ../lxc/namespace.h \
+ ../lxc/network.c ../lxc/network.h \
+ ../lxc/nl.c ../lxc/nl.h \
+ ../lxc/parse.c ../lxc/parse.h \
+ ../lxc/process_utils.c ../lxc/process_utils.h \
+ ../lxc/ringbuf.c ../lxc/ringbuf.h \
+ ../lxc/start.c ../lxc/start.h \
+ ../lxc/state.c ../lxc/state.h \
+ ../lxc/sync.c ../lxc/sync.h \
+ ../lxc/string_utils.c ../lxc/string_utils.h \
+ ../lxc/terminal.c ../lxc/terminal.h \
+ ../lxc/utils.c ../lxc/utils.h
+if ENABLE_SECCOMP
+lxc_test_apparmor_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h
+endif
+
lxc_test_attach_SOURCES = attach.c \
../lxc/af_unix.c ../lxc/af_unix.h \
../lxc/caps.c ../lxc/caps.h \
../lxc/state.c ../lxc/state.h \
../lxc/sync.c ../lxc/sync.h \
../lxc/string_utils.c ../lxc/string_utils.h \
- ../lxc/terminal.c ../lxc/terminal.h
+ ../lxc/terminal.c ../lxc/terminal.h \
+ ../lxc/utils.c ../lxc/utils.h
if ENABLE_SECCOMP
lxc_test_attach_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h
endif
../lxc/state.c ../lxc/state.h \
../lxc/sync.c ../lxc/sync.h \
../lxc/string_utils.c ../lxc/string_utils.h \
- ../lxc/terminal.c ../lxc/terminal.h
+ ../lxc/terminal.c ../lxc/terminal.h \
+ ../lxc/utils.c ../lxc/utils.h
if ENABLE_SECCOMP
lxc_test_cgpath_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h
endif
../lxc/state.c ../lxc/state.h \
../lxc/sync.c ../lxc/sync.h \
../lxc/string_utils.c ../lxc/string_utils.h \
- ../lxc/terminal.c ../lxc/terminal.h
+ ../lxc/terminal.c ../lxc/terminal.h \
+ ../lxc/utils.c ../lxc/utils.h
if ENABLE_SECCOMP
lxc_test_config_jump_table_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h
endif
lxc_test_get_item_SOURCES = get_item.c
lxc_test_list_SOURCES = list.c
lxc_test_locktests_SOURCES = locktests.c \
+ ../lxc/af_unix.c ../lxc/af_unix.h \
../lxc/caps.c ../lxc/caps.h \
+ ../lxc/commands.c ../lxc/commands.h \
+ ../lxc/commands_utils.c ../lxc/commands_utils.h \
+ ../lxc/conf.c ../lxc/conf.h \
+ ../lxc/confile.c ../lxc/confile.h \
+ ../lxc/confile_utils.c ../lxc/confile_utils.h \
+ ../lxc/error.c ../lxc/error.h \
../lxc/file_utils.c ../lxc/file_utils.h \
+ ../lxc/initutils.c ../lxc/initutils.h \
../lxc/log.c ../lxc/log.h \
../lxc/lxclock.c ../lxc/lxclock.h \
- ../lxc/string_utils.c ../lxc/string_utils.h
+ ../lxc/mainloop.c ../lxc/mainloop.h \
+ ../lxc/monitor.c ../lxc/monitor.h \
+ ../lxc/namespace.c ../lxc/namespace.h \
+ ../lxc/network.c ../lxc/network.h \
+ ../lxc/nl.c ../lxc/nl.h \
+ ../lxc/parse.c ../lxc/parse.h \
+ ../lxc/process_utils.c ../lxc/process_utils.h \
+ ../lxc/ringbuf.c ../lxc/ringbuf.h \
+ ../lxc/start.c ../lxc/start.h \
+ ../lxc/state.c ../lxc/state.h \
+ ../lxc/sync.c ../lxc/sync.h \
+ ../lxc/string_utils.c ../lxc/string_utils.h \
+ ../lxc/terminal.c ../lxc/terminal.h \
+ ../lxc/utils.c ../lxc/utils.h
+if ENABLE_SECCOMP
+lxc_test_locktests_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h
+endif
+
lxc_test_lxcpath_SOURCES = lxcpath.c
lxc_test_may_control_SOURCES = may_control.c
lxc_test_mount_injection_SOURCES = mount_injection.c \
lxctest.h \
+ ../lxc/af_unix.c ../lxc/af_unix.h \
+ ../lxc/caps.c ../lxc/caps.h \
+ ../lxc/commands.c ../lxc/commands.h \
+ ../lxc/commands_utils.c ../lxc/commands_utils.h \
+ ../lxc/conf.c ../lxc/conf.h \
+ ../lxc/confile.c ../lxc/confile.h \
+ ../lxc/confile_utils.c ../lxc/confile_utils.h \
+ ../lxc/error.c ../lxc/error.h \
../lxc/file_utils.c ../lxc/file_utils.h \
- ../lxc/string_utils.c ../lxc/string_utils.h
+ ../lxc/initutils.c ../lxc/initutils.h \
+ ../lxc/log.c ../lxc/log.h \
+ ../lxc/lxclock.c ../lxc/lxclock.h \
+ ../lxc/mainloop.c ../lxc/mainloop.h \
+ ../lxc/monitor.c ../lxc/monitor.h \
+ ../lxc/namespace.c ../lxc/namespace.h \
+ ../lxc/network.c ../lxc/network.h \
+ ../lxc/nl.c ../lxc/nl.h \
+ ../lxc/parse.c ../lxc/parse.h \
+ ../lxc/process_utils.c ../lxc/process_utils.h \
+ ../lxc/ringbuf.c ../lxc/ringbuf.h \
+ ../lxc/start.c ../lxc/start.h \
+ ../lxc/state.c ../lxc/state.h \
+ ../lxc/sync.c ../lxc/sync.h \
+ ../lxc/string_utils.c ../lxc/string_utils.h \
+ ../lxc/terminal.c ../lxc/terminal.h \
+ ../lxc/utils.c ../lxc/utils.h
+if ENABLE_SECCOMP
+lxc_test_mount_injection_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h
+endif
+
lxc_test_parse_config_file_SOURCES = parse_config_file.c \
lxctest.h \
../lxc/af_unix.c ../lxc/af_unix.h \
../lxc/state.c ../lxc/state.h \
../lxc/sync.c ../lxc/sync.h \
../lxc/string_utils.c ../lxc/string_utils.h \
- ../lxc/terminal.c ../lxc/terminal.h
+ ../lxc/terminal.c ../lxc/terminal.h \
+ ../lxc/utils.c ../lxc/utils.h
if ENABLE_SECCOMP
lxc_test_parse_config_file_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h
endif
../lxc/state.c ../lxc/state.h \
../lxc/sync.c ../lxc/sync.h \
../lxc/string_utils.c ../lxc/string_utils.h \
- ../lxc/terminal.c ../lxc/terminal.h
+ ../lxc/terminal.c ../lxc/terminal.h \
+ ../lxc/utils.c ../lxc/utils.h
if ENABLE_SECCOMP
lxc_test_utils_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h
endif