lxc  4.0.10
About: LXC are userspace tools for the Linux kernel containers that let users easily create and manage system or application containers.
  Fossies Dox: lxc-4.0.10.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

lxccontainer.c File Reference
#include <arpa/inet.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <grp.h>
#include <libgen.h>
#include <pthread.h>
#include <sched.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/file.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/sysmacros.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include "../include/netns_ifaddrs.h"
#include "af_unix.h"
#include "api_extensions.h"
#include "attach.h"
#include "cgroup.h"
#include "macro.h"
#include "commands.h"
#include "commands_utils.h"
#include "conf.h"
#include "config.h"
#include "confile.h"
#include "confile_utils.h"
#include "criu.h"
#include "error.h"
#include "initutils.h"
#include "log.h"
#include "lxc.h"
#include "lxccontainer.h"
#include "lxclock.h"
#include "memory_utils.h"
#include "monitor.h"
#include "namespace.h"
#include "network.h"
#include "parse.h"
#include "process_utils.h"
#include "start.h"
#include "state.h"
#include "storage.h"
#include "storage/btrfs.h"
#include "storage/overlay.h"
#include "storage_utils.h"
#include "sync.h"
#include "syscall_wrappers.h"
#include "terminal.h"
#include "utils.h"
#include "version.h"
#include <mntent.h>
#include "include/strlcpy.h"
Include dependency graph for lxccontainer.c:

Go to the source code of this file.

Data Structures

struct  clone_update_data
 

Macros

#define _GNU_SOURCE   1
 
#define do_lxcapi_get_config_path(c)   lxcapi_get_config_path(c)
 
#define WRAP_API(rettype, fnname)
  More...
 
#define WRAP_API_1(rettype, fnname, t1)
  More...
 
#define WRAP_API_2(rettype, fnname, t1, t2)
  More...
 
#define WRAP_API_3(rettype, fnname, t1, t2, t3)
  More...
 
#define WRAP_API_6(rettype, fnname, t1, t2, t3, t4, t5, t6)
  More...
 
#define do_lxcapi_clear_config(c)   lxcapi_clear_config(c)
 

Enumerations

enum  { LXC_CREATE_FAILED = -1 , LXC_CREATE_SUCCESS = 0 , LXC_CREATE_ONGOING = 1 , LXC_CREATE_INCOMPLETE = 2 }
 

Functions

static void LXC_TRACE (struct lxc_log_locinfo *, const char *,...)
 
static void LXC_DEBUG (struct lxc_log_locinfo *, const char *,...)
 
static void LXC_INFO (struct lxc_log_locinfo *, const char *,...)
 
static void LXC_NOTICE (struct lxc_log_locinfo *, const char *,...)
 
static void LXC_WARN (struct lxc_log_locinfo *, const char *,...)
 
static void LXC_ERROR (struct lxc_log_locinfo *, const char *,...)
 
static void LXC_CRIT (struct lxc_log_locinfo *, const char *,...)
 
static void LXC_ALERT (struct lxc_log_locinfo *, const char *,...)
 
static void LXC_FATAL (struct lxc_log_locinfo *, const char *,...)
 
static bool do_lxcapi_destroy (struct lxc_container *c)
  More...
 
static const char * lxcapi_get_config_path (struct lxc_container *c)
  More...
 
static bool do_lxcapi_set_config_item (struct lxc_container *c, const char *key, const char *v)
  More...
 
static bool container_destroy (struct lxc_container *c, struct lxc_storage *storage)
  More...
 
static bool get_snappath_dir (struct lxc_container *c, char *snappath)
  More...
 
static bool lxcapi_snapshot_destroy_all (struct lxc_container *c)
  More...
 
static bool do_lxcapi_save_config (struct lxc_container *c, const char *alt_file)
  More...
 
static bool config_file_exists (const char *lxcpath, const char *cname)
  More...
 
static int ongoing_create (struct lxc_container *c)
  More...
 
static int create_partial (struct lxc_container *c)
  More...
 
static void remove_partial (struct lxc_container *c, int fd)
  More...
 
static void lxc_container_free (struct lxc_container *c)
  More...
 
int lxc_container_get (struct lxc_container *c)
 Add a reference to the specified container. More...
 
int lxc_container_put (struct lxc_container *c)
 Drop a reference to the specified container. More...
 
static bool do_lxcapi_is_defined (struct lxc_container *c)
  More...
 
static bool lxcapi_is_defined (struct lxc_container *c)
  More...
 
static const char * do_lxcapi_state (struct lxc_container *c)
  More...
 
static const char * lxcapi_state (struct lxc_container *c)
  More...
 
static bool is_stopped (struct lxc_container *c)
  More...
 
static bool do_lxcapi_is_running (struct lxc_container *c)
  More...
 
static bool lxcapi_is_running (struct lxc_container *c)
  More...
 
static bool do_lxcapi_freeze (struct lxc_container *c)
  More...
 
static bool lxcapi_freeze (struct lxc_container *c)
  More...
 
static bool do_lxcapi_unfreeze (struct lxc_container *c)
  More...
 
static bool lxcapi_unfreeze (struct lxc_container *c)
  More...
 
static int do_lxcapi_console_getfd (struct lxc_container *c, int *ttynum, int *ptxfd)
  More...
 
static int lxcapi_console_getfd (struct lxc_container *c, int *a1, int *a2)
  More...
 
static int lxcapi_console (struct lxc_container *c, int ttynum, int stdinfd, int stdoutfd, int stderrfd, int escape)
  More...
 
static int do_lxcapi_console_log (struct lxc_container *c, struct lxc_console_log *log)
  More...
 
static int lxcapi_console_log (struct lxc_container *c, struct lxc_console_log *a1)
  More...
 
static pid_t do_lxcapi_init_pid (struct lxc_container *c)
  More...
 
static pid_t lxcapi_init_pid (struct lxc_container *c)
  More...
 
static int do_lxcapi_init_pidfd (struct lxc_container *c)
  More...
 
static int lxcapi_init_pidfd (struct lxc_container *c)
  More...
 
static int do_lxcapi_devpts_fd (struct lxc_container *c)
  More...
 
static int lxcapi_devpts_fd (struct lxc_container *c)
  More...
 
static bool load_config_locked (struct lxc_container *c, const char *fname)
  More...
 
static bool do_lxcapi_load_config (struct lxc_container *c, const char *alt_file)
  More...
 
static bool lxcapi_load_config (struct lxc_container *c, const char *a1)
  More...
 
static bool do_lxcapi_want_daemonize (struct lxc_container *c, bool state)
  More...
 
static bool lxcapi_want_daemonize (struct lxc_container *c, bool a1)
  More...
 
static bool do_lxcapi_want_close_all_fds (struct lxc_container *c, bool state)
  More...
 
static bool lxcapi_want_close_all_fds (struct lxc_container *c, bool a1)
  More...
 
static bool do_lxcapi_wait (struct lxc_container *c, const char *state, int timeout)
  More...
 
static bool lxcapi_wait (struct lxc_container *c, const char *a1, int a2)
  More...
 
static bool am_single_threaded (void)
  More...
 
static void push_arg (char ***argp, char *arg, int *nargs)
  More...
 
static char ** split_init_cmd (const char *incmd)
  More...
 
static void free_init_cmd (char **argv)
  More...
 
static int lxc_rcv_status (int state_socket)
  More...
 
static bool wait_on_daemonized_start (struct lxc_handler *handler, int pid)
  More...
 
static bool do_lxcapi_start (struct lxc_container *c, int useinit, char *const argv[])
  More...
 
static bool lxcapi_start (struct lxc_container *c, int useinit, char *const argv[])
  More...
 
static bool lxcapi_startl (struct lxc_container *c, int useinit,...)
  More...
 
static bool do_lxcapi_stop (struct lxc_container *c)
  More...
 
static bool lxcapi_stop (struct lxc_container *c)
  More...
 
static int do_create_container_dir (const char *path, struct lxc_conf *conf)
  More...
 
static bool create_container_dir (struct lxc_container *c)
  More...
 
static struct lxc_storagedo_storage_create (struct lxc_container *c, const char *type, struct bdev_specs *specs)
  More...
 
static char * lxctemplatefilename (char *tpath)
  More...
 
static bool create_run_template (struct lxc_container *c, char *tpath, bool need_null_stdfds, char *const argv[])
  More...
 
static bool prepend_lxc_header (char *path, const char *t, char *const argv[])
  More...
 
static void lxcapi_clear_config (struct lxc_container *c)
  More...
 
static bool do_lxcapi_create (struct lxc_container *c, const char *t, const char *bdevtype, struct bdev_specs *specs, int flags, char *const argv[])
  More...
 
static bool lxcapi_create (struct lxc_container *c, const char *t, const char *bdevtype, struct bdev_specs *specs, int flags, char *const argv[])
  More...
 
static bool do_lxcapi_reboot (struct lxc_container *c)
  More...
 
static bool lxcapi_reboot (struct lxc_container *c)
  More...
 
static bool do_lxcapi_reboot2 (struct lxc_container *c, int timeout)
  More...
 
static bool lxcapi_reboot2 (struct lxc_container *c, int a1)
  More...
 
static bool do_lxcapi_shutdown (struct lxc_container *c, int timeout)
  More...
 
static bool lxcapi_shutdown (struct lxc_container *c, int a1)
  More...
 
static bool lxcapi_createl (struct lxc_container *c, const char *t, const char *bdevtype, struct bdev_specs *specs, int flags,...)
  More...
 
static void do_clear_unexp_config_line (struct lxc_conf *conf, const char *key)
  More...
 
static bool do_lxcapi_clear_config_item (struct lxc_container *c, const char *key)
  More...
 
static bool lxcapi_clear_config_item (struct lxc_container *c, const char *a1)
  More...
 
static bool enter_net_ns (struct lxc_container *c)
  More...
 
static int string_cmp (char **first, char **second)
  More...
 
static int container_cmp (struct lxc_container **first, struct lxc_container **second)
  More...
 
static bool add_to_array (char ***names, char *cname, int pos)
  More...
 
static bool add_to_clist (struct lxc_container ***list, struct lxc_container *c, int pos, bool sort)
  More...
 
static char ** get_from_array (char ***names, char *cname, int size)
  More...
 
static bool array_contains (char ***names, char *cname, int size)
  More...
 
static bool remove_from_array (char ***names, char *cname, int size)
  More...
 
static char ** do_lxcapi_get_interfaces (struct lxc_container *c)
  More...
 
static char ** lxcapi_get_interfaces (struct lxc_container *c)
  More...
 
static char ** do_lxcapi_get_ips (struct lxc_container *c, const char *interface, const char *family, int scope)
  More...
 
static char ** lxcapi_get_ips (struct lxc_container *c, const char *a1, const char *a2, int a3)
  More...
 
static int do_lxcapi_get_config_item (struct lxc_container *c, const char *key, char *retv, int inlen)
  More...
 
static int lxcapi_get_config_item (struct lxc_container *c, const char *a1, char *a2, int a3)
  More...
 
static char * do_lxcapi_get_running_config_item (struct lxc_container *c, const char *key)
  More...
 
static char * lxcapi_get_running_config_item (struct lxc_container *c, const char *a1)
  More...
 
static int do_lxcapi_get_keys (struct lxc_container *c, const char *key, char *retv, int inlen)
  More...
 
static int lxcapi_get_keys (struct lxc_container *c, const char *a1, char *a2, int a3)
  More...
 
static bool lxcapi_save_config (struct lxc_container *c, const char *a1)
  More...
 
static bool mod_rdep (struct lxc_container *c0, struct lxc_container *c, bool inc)
  More...
 
void mod_all_rdeps (struct lxc_container *c, bool inc)
  More...
 
static bool has_fs_snapshots (struct lxc_container *c)
  More...
 
static bool has_snapshots (struct lxc_container *c)
  More...
 
static bool do_destroy_container (struct lxc_conf *conf)
  More...
 
static int lxc_rmdir_onedev_wrapper (void *data)
  More...
 
static int lxc_unlink_exec_wrapper (void *data)
  More...
 
static bool lxcapi_destroy (struct lxc_container *c)
  More...
 
static bool do_lxcapi_destroy_with_snapshots (struct lxc_container *c)
  More...
 
static bool lxcapi_destroy_with_snapshots (struct lxc_container *c)
  More...
 
int lxc_set_config_item_locked (struct lxc_conf *conf, const char *key, const char *v)
  More...
 
static bool do_set_config_item_locked (struct lxc_container *c, const char *key, const char *v)
  More...
 
static bool lxcapi_set_config_item (struct lxc_container *c, const char *a1, const char *a2)
  More...
 
static char * lxcapi_config_file_name (struct lxc_container *c)
  More...
 
static bool set_config_filename (struct lxc_container *c)
  More...
 
static bool do_lxcapi_set_config_path (struct lxc_container *c, const char *path)
  More...
 
static bool lxcapi_set_config_path (struct lxc_container *c, const char *a1)
  More...
 
static bool do_lxcapi_set_cgroup_item (struct lxc_container *c, const char *subsys, const char *value)
  More...
 
static bool lxcapi_set_cgroup_item (struct lxc_container *c, const char *a1, const char *a2)
  More...
 
static int do_lxcapi_get_cgroup_item (struct lxc_container *c, const char *subsys, char *retv, int inlen)
  More...
 
static int lxcapi_get_cgroup_item (struct lxc_container *c, const char *a1, char *a2, int a3)
  More...
 
const char * lxc_get_global_config_item (const char *key)
 Get the value for a global config key. More...
 
const char * lxc_get_version (void)
 Determine version of LXC. More...
 
static int copy_file (const char *old, const char *new)
  More...
 
static int copyhooks (struct lxc_container *oldc, struct lxc_container *c)
  More...
 
static int copy_fstab (struct lxc_container *oldc, struct lxc_container *c)
  More...
 
static void copy_rdepends (struct lxc_container *c, struct lxc_container *c0)
  More...
 
static bool add_rdepends (struct lxc_container *c, struct lxc_container *c0)
  More...
 
static bool should_default_to_snapshot (struct lxc_container *c0, struct lxc_container *c1)
  More...
 
static int copy_storage (struct lxc_container *c0, struct lxc_container *c, const char *newtype, int flags, const char *bdevdata, uint64_t newsize)
  More...
 
static int clone_update_rootfs (struct clone_update_data *data)
  More...
 
static int clone_update_rootfs_wrapper (void *data)
  More...
 
static int create_file_dirname (char *path, struct lxc_conf *conf)
  More...
 
static struct lxc_containerdo_lxcapi_clone (struct lxc_container *c, const char *newname, const char *lxcpath, int flags, const char *bdevtype, const char *bdevdata, uint64_t newsize, char **hookargs)
  More...
 
static struct lxc_containerlxcapi_clone (struct lxc_container *c, const char *newname, const char *lxcpath, int flags, const char *bdevtype, const char *bdevdata, uint64_t newsize, char **hookargs)
  More...
 
static bool do_lxcapi_rename (struct lxc_container *c, const char *newname)
  More...
 
static bool lxcapi_rename (struct lxc_container *c, const char *a1)
  More...
 
static int lxcapi_attach (struct lxc_container *c, lxc_attach_exec_t exec_function, void *exec_payload, lxc_attach_options_t *options, pid_t *attached_process)
  More...
 
static int do_lxcapi_attach_run_wait (struct lxc_container *c, lxc_attach_options_t *options, const char *program, const char *const argv[])
  More...
 
static int lxcapi_attach_run_wait (struct lxc_container *c, lxc_attach_options_t *options, const char *program, const char *const argv[])
  More...
 
static int get_next_index (const char *lxcpath, char *cname)
  More...
 
static int do_lxcapi_snapshot (struct lxc_container *c, const char *commentfile)
  More...
 
static int lxcapi_snapshot (struct lxc_container *c, const char *a1)
  More...
 
static void lxcsnap_free (struct lxc_snapshot *s)
  More...
 
static char * get_snapcomment_path (char *snappath, char *name)
  More...
 
static char * get_timestamp (char *snappath, char *name)
  More...
 
static int do_lxcapi_snapshot_list (struct lxc_container *c, struct lxc_snapshot **ret_snaps)
  More...
 
static int lxcapi_snapshot_list (struct lxc_container *c, struct lxc_snapshot **a1)
  More...
 
static bool do_lxcapi_snapshot_restore (struct lxc_container *c, const char *snapname, const char *newname)
  More...
 
static bool lxcapi_snapshot_restore (struct lxc_container *c, const char *a1, const char *a2)
  More...
 
static bool do_snapshot_destroy (const char *snapname, const char *clonelxcpath)
  More...
 
static bool remove_all_snapshots (const char *path)
  More...
 
static bool do_lxcapi_snapshot_destroy (struct lxc_container *c, const char *snapname)
  More...
 
static bool lxcapi_snapshot_destroy (struct lxc_container *c, const char *a1)
  More...
 
static bool do_lxcapi_snapshot_destroy_all (struct lxc_container *c)
  More...
 
static bool do_lxcapi_may_control (struct lxc_container *c)
  More...
 
static bool lxcapi_may_control (struct lxc_container *c)
  More...
 
static bool do_add_remove_node (pid_t init_pid, const char *path, bool add, struct stat *st)
  More...
 
static bool add_remove_device_node (struct lxc_container *c, const char *src_path, const char *dest_path, bool add)
  More...
 
static bool do_lxcapi_add_device_node (struct lxc_container *c, const char *src_path, const char *dest_path)
  More...
 
static bool lxcapi_add_device_node (struct lxc_container *c, const char *a1, const char *a2)
  More...
 
static bool do_lxcapi_remove_device_node (struct lxc_container *c, const char *src_path, const char *dest_path)
  More...
 
static bool lxcapi_remove_device_node (struct lxc_container *c, const char *a1, const char *a2)
  More...
 
static bool do_lxcapi_attach_interface (struct lxc_container *c, const char *ifname, const char *dst_ifname)
  More...
 
static bool lxcapi_attach_interface (struct lxc_container *c, const char *a1, const char *a2)
  More...
 
static bool do_lxcapi_detach_interface (struct lxc_container *c, const char *ifname, const char *dst_ifname)
  More...
 
static bool lxcapi_detach_interface (struct lxc_container *c, const char *a1, const char *a2)
  More...
 
static int do_lxcapi_migrate (struct lxc_container *c, unsigned int cmd, struct migrate_opts *opts, unsigned int size)
  More...
 
static int lxcapi_migrate (struct lxc_container *c, unsigned int a1, struct migrate_opts *a2, unsigned int a3)
  More...
 
static bool do_lxcapi_checkpoint (struct lxc_container *c, char *directory, bool stop, bool verbose)
  More...
 
static bool lxcapi_checkpoint (struct lxc_container *c, char *a1, bool a2, bool a3)
  More...
 
static bool do_lxcapi_restore (struct lxc_container *c, char *directory, bool verbose)
  More...
 
static bool lxcapi_restore (struct lxc_container *c, char *a1, bool a2)
  More...
 
static int create_mount_target (const char *dest, mode_t st_mode)
  More...
 
static int do_lxcapi_mount (struct lxc_container *c, const char *source, const char *target, const char *filesystemtype, unsigned long mountflags, const void *data, struct lxc_mount *mnt)
  More...
 
static int lxcapi_mount (struct lxc_container *c, const char *a1, const char *a2, const char *a3, unsigned long a4, const void *a5, struct lxc_mount *a6)
  More...
 
static int do_lxcapi_umount (struct lxc_container *c, const char *target, unsigned long flags, struct lxc_mount *mnt)
  More...
 
static int lxcapi_umount (struct lxc_container *c, const char *a1, unsigned long a2, struct lxc_mount *a3)
  More...
 
static int lxcapi_attach_run_waitl (struct lxc_container *c, lxc_attach_options_t *options, const char *program, const char *arg,...)
  More...
 
static int do_lxcapi_seccomp_notify_fd (struct lxc_container *c)
  More...
 
static int lxcapi_seccomp_notify_fd (struct lxc_container *c)
  More...
 
static int do_lxcapi_seccomp_notify_fd_active (struct lxc_container *c)
  More...
 
static int lxcapi_seccomp_notify_fd_active (struct lxc_container *c)
  More...
 
struct lxc_containerlxc_container_new (const char *name, const char *configpath)
 Create a new container. More...
 
int lxc_get_wait_states (const char **states)
 Obtain a list of all container states. More...
 
int list_defined_containers (const char *lxcpath, char ***names, struct lxc_container ***cret)
 Get a list of defined containers in a lxcpath. More...
 
int list_active_containers (const char *lxcpath, char ***nret, struct lxc_container ***cret)
 Get a list of active containers for a given lxcpath. More...
 
int list_all_containers (const char *lxcpath, char ***nret, struct lxc_container ***cret)
 Get a complete list of all containers for a given lxcpath. More...
 
bool lxc_config_item_is_supported (const char *key)
 Check if the configuration item is supported by this LXC instance. More...
 
bool lxc_has_api_extension (const char *extension)
 Check if an API extension is supported by this LXC instance. More...
 

Variables

struct lxc_log_category lxc_log_category_lxc
 
struct lxc_log_category lxc_log_category_lxccontainer = { "lxccontainer", LXC_LOG_LEVEL_NOTSET, NULL, &lxc_log_category_lxc }
 

Macro Definition Documentation

◆ WRAP_API

#define WRAP_API (   rettype,
  fnname 
)
Value:
static rettype fnname(struct lxc_container *c) \
{ \
rettype ret; \
bool reset_config = false; \
\
if (!current_config && c && c->lxc_conf) { \
current_config = c->lxc_conf; \
reset_config = true; \
} \
\
ret = do_##fnname(c); \
if (reset_config) \
current_config = NULL; \
\
return ret; \
}
__thread struct lxc_conf * current_config
Definition: conf.c:113

Definition at line 384 of file lxccontainer.c.

◆ WRAP_API_1

#define WRAP_API_1 (   rettype,
  fnname,
  t1 
)
Value:
static rettype fnname(struct lxc_container *c, t1 a1) \
{ \
rettype ret; \
bool reset_config = false; \
\
if (!current_config && c && c->lxc_conf) { \
current_config = c->lxc_conf; \
reset_config = true; \
} \
\
ret = do_##fnname(c, a1); \
if (reset_config) \
current_config = NULL; \
\
return ret; \
}

Definition at line 402 of file lxccontainer.c.

◆ WRAP_API_2

#define WRAP_API_2 (   rettype,
  fnname,
  t1,
  t2 
)
Value:
static rettype fnname(struct lxc_container *c, t1 a1, t2 a2) \
{ \
rettype ret; \
bool reset_config = false; \
\
if (!current_config && c && c->lxc_conf) { \
current_config = c->lxc_conf; \
reset_config = true; \
} \
\
ret = do_##fnname(c, a1, a2); \
if (reset_config) \
current_config = NULL; \
\
return ret; \
}

Definition at line 420 of file lxccontainer.c.

◆ WRAP_API_3

#define WRAP_API_3 (   rettype,
  fnname,
  t1,
  t2,
  t3 
)
Value:
static rettype fnname(struct lxc_container *c, t1 a1, t2 a2, t3 a3) \
{ \
rettype ret; \
bool reset_config = false; \
\
if (!current_config && c && c->lxc_conf) { \
current_config = c->lxc_conf; \
reset_config = true; \
} \
\
ret = do_##fnname(c, a1, a2, a3); \
if (reset_config) \
current_config = NULL; \
\
return ret; \
}

Definition at line 438 of file lxccontainer.c.

◆ WRAP_API_6

#define WRAP_API_6 (   rettype,
  fnname,
  t1,
  t2,
  t3,
  t4,
  t5,
  t6 
)
Value:
static rettype fnname(struct lxc_container *c, t1 a1, t2 a2, t3 a3, \
t4 a4, t5 a5, t6 a6) \
{ \
rettype ret; \
bool reset_config = false; \
\
if (!current_config && c && c->lxc_conf) { \
current_config = c->lxc_conf; \
reset_config = true; \
} \
\
ret = do_##fnname(c, a1, a2, a3, a4, a5, a6); \
if (reset_config) \
current_config = NULL; \
\
return ret; \
}

Definition at line 456 of file lxccontainer.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
LXC_CREATE_FAILED 
LXC_CREATE_SUCCESS 
LXC_CREATE_ONGOING 
LXC_CREATE_INCOMPLETE 

Definition at line 121 of file lxccontainer.c.

Function Documentation

◆ add_rdepends()

static bool add_rdepends ( struct lxc_container c,
struct lxc_container c0 
)
static

Definition at line 3530 of file lxccontainer.c.

References __do_fclose, lxc_container::config_path, lxc_container::name, PATH_MAX, and strnprintf.

Referenced by copy_storage().

Here is the caller graph for this function:

◆ add_remove_device_node()

static bool add_remove_device_node ( struct lxc_container c,
const char *  src_path,
const char *  dest_path,
bool  add 
)
static

Definition at line 4625 of file lxccontainer.c.

References do_add_remove_node(), do_lxcapi_init_pid(), do_lxcapi_is_running(), do_lxcapi_set_cgroup_item(), ERROR, LXC_MAX_BUFFER, and strnprintf.

Referenced by do_lxcapi_add_device_node(), and do_lxcapi_remove_device_node().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_to_array()

static bool add_to_array ( char ***  names,
char *  cname,
int  pos 
)
static

Definition at line 2263 of file lxccontainer.c.

References ERROR, and string_cmp().

Referenced by do_lxcapi_get_interfaces(), do_lxcapi_get_ips(), list_active_containers(), list_all_containers(), and list_defined_containers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_to_clist()

static bool add_to_clist ( struct lxc_container ***  list,
struct lxc_container c,
int  pos,
bool  sort 
)
static

Definition at line 2283 of file lxccontainer.c.

References container_cmp(), and ERROR.

Referenced by list_active_containers(), list_all_containers(), and list_defined_containers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ am_single_threaded()

static bool am_single_threaded ( void  )
static

Definition at line 736 of file lxccontainer.c.

References __do_closedir, and strequal().

Referenced by do_lxcapi_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ array_contains()

static bool array_contains ( char ***  names,
char *  cname,
int  size 
)
static

Definition at line 2311 of file lxccontainer.c.

References get_from_array().

Referenced by do_lxcapi_get_interfaces(), list_active_containers(), and list_all_containers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clone_update_rootfs()

static int clone_update_rootfs ( struct clone_update_data data)
static

< Do not edit the rootfs to change the hostname

Definition at line 3637 of file lxccontainer.c.

References clone_update_data::c0, clone_update_data::c1, CLONE_NEWNS, lxc_storage::dest, detect_shared_rootfs(), ERROR, file_exists(), clone_update_data::flags, clone_update_data::hookargs, lxc_conf::hooks, LXC_CLONE_KEEPNAME, lxc_container::lxc_conf, lxc_drop_groups(), lxc_list_empty(), lxc_storage_get_path(), lxc_storage_prepare(), lxc_storage_put(), LXCHOOK_CLONE, lxc_storage_ops::mount, MS_REC, MS_SLAVE, lxc_container::name, lxc_storage::ops, lxc_rootfs::path, PATH_MAX, lxc_conf::rcfile, lxc_conf::rootfs, run_lxc_hooks(), lxc_storage::src, lxc_rootfs::storage, strequal(), strnprintf, SYSERROR, lxc_storage::type, and unshare().

Referenced by clone_update_rootfs_wrapper(), and do_lxcapi_clone().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clone_update_rootfs_wrapper()

static int clone_update_rootfs_wrapper ( void *  data)
static

Definition at line 3744 of file lxccontainer.c.

References clone_update_rootfs().

Referenced by do_lxcapi_clone().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_file_exists()

static bool config_file_exists ( const char *  lxcpath,
const char *  cname 
)
static

Definition at line 96 of file lxccontainer.c.

References __do_free, file_exists(), LXC_CONFIG_FNAME, must_realloc(), and strnprintf.

Referenced by list_defined_containers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ container_cmp()

static int container_cmp ( struct lxc_container **  first,
struct lxc_container **  second 
)
inlinestatic

Definition at line 2257 of file lxccontainer.c.

Referenced by add_to_clist().

Here is the caller graph for this function:

◆ container_destroy()

◆ copy_file()

static int copy_file ( const char *  old,
const char *  new 
)
static

Definition at line 3335 of file lxccontainer.c.

References ERROR, file_exists(), INFO, lxc_read_nointr(), lxc_write_nointr(), and SYSERROR.

Referenced by copy_fstab(), copy_rdepends(), copyhooks(), and do_lxcapi_snapshot().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ copy_fstab()

static int copy_fstab ( struct lxc_container oldc,
struct lxc_container c 
)
static

Definition at line 3457 of file lxccontainer.c.

References clear_unexp_config_line(), lxc_container::config_path, copy_file(), do_append_unexp_config_line(), ERROR, file_exists(), lxc_conf::fstab, lxc_container::lxc_conf, lxc_container::name, PATH_MAX, and strnprintf.

Referenced by do_lxcapi_clone().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ copy_rdepends()

static void copy_rdepends ( struct lxc_container c,
struct lxc_container c0 
)
static

Definition at line 3505 of file lxccontainer.c.

References lxc_container::config_path, copy_file(), INFO, lxc_container::name, PATH_MAX, strnprintf, and WARN.

Referenced by copy_storage().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ copy_storage()

static int copy_storage ( struct lxc_container c0,
struct lxc_container c,
const char *  newtype,
int  flags,
const char *  bdevdata,
uint64_t  newsize 
)
static

< Snapshot the original filesystem(s)

< Snapshot the original filesystem(s)

Definition at line 3581 of file lxccontainer.c.

References add_rdepends(), clear_unexp_config_line(), lxc_container::config_path, copy_rdepends(), do_append_unexp_config_line(), ERROR, lxc_storage::flags, LXC_CLONE_SNAPSHOT, lxc_container::lxc_conf, mod_all_rdeps(), lxc_container::name, lxc_rootfs::path, lxc_conf::rootfs, should_default_to_snapshot(), lxc_storage::src, storage_copy(), storage_put(), and WARN.

Referenced by do_lxcapi_clone().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ copyhooks()

static int copyhooks ( struct lxc_container oldc,
struct lxc_container c 
)
static

Definition at line 3401 of file lxccontainer.c.

References __do_free, clone_update_unexp_hooks(), lxc_container::config_path, copy_file(), do_lxcapi_save_config(), lxc_list::elem, ERROR, lxc_conf::hooks, lxc_container::lxc_conf, lxc_list_for_each, must_realloc(), lxc_container::name, NUM_LXC_HOOKS, PATH_MAX, strnequal(), and strnprintf.

Referenced by do_lxcapi_clone().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_container_dir()

static bool create_container_dir ( struct lxc_container c)
static

Definition at line 1232 of file lxccontainer.c.

References __do_free, lxc_container::config_path, do_create_container_dir(), lxc_container::lxc_conf, lxc_container::name, and strnprintf.

Referenced by do_lxcapi_create(), and do_lxcapi_save_config().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_file_dirname()

static int create_file_dirname ( char *  path,
struct lxc_conf conf 
)
static

Definition at line 3761 of file lxccontainer.c.

References do_create_container_dir().

Referenced by do_lxcapi_clone().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_mount_target()

static int create_mount_target ( const char *  dest,
mode_t  st_mode 
)
static

Definition at line 4965 of file lxccontainer.c.

References mkdir_p(), SYSERROR, and TRACE.

Referenced by do_lxcapi_mount().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_partial()

static int create_partial ( struct lxc_container c)
static

Definition at line 174 of file lxccontainer.c.

References __do_free, lxc_container::config_path, F_OFD_SETLKW, LXC_PARTIAL_FNAME, must_realloc(), lxc_container::name, O_CLOEXEC, strnprintf, and SYSERROR.

Referenced by do_lxcapi_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_run_template()

static bool create_run_template ( struct lxc_container c,
char *  tpath,
bool  need_null_stdfds,
char *const  argv[] 
)
static

Definition at line 1318 of file lxccontainer.c.

References CLONE_NEWNS, lxc_container::config_path, lxc_storage::dest, detect_shared_rootfs(), lxc_list::elem, ERROR, find_unmapped_nsid(), id_map::hostid, lxc_conf::id_map, ID_TYPE_GID, ID_TYPE_UID, id_map::idtype, lxc_container::lxc_conf, lxc_list_empty(), lxc_list_for_each, lxc_storage_get_path(), lxc_storage_prepare(), lxctemplatefilename(), mapped_hostid(), lxc_storage_ops::mount, MS_REC, MS_SLAVE, lxc_container::name, id_map::nsid, null_stdfds(), lxc_storage::ops, ovl_get_rootfs(), pid, id_map::range, lxc_conf::rootfs, lxc_storage::src, lxc_rootfs::storage, strequal(), strnprintf, SYSERROR, lxc_storage::type, unshare(), and wait_for_pid().

Referenced by do_lxcapi_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_add_remove_node()

static bool do_add_remove_node ( pid_t  init_pid,
const char *  path,
bool  add,
struct stat *  st 
)
static

Definition at line 4550 of file lxccontainer.c.

References ERROR, faccessat(), mkdir_p(), PATH_MAX, pid, strnprintf, SYSERROR, and wait_for_pid().

Referenced by add_remove_device_node().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_clear_unexp_config_line()

static void do_clear_unexp_config_line ( struct lxc_conf conf,
const char *  key 
)
static

Definition at line 2183 of file lxccontainer.c.

References clear_unexp_config_line(), key, lxc_safe_uint(), strequal(), and strnequal().

Referenced by do_lxcapi_clear_config_item(), and lxc_set_config_item_locked().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_create_container_dir()

static int do_create_container_dir ( const char *  path,
struct lxc_conf conf 
)
static

Definition at line 1205 of file lxccontainer.c.

References chown_mapped_root(), and lxc_list_empty().

Referenced by create_container_dir(), and create_file_dirname().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_destroy_container()

static bool do_destroy_container ( struct lxc_conf conf)
static

Definition at line 2916 of file lxccontainer.c.

References am_guest_unpriv(), storage_destroy(), storage_destroy_wrapper(), and userns_exec_full().

Referenced by container_destroy().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_lxcapi_add_device_node()

static bool do_lxcapi_add_device_node ( struct lxc_container c,
const char *  src_path,
const char *  dest_path 
)
static

Definition at line 4681 of file lxccontainer.c.

References add_remove_device_node(), am_host_unpriv(), ERROR, and LXC_UNPRIV_EOPNOTSUPP.

Here is the call graph for this function:

◆ do_lxcapi_attach_interface()

static bool do_lxcapi_attach_interface ( struct lxc_container c,
const char *  ifname,
const char *  dst_ifname 
)
static

Definition at line 4706 of file lxccontainer.c.

References am_guest_unpriv(), do_lxcapi_init_pid(), ERROR, INFO, lxc_netdev_down(), lxc_netdev_isup(), lxc_netdev_move_by_name(), and LXC_UNPRIV_EOPNOTSUPP.

Here is the call graph for this function:

◆ do_lxcapi_attach_run_wait()

static int do_lxcapi_attach_run_wait ( struct lxc_container c,
lxc_attach_options_t options,
const char *  program,
const char *const  argv[] 
)
static

Definition at line 4050 of file lxccontainer.c.

References lxc_attach_command_t::argv, lxc_attach(), lxc_attach_run_command(), lxc_wait_for_pid_status(), pid, and lxc_attach_command_t::program.

Referenced by lxcapi_attach_run_wait(), and lxcapi_attach_run_waitl().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_lxcapi_checkpoint()

static bool do_lxcapi_checkpoint ( struct lxc_container c,
char *  directory,
bool  stop,
bool  verbose 
)
static

Definition at line 4935 of file lxccontainer.c.

References migrate_opts::directory, do_lxcapi_migrate(), MIGRATE_DUMP, migrate_opts::stop, stop, migrate_opts::verbose, and verbose.

Here is the call graph for this function:

◆ do_lxcapi_clear_config_item()

static bool do_lxcapi_clear_config_item ( struct lxc_container c,
const char *  key 
)
static

Definition at line 2211 of file lxccontainer.c.

References lxc_config_t::clr, container_mem_lock(), container_mem_unlock(), do_clear_unexp_config_line(), key, lxc_container::lxc_conf, and lxc_get_config().

Here is the call graph for this function:

◆ do_lxcapi_clone()

static struct lxc_container* do_lxcapi_clone ( struct lxc_container c,
const char *  newname,
const char *  lxcpath,
int  flags,
const char *  bdevtype,
const char *  bdevdata,
uint64_t  newsize,
char **  hookargs 
)
static

< allow snapshot creation even if source container is running

< Do not edit the rootfs to change the hostname

< Do not change the MAC address on network interfaces

Definition at line 3776 of file lxccontainer.c.

References am_guest_unpriv(), clone_update_data::c0, clone_update_data::c1, chown_mapped_root(), clear_unexp_config_line(), clone_update_rootfs(), clone_update_rootfs_wrapper(), lxc_container::config_path, container_mem_lock(), container_mem_unlock(), copy_fstab(), copy_storage(), copyhooks(), create_file_dirname(), lxc_container::destroy, do_lxcapi_get_config_path, do_lxcapi_is_defined(), do_set_config_item_locked(), ERROR, file_exists(), clone_update_data::flags, clone_update_data::hookargs, is_stopped(), LXC_CLONE_ALLOW_RUNNING, LXC_CLONE_KEEPMACADDR, LXC_CLONE_KEEPNAME, lxc_container::lxc_conf, LXC_CONFIG_FNAME, lxc_container_new(), lxc_container_put(), LXC_ROOTFS_DNAME, LXC_STORAGE_INTERNAL_OVERLAY_RESTORE, lxc_container::name, network_new_hwaddrs(), O_CLOEXEC, ovl_update_abs_paths(), lxc_rootfs::path, PATH_MAX, pid, lxc_conf::rootfs, lxc_container::save_config, strnprintf, SYSERROR, lxc_conf::unexpanded_config, lxc_conf::unexpanded_len, userns_exec_full(), wait_for_pid(), and write_config().

Referenced by do_lxcapi_snapshot(), and lxcapi_clone().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_lxcapi_console_getfd()

static int do_lxcapi_console_getfd ( struct lxc_container c,
int *  ttynum,
int *  ptxfd 
)
static

Definition at line 549 of file lxccontainer.c.

References lxc_terminal_getfd().

Here is the call graph for this function:

◆ do_lxcapi_console_log()

static int do_lxcapi_console_log ( struct lxc_container c,
struct lxc_console_log log 
)
static

Definition at line 574 of file lxccontainer.c.

References do_lxcapi_get_config_path, ERROR, lxc_cmd_console_log(), lxc_container::name, and NOTICE.

Here is the call graph for this function:

◆ do_lxcapi_create()

static bool do_lxcapi_create ( struct lxc_container c,
const char *  t,
const char *  bdevtype,
struct bdev_specs specs,
int  flags,
char *const  argv[] 
)
static

< Redirect stdin to /dev/zero and stdout and stderr to /dev/null

Definition at line 1775 of file lxccontainer.c.

References __do_free, lxc_container::config_path, lxc_container::configfile, container_destroy(), create_container_dir(), create_partial(), create_run_template(), lxc_storage_ops::destroy, do_lxcapi_clear_config, do_lxcapi_is_defined(), do_lxcapi_load_config(), do_lxcapi_save_config(), do_storage_create(), ERROR, lxc_storage::flags, get_template_path(), load_config_locked(), lxc_container::lxc_conf, lxc_conf_free(), LXC_CREATE_QUIET, lxc_global_config_value(), lxc_rootfs::managed, lxc_container::name, lxc_storage::ops, lxc_rootfs::path, pid, prepend_lxc_header(), remove_partial(), lxc_conf::rootfs, lxc_container::save_config, SYSERROR, syserror_set, lxc_storage_ops::umount, and wait_for_pid().

Referenced by lxcapi_create(), and lxcapi_createl().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_lxcapi_destroy()

static bool do_lxcapi_destroy ( struct lxc_container c)
static

Definition at line 3089 of file lxccontainer.c.

References container_destroy(), ERROR, has_fs_snapshots(), has_snapshots(), lxc_container::lxc_conf, lxcapi_is_defined(), lxc_rootfs::managed, lxc_container::name, and lxc_conf::rootfs.

Referenced by do_lxcapi_start(), and do_snapshot_destroy().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_lxcapi_destroy_with_snapshots()

static bool do_lxcapi_destroy_with_snapshots ( struct lxc_container c)
static

Definition at line 3111 of file lxccontainer.c.

References ERROR, lxcapi_destroy(), lxcapi_is_defined(), and lxcapi_snapshot_destroy_all().

Here is the call graph for this function:

◆ do_lxcapi_detach_interface()

static bool do_lxcapi_detach_interface ( struct lxc_container c,
const char *  ifname,
const char *  dst_ifname 
)
static

Definition at line 4750 of file lxccontainer.c.

References __do_free, am_guest_unpriv(), CLONE_NEWNS, do_lxcapi_init_pid(), ERROR, INFO, is_wlan(), lxc_attach_remount_sys_proc(), lxc_netdev_down(), lxc_netdev_isup(), lxc_netdev_move_by_name(), lxc_netdev_move_wlan(), lxc_raw_getpid(), LXC_UNPRIV_EOPNOTSUPP, MS_PRIVATE, MS_REC, pid, switch_to_ns(), unshare(), and wait_for_pid().

Here is the call graph for this function:

◆ do_lxcapi_devpts_fd()

static int do_lxcapi_devpts_fd ( struct lxc_container c)
static

Definition at line 620 of file lxccontainer.c.

References lxc_cmd_get_devpts_fd(), and ret_errno.

Here is the call graph for this function:

◆ do_lxcapi_freeze()

static bool do_lxcapi_freeze ( struct lxc_container c)
static

Definition at line 508 of file lxccontainer.c.

References cgroup_freeze(), ENOCGROUP2, FROZEN, lxc_freeze(), and lxc_getstate().

Here is the call graph for this function:

◆ do_lxcapi_get_cgroup_item()

static int do_lxcapi_get_cgroup_item ( struct lxc_container c,
const char *  subsys,
char *  retv,
int  inlen 
)
static

Definition at line 3300 of file lxccontainer.c.

References call_cleaner, cgroup_exit(), cgroup_get(), cgroup_init(), ERRNO_IS_NOT_SUPPORTED(), cgroup_ops::get, and is_stopped().

Here is the call graph for this function:

◆ do_lxcapi_get_config_item()

static int do_lxcapi_get_config_item ( struct lxc_container c,
const char *  key,
char *  retv,
int  inlen 
)
static

Definition at line 2558 of file lxccontainer.c.

References container_mem_lock(), container_mem_unlock(), lxc_config_t::get, key, and lxc_get_config().

Here is the call graph for this function:

◆ do_lxcapi_get_interfaces()

static char** do_lxcapi_get_interfaces ( struct lxc_container c)
static

Definition at line 2339 of file lxccontainer.c.

References add_to_array(), array_contains(), call_cleaner, enter_net_ns(), ERROR, netns_ifaddrs::ifa_name, netns_ifaddrs::ifa_next, log_error_errno, lxc_append_null_to_array(), lxc_read_nointr(), lxc_write_nointr(), netns_freeifaddrs(), netns_getifaddrs(), O_CLOEXEC, pid, SYSERROR, and wait_for_pid().

Here is the call graph for this function:

◆ do_lxcapi_get_ips()

static char** do_lxcapi_get_ips ( struct lxc_container c,
const char *  interface,
const char *  family,
int  scope 
)
static

Definition at line 2429 of file lxccontainer.c.

References add_to_array(), call_cleaner, enter_net_ns(), ERROR, netns_ifaddrs::ifa_addr, netns_ifaddrs::ifa_name, netns_ifaddrs::ifa_next, log_error_errno, lxc_append_null_to_array(), lxc_read_nointr(), lxc_write_nointr(), netns_freeifaddrs(), netns_getifaddrs(), O_CLOEXEC, pid, strequal(), SYSERROR, and wait_for_pid().

Here is the call graph for this function:

◆ do_lxcapi_get_keys()

static int do_lxcapi_get_keys ( struct lxc_container c,
const char *  key,
char *  retv,
int  inlen 
)
static

Definition at line 2596 of file lxccontainer.c.

References container_mem_lock(), container_mem_unlock(), key, lxc_list_config_items(), lxc_list_net(), lxc_list_subkeys(), and strnequal().

Here is the call graph for this function:

◆ do_lxcapi_get_running_config_item()

static char* do_lxcapi_get_running_config_item ( struct lxc_container c,
const char *  key 
)
static

Definition at line 2579 of file lxccontainer.c.

References container_mem_lock(), container_mem_unlock(), do_lxcapi_get_config_path, key, and lxc_cmd_get_config_item().

Here is the call graph for this function:

◆ do_lxcapi_init_pid()

static pid_t do_lxcapi_init_pid ( struct lxc_container c)
static

Definition at line 600 of file lxccontainer.c.

References lxc_cmd_get_init_pid().

Referenced by add_remove_device_node(), do_lxcapi_attach_interface(), do_lxcapi_detach_interface(), do_lxcapi_mount(), do_lxcapi_reboot(), do_lxcapi_reboot2(), do_lxcapi_shutdown(), do_lxcapi_umount(), and enter_net_ns().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_lxcapi_init_pidfd()

static int do_lxcapi_init_pidfd ( struct lxc_container c)
static

Definition at line 610 of file lxccontainer.c.

References lxc_cmd_get_init_pidfd(), and ret_errno.

Referenced by do_lxcapi_reboot(), do_lxcapi_reboot2(), and do_lxcapi_shutdown().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_lxcapi_is_defined()

static bool do_lxcapi_is_defined ( struct lxc_container c)
static

Definition at line 358 of file lxccontainer.c.

References lxc_container::configfile, container_mem_lock(), and container_mem_unlock().

Referenced by container_destroy(), do_lxcapi_clone(), do_lxcapi_create(), and list_defined_containers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_lxcapi_is_running()

static bool do_lxcapi_is_running ( struct lxc_container c)
static

Definition at line 498 of file lxccontainer.c.

References is_stopped().

Referenced by add_remove_device_node(), do_lxcapi_migrate(), do_lxcapi_reboot(), do_lxcapi_reboot2(), and do_lxcapi_shutdown().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_lxcapi_load_config()

static bool do_lxcapi_load_config ( struct lxc_container c,
const char *  alt_file 
)
static

Definition at line 645 of file lxccontainer.c.

References lxc_container::configfile, container_disk_lock(), container_disk_unlock(), container_mem_lock(), container_mem_unlock(), load_config_locked(), and strequal().

Referenced by do_lxcapi_create(), and do_lxcapi_save_config().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_lxcapi_may_control()

static bool do_lxcapi_may_control ( struct lxc_container c)
static

Definition at line 4540 of file lxccontainer.c.

References lxc_try_cmd().

Here is the call graph for this function:

◆ do_lxcapi_migrate()

static int do_lxcapi_migrate ( struct lxc_container c,
unsigned int  cmd,
struct migrate_opts opts,
unsigned int  size 
)
static

Definition at line 4851 of file lxccontainer.c.

References __criu_check_feature(), __criu_dump(), __criu_pre_dump(), __criu_restore(), addr, do_lxcapi_is_running(), ERROR, migrate_opts::features_to_check, MIGRATE_DUMP, MIGRATE_FEATURE_CHECK, MIGRATE_PRE_DUMP, and MIGRATE_RESTORE.

Referenced by do_lxcapi_checkpoint(), and do_lxcapi_restore().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_lxcapi_mount()

static int do_lxcapi_mount ( struct lxc_container c,
const char *  source,
const char *  target,
const char *  filesystemtype,
unsigned long  mountflags,
const void *  data,
struct lxc_mount mnt 
)
static

Definition at line 5002 of file lxccontainer.c.

References create_mount_target(), do_lxcapi_init_pid(), ERROR, lxc_conf::id_map, is_dir(), lxc_container::lxc_conf, lxc_list_empty(), lxc_make_tmpfile(), lxc_switch_uid_gid(), MS_REC, lxc_conf::shmount::path_cont, lxc_conf::shmount::path_host, PATH_MAX, pid, lxc_conf::shmount, strequal(), strnprintf, switch_to_ns(), SYSERROR, SYSWARN, TRACE, and wait_for_pid().

Here is the call graph for this function:

◆ do_lxcapi_reboot()

static bool do_lxcapi_reboot ( struct lxc_container c)
static

Definition at line 1948 of file lxccontainer.c.

References __do_close, do_lxcapi_init_pid(), do_lxcapi_init_pidfd(), do_lxcapi_is_running(), log_warn, lxc_container::lxc_conf, lxc_raw_pidfd_send_signal(), pid, and lxc_conf::rebootsignal.

Here is the call graph for this function:

◆ do_lxcapi_reboot2()

static bool do_lxcapi_reboot2 ( struct lxc_container c,
int  timeout 
)
static

Definition at line 1984 of file lxccontainer.c.

References __do_close, do_lxcapi_init_pid(), do_lxcapi_init_pidfd(), do_lxcapi_is_running(), log_warn, lxc_cmd_add_state_client(), lxc_cmd_sock_rcv_state(), lxc_raw_pidfd_send_signal(), lxc_state2str(), MAX_STATE, pid, RUNNING, and TRACE.

Here is the call graph for this function:

◆ do_lxcapi_remove_device_node()

static bool do_lxcapi_remove_device_node ( struct lxc_container c,
const char *  src_path,
const char *  dest_path 
)
static

Definition at line 4694 of file lxccontainer.c.

References add_remove_device_node(), am_guest_unpriv(), ERROR, and LXC_UNPRIV_EOPNOTSUPP.

Here is the call graph for this function:

◆ do_lxcapi_rename()

static bool do_lxcapi_rename ( struct lxc_container c,
const char *  newname 
)
static

< Do not change the MAC address on network interfaces

Definition at line 3994 of file lxccontainer.c.

References lxc_container::config_path, container_destroy(), ERROR, has_fs_snapshots(), has_snapshots(), LXC_CLONE_KEEPMACADDR, lxc_container::lxc_conf, lxc_container_put(), lxc_storage_prepare(), lxc_storage_put(), lxcapi_clone(), lxcapi_is_defined(), lxc_container::name, lxc_conf::rootfs, lxc_rootfs::storage, and lxc_storage::type.

Here is the call graph for this function:

◆ do_lxcapi_restore()

static bool do_lxcapi_restore ( struct lxc_container c,
char *  directory,
bool  verbose 
)
static

Definition at line 4950 of file lxccontainer.c.

References migrate_opts::directory, do_lxcapi_migrate(), MIGRATE_RESTORE, migrate_opts::verbose, and verbose.

Here is the call graph for this function:

◆ do_lxcapi_save_config()

static bool do_lxcapi_save_config ( struct lxc_container c,
const char *  alt_file 
)
static

Definition at line 2625 of file lxccontainer.c.

References container_disk_lock(), container_disk_unlock(), container_mem_lock(), container_mem_unlock(), create_container_dir(), do_lxcapi_load_config(), ERROR, lxc_global_config_value(), O_CLOEXEC, strequal(), and write_config().

Referenced by copyhooks(), and do_lxcapi_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_lxcapi_seccomp_notify_fd()

static int do_lxcapi_seccomp_notify_fd ( struct lxc_container c)
static

Definition at line 5236 of file lxccontainer.c.

References lxc_container::lxc_conf, lxc_seccomp_get_notify_fd(), ret_set_errno, and lxc_conf::seccomp.

Here is the call graph for this function:

◆ do_lxcapi_seccomp_notify_fd_active()

static int do_lxcapi_seccomp_notify_fd_active ( struct lxc_container c)
static

Definition at line 5246 of file lxccontainer.c.

References lxc_cmd_get_seccomp_notify_fd(), and ret_set_errno.

Here is the call graph for this function:

◆ do_lxcapi_set_cgroup_item()

static bool do_lxcapi_set_cgroup_item ( struct lxc_container c,
const char *  subsys,
const char *  value 
)
static

Definition at line 3275 of file lxccontainer.c.

References call_cleaner, cgroup_exit(), cgroup_init(), cgroup_set(), ERRNO_IS_NOT_SUPPORTED(), is_stopped(), and cgroup_ops::set.

Referenced by add_remove_device_node().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_lxcapi_set_config_item()

static bool do_lxcapi_set_config_item ( struct lxc_container c,
const char *  key,
const char *  v 
)
static

Definition at line 3167 of file lxccontainer.c.

References container_mem_lock(), container_mem_unlock(), do_set_config_item_locked(), and key.

Here is the call graph for this function:

◆ do_lxcapi_set_config_path()

static bool do_lxcapi_set_config_path ( struct lxc_container c,
const char *  path 
)
static

Definition at line 3234 of file lxccontainer.c.

References lxc_container::config_path, container_mem_lock(), container_mem_unlock(), ERROR, and set_config_filename().

Here is the call graph for this function:

◆ do_lxcapi_shutdown()

static bool do_lxcapi_shutdown ( struct lxc_container c,
int  timeout 
)
static

Definition at line 2053 of file lxccontainer.c.

References __do_close, do_lxcapi_init_pid(), do_lxcapi_init_pidfd(), do_lxcapi_is_running(), log_warn, lxc_cmd_add_state_client(), lxc_cmd_sock_rcv_state(), lxc_raw_pidfd_send_signal(), lxc_state2str(), MAX_STATE, pid, STOPPED, task_blocks_signal(), and TRACE.

Here is the call graph for this function:

◆ do_lxcapi_snapshot()

static int do_lxcapi_snapshot ( struct lxc_container c,
const char *  commentfile 
)
static

< Snapshot the original filesystem(s)

< Do not change the MAC address on network interfaces

< Do not edit the rootfs to change the hostname

< Use the same bdev type

< Snapshot only if bdev supports it, else copy

< Snapshot the original filesystem(s)

< Snapshot only if bdev supports it, else copy

Definition at line 4135 of file lxccontainer.c.

References __do_free, lxc_container::config_path, copy_file(), do_lxcapi_clone(), ERROR, get_next_index(), get_snappath_dir(), LXC_CLONE_KEEPBDEVTYPE, LXC_CLONE_KEEPMACADDR, LXC_CLONE_KEEPNAME, LXC_CLONE_MAYBE_SNAPSHOT, LXC_CLONE_SNAPSHOT, LXC_COMMENT_FNAME, lxc_container::lxc_conf, lxc_container_put(), LXC_TIMESTAMP_FNAME, lxcapi_is_defined(), mkdir_p(), must_realloc(), lxc_container::name, PATH_MAX, storage_can_backup(), storage_is_dir(), strnprintf, and SYSERROR.

Here is the call graph for this function:

◆ do_lxcapi_snapshot_destroy()

static bool do_lxcapi_snapshot_destroy ( struct lxc_container c,
const char *  snapname 
)
static

Definition at line 4510 of file lxccontainer.c.

References lxc_container::config_path, do_snapshot_destroy(), get_snappath_dir(), lxc_container::name, and PATH_MAX.

Here is the call graph for this function:

◆ do_lxcapi_snapshot_destroy_all()

static bool do_lxcapi_snapshot_destroy_all ( struct lxc_container c)
static

Definition at line 4525 of file lxccontainer.c.

References get_snappath_dir(), PATH_MAX, and remove_all_snapshots().

Here is the call graph for this function:

◆ do_lxcapi_snapshot_list()

static int do_lxcapi_snapshot_list ( struct lxc_container c,
struct lxc_snapshot **  ret_snaps 
)
static

Definition at line 4297 of file lxccontainer.c.

References __do_closedir, lxc_snapshot::comment_pathname, ERROR, file_exists(), lxc_snapshot::free, get_snapcomment_path(), get_snappath_dir(), get_timestamp(), INFO, LXC_CONFIG_FNAME, lxcapi_is_defined(), lxc_snapshot::lxcpath, lxcsnap_free(), lxc_snapshot::name, PATH_MAX, strequal(), strnprintf, SYSERROR, and lxc_snapshot::timestamp.

Here is the call graph for this function:

◆ do_lxcapi_snapshot_restore()

static bool do_lxcapi_snapshot_restore ( struct lxc_container c,
const char *  snapname,
const char *  newname 
)
static

< Snapshot the original filesystem(s)

< Snapshot only if bdev supports it, else copy

Definition at line 4374 of file lxccontainer.c.

References lxc_container::config_path, container_destroy(), ERROR, lxc_storage::flags, get_snappath_dir(), has_fs_snapshots(), LXC_CLONE_MAYBE_SNAPSHOT, LXC_CLONE_SNAPSHOT, lxc_container_new(), lxc_container_put(), LXC_STORAGE_INTERNAL_OVERLAY_RESTORE, lxc_storage_prepare(), lxc_storage_put(), lxcapi_clone(), lxcapi_is_defined(), PATH_MAX, lxc_storage::rootfs, lxc_rootfs::storage, strequal(), and lxc_storage::type.

Here is the call graph for this function:

◆ do_lxcapi_start()

static bool do_lxcapi_start ( struct lxc_container c,
int  useinit,
char *const  argv[] 
)
static

◆ do_lxcapi_state()

static const char* do_lxcapi_state ( struct lxc_container c)
static

Definition at line 477 of file lxccontainer.c.

References lxc_getstate(), and lxc_state2str().

Here is the call graph for this function:

◆ do_lxcapi_stop()

static bool do_lxcapi_stop ( struct lxc_container c)
static

Definition at line 1191 of file lxccontainer.c.

References lxc_container::config_path, lxc_cmd_stop(), and lxc_container::name.

Here is the call graph for this function:

◆ do_lxcapi_umount()

static int do_lxcapi_umount ( struct lxc_container c,
const char *  target,
unsigned long  flags,
struct lxc_mount mnt 
)
static

Definition at line 5147 of file lxccontainer.c.

References do_lxcapi_init_pid(), ERROR, lxc_list_empty(), pid, switch_to_ns(), SYSERROR, and wait_for_pid().

Here is the call graph for this function:

◆ do_lxcapi_unfreeze()

static bool do_lxcapi_unfreeze ( struct lxc_container c)
static

Definition at line 528 of file lxccontainer.c.

References cgroup_unfreeze(), ENOCGROUP2, FROZEN, lxc_getstate(), and lxc_unfreeze().

Here is the call graph for this function:

◆ do_lxcapi_wait()

static bool do_lxcapi_wait ( struct lxc_container c,
const char *  state,
int  timeout 
)
static

Definition at line 722 of file lxccontainer.c.

References lxc_wait(), and state.

Here is the call graph for this function:

◆ do_lxcapi_want_close_all_fds()

static bool do_lxcapi_want_close_all_fds ( struct lxc_container c,
bool  state 
)
static

Definition at line 705 of file lxccontainer.c.

References container_mem_lock(), container_mem_unlock(), and state.

Here is the call graph for this function:

◆ do_lxcapi_want_daemonize()

static bool do_lxcapi_want_daemonize ( struct lxc_container c,
bool  state 
)
static

Definition at line 688 of file lxccontainer.c.

References container_mem_lock(), container_mem_unlock(), and state.

Here is the call graph for this function:

◆ do_set_config_item_locked()

static bool do_set_config_item_locked ( struct lxc_container c,
const char *  key,
const char *  v 
)
static

Definition at line 3149 of file lxccontainer.c.

References key, lxc_container::lxc_conf, lxc_conf_init(), and lxc_set_config_item_locked().

Referenced by do_lxcapi_clone(), and do_lxcapi_set_config_item().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_snapshot_destroy()

static bool do_snapshot_destroy ( const char *  snapname,
const char *  clonelxcpath 
)
static

Definition at line 4454 of file lxccontainer.c.

References do_lxcapi_destroy(), ERROR, lxc_container_new(), and lxc_container_put().

Referenced by do_lxcapi_snapshot_destroy(), and remove_all_snapshots().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_storage_create()

static struct lxc_storage* do_storage_create ( struct lxc_container c,
const char *  type,
struct bdev_specs specs 
)
static

Definition at line 1253 of file lxccontainer.c.

References __do_free, am_guest_unpriv(), chown_mapped_root(), lxc_storage::dest, do_lxcapi_get_config_path, ERROR, lxc_conf::id_map, lxc_container::lxc_conf, lxc_list_empty(), LXC_ROOTFS_DNAME, must_realloc(), lxc_container::name, lxc_rootfs::path, lxc_conf::rootfs, lxc_container::set_config_item, lxc_storage::src, storage_create(), storage_put(), strnprintf, suggest_default_idmap(), and lxc_storage::type.

Referenced by do_lxcapi_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ enter_net_ns()

static bool enter_net_ns ( struct lxc_container c)
inlinestatic

Definition at line 2235 of file lxccontainer.c.

References do_lxcapi_init_pid(), lxc_list_empty(), pid, and switch_to_ns().

Referenced by do_lxcapi_get_interfaces(), and do_lxcapi_get_ips().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ free_init_cmd()

static void free_init_cmd ( char **  argv)
static

Definition at line 806 of file lxccontainer.c.

Referenced by do_lxcapi_start().

Here is the caller graph for this function:

◆ get_from_array()

static char** get_from_array ( char ***  names,
char *  cname,
int  size 
)
static

Definition at line 2303 of file lxccontainer.c.

References string_cmp().

Referenced by array_contains(), and remove_from_array().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_next_index()

static int get_next_index ( const char *  lxcpath,
char *  cname 
)
static

Definition at line 4085 of file lxccontainer.c.

References __do_free, and must_realloc().

Referenced by do_lxcapi_snapshot().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_snapcomment_path()

static char* get_snapcomment_path ( char *  snappath,
char *  name 
)
static

Definition at line 4250 of file lxccontainer.c.

References __do_free, move_ptr, lxc_container::name, and strnprintf.

Referenced by do_lxcapi_snapshot_list().

Here is the caller graph for this function:

◆ get_snappath_dir()

static bool get_snappath_dir ( struct lxc_container c,
char *  snappath 
)
static

Definition at line 4104 of file lxccontainer.c.

References lxc_container::config_path, dir_exists(), lxc_container::name, PATH_MAX, and strnprintf.

Referenced by do_lxcapi_snapshot(), do_lxcapi_snapshot_destroy(), do_lxcapi_snapshot_destroy_all(), do_lxcapi_snapshot_list(), do_lxcapi_snapshot_restore(), and has_snapshots().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_timestamp()

static char* get_timestamp ( char *  snappath,
char *  name 
)
static

Definition at line 4267 of file lxccontainer.c.

References __do_fclose, __do_free, log_error_errno, move_ptr, lxc_container::name, PATH_MAX, and strnprintf.

Referenced by do_lxcapi_snapshot_list().

Here is the caller graph for this function:

◆ has_fs_snapshots()

static bool has_fs_snapshots ( struct lxc_container c)
static

Definition at line 2859 of file lxccontainer.c.

References __do_fclose, lxc_container::config_path, INFO, lxc_container::name, PATH_MAX, and strnprintf.

Referenced by do_lxcapi_destroy(), do_lxcapi_rename(), and do_lxcapi_snapshot_restore().

Here is the caller graph for this function:

◆ has_snapshots()

static bool has_snapshots ( struct lxc_container c)
static

Definition at line 2889 of file lxccontainer.c.

References __do_closedir, get_snappath_dir(), PATH_MAX, and strequal().

Referenced by do_lxcapi_destroy(), and do_lxcapi_rename().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_stopped()

static bool is_stopped ( struct lxc_container c)
static

Definition at line 490 of file lxccontainer.c.

References lxc_getstate(), and STOPPED.

Referenced by container_destroy(), do_lxcapi_clone(), do_lxcapi_get_cgroup_item(), do_lxcapi_is_running(), and do_lxcapi_set_cgroup_item().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ list_active_containers()

int list_active_containers ( const char *  lxcpath,
char ***  names,
struct lxc_container ***  cret 
)

Get a list of active containers for a given lxcpath.

Parameters
lxcpathFull LXCPATH path to consider.
[out]namesDynamically-allocated array of container names.
[out]cretDynamically-allocated list of containers.
Returns
Number of containers found, or -1 on error.
Note
Some of the containers may not be "defined".
Values returned in cret are sorted by container name.
names and cret may both (or either) be specified as NULL.
names and cret must be freed by the caller.

Definition at line 5513 of file lxccontainer.c.

References __do_fclose, __do_free, add_to_array(), add_to_clist(), array_contains(), getline(), INFO, lxc_cmd_get_lxcpath(), lxc_cmd_get_name(), lxc_container_new(), lxc_container_put(), lxc_global_config_value(), remove_from_array(), and strnequal().

Referenced by list_all_containers(), ls_get(), and main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ list_all_containers()

int list_all_containers ( const char *  lxcpath,
char ***  names,
struct lxc_container ***  cret 
)

Get a complete list of all containers for a given lxcpath.

Parameters
lxcpathFull LXCPATH path to consider.
[out]namesDynamically-allocated array of container name.
[out]cretDynamically-allocated list of containers.
Returns
Number of containers, or -1 on error.
Note
Some of the containers may not be "defined".
Values returned in cret are sorted by container name.
names and cret may both (or either) be specified as NULL.
names and cret must be freed by the caller.

Definition at line 5666 of file lxccontainer.c.

References add_to_array(), add_to_clist(), array_contains(), list_active_containers(), list_defined_containers(), lxc_container_new(), lxc_container_put(), remove_from_array(), and WARN.

Referenced by ls_get().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ list_defined_containers()

int list_defined_containers ( const char *  lxcpath,
char ***  names,
struct lxc_container ***  cret 
)

Get a list of defined containers in a lxcpath.

Parameters
lxcpathlxcpath under which to look.
namesIf not NULL, then a list of container names will be returned here.
cretIf not NULL, then a list of lxc_containers will be returned here.
Returns
Number of containers found, or -1 on error.
Note
Values returned in cret are sorted by container name.

Definition at line 5422 of file lxccontainer.c.

References __do_closedir, add_to_array(), add_to_clist(), config_file_exists(), do_lxcapi_is_defined(), INFO, lxc_container_new(), lxc_container_put(), lxc_global_config_value(), remove_from_array(), strnequal(), and SYSERROR.

Referenced by list_all_containers(), and main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_config_locked()

static bool load_config_locked ( struct lxc_container c,
const char *  fname 
)
static

Definition at line 630 of file lxccontainer.c.

References lxc_conf_init(), and lxc_config_read().

Referenced by do_lxcapi_create(), and do_lxcapi_load_config().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lxc_config_item_is_supported()

bool lxc_config_item_is_supported ( const char *  key)

Check if the configuration item is supported by this LXC instance.

Parameters
keyConfiguration item to check for.

Definition at line 5753 of file lxccontainer.c.

References key, and lxc_get_config_exact().

Here is the call graph for this function:

◆ lxc_container_free()

static void lxc_container_free ( struct lxc_container c)
static

Definition at line 252 of file lxccontainer.c.

References lxc_container::config_path, lxc_container::configfile, lxc_container::error_string, lxc_container::lxc_conf, lxc_conf_free(), lxc_putlock(), lxc_container::name, lxc_container::privlock, and lxc_container::slock.

Referenced by lxc_container_new(), and lxc_container_put().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lxc_container_get()

int lxc_container_get ( struct lxc_container c)

Add a reference to the specified container.

Parameters
cContainer.
Returns
true on success, false on error.

Definition at line 312 of file lxccontainer.c.

References container_mem_lock(), container_mem_unlock(), and lxc_container::numthreads.

Referenced by lxc_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lxc_container_new()

struct lxc_container* lxc_container_new ( const char *  name,
const char *  configpath 
)

Create a new container.

Parameters
nameName to use for container.
configpathFull path to configuration file to use.
Returns
Newly-allocated container, or NULL on error.

Definition at line 5256 of file lxccontainer.c.

References lxc_container::add_device_node, lxc_container::attach, lxc_container::attach_interface, lxc_container::attach_run_wait, lxc_container::attach_run_waitl, lxc_container::checkpoint, lxc_container::clear_config, lxc_container::clear_config_item, lxc_container::clone, lxc_container::config_file_name, lxc_container::config_path, lxc_container::configfile, lxc_container::console, lxc_container::console_getfd, lxc_container::console_log, container_destroy(), lxc_container::create, lxc_container::createl, lxc_container::daemonize, lxc_container::destroy, lxc_container::destroy_with_snapshots, lxc_container::detach_interface, lxc_container::devpts_fd, file_exists(), lxc_container::freeze, lxc_container::get_cgroup_item, lxc_container::get_config_item, lxc_container::get_config_path, lxc_container::get_interfaces, lxc_container::get_ips, lxc_container::get_keys, lxc_container::get_running_config_item, lxc_container::init_pid, lxc_container::init_pidfd, lxc_container::is_defined, lxc_container::is_running, lxc_container::load_config, lxc_container_free(), LXC_CREATE_FAILED, LXC_CREATE_INCOMPLETE, LXC_CREATE_ONGOING, lxc_global_config_value(), lxc_newlock(), lxcapi_add_device_node(), lxcapi_attach(), lxcapi_attach_interface(), lxcapi_attach_run_wait(), lxcapi_attach_run_waitl(), lxcapi_checkpoint(), lxcapi_clear_config(), lxcapi_clear_config_item(), lxcapi_clone(), lxcapi_config_file_name(), lxcapi_console(), lxcapi_console_getfd(), lxcapi_console_log(), lxcapi_create(), lxcapi_createl(), lxcapi_destroy(), lxcapi_destroy_with_snapshots(), lxcapi_detach_interface(), lxcapi_devpts_fd(), lxcapi_freeze(), lxcapi_get_cgroup_item(), lxcapi_get_config_item(), lxcapi_get_config_path(), lxcapi_get_interfaces(), lxcapi_get_ips(), lxcapi_get_keys(), lxcapi_get_running_config_item(), lxcapi_init_pid(), lxcapi_init_pidfd(), lxcapi_is_defined(), lxcapi_is_running(), lxcapi_load_config(), lxcapi_may_control(), lxcapi_migrate(), lxcapi_mount(), lxcapi_reboot(), lxcapi_reboot2(), lxcapi_remove_device_node(), lxcapi_rename(), lxcapi_restore(), lxcapi_save_config(), lxcapi_seccomp_notify_fd(), lxcapi_seccomp_notify_fd_active(), lxcapi_set_cgroup_item(), lxcapi_set_config_item(), lxcapi_set_config_path(), lxcapi_shutdown(), lxcapi_snapshot(), lxcapi_snapshot_destroy(), lxcapi_snapshot_destroy_all(), lxcapi_snapshot_list(), lxcapi_snapshot_restore(), lxcapi_start(), lxcapi_startl(), lxcapi_state(), lxcapi_stop(), lxcapi_umount(), lxcapi_unfreeze(), lxcapi_wait(), lxcapi_want_close_all_fds(), lxcapi_want_daemonize(), lxc_container::may_control, lxc_container::migrate, lxc_container::mount, lxc_container::name, lxc_container::numthreads, ongoing_create(), lxc_container::pidfile, lxc_container::privlock, lxc_container::reboot, lxc_container::reboot2, lxc_container::remove_device_node, remove_trailing_slashes(), lxc_container::rename, lxc_container::restore, lxc_container::save_config, lxc_container::seccomp_notify_fd, lxc_container::seccomp_notify_fd_active, lxc_container::set_cgroup_item, set_config_filename(), lxc_container::set_config_item, lxc_container::set_config_path, lxc_container::shutdown, lxc_container::slock, lxc_container::snapshot, lxc_container::snapshot_destroy, lxc_container::snapshot_destroy_all, lxc_container::snapshot_list, lxc_container::snapshot_restore, lxc_container::start, lxc_container::startl, lxc_container::state, lxc_container::stop, strlcpy(), SYSERROR, lxc_container::umount, lxc_container::unfreeze, lxc_container::wait, lxc_container::want_close_all_fds, and lxc_container::want_daemonize.

Referenced by do_destroy_with_snapshots(), do_lxcapi_clone(), do_lxcapi_snapshot_restore(), do_snapshot_destroy(), list_active_containers(), list_all_containers(), list_defined_containers(), ls_get(), lxc_container_name_to_pid(), lxc_destroy_container_on_signal(), main(), mod_all_rdeps(), and print_info().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lxc_container_put()

int lxc_container_put ( struct lxc_container c)

Drop a reference to the specified container.

Parameters
cContainer.
Returns
0 on success, 1 if reference was successfully dropped and container has been freed, and -1 on error.
Warning
If 1 is returned, c is no longer valid.

Definition at line 338 of file lxccontainer.c.

References container_mem_lock(), container_mem_unlock(), lxc_container_free(), and lxc_container::numthreads.

Referenced by checkpoint(), ct_free(), do_clone(), do_clone_ephemeral(), do_destroy_with_snapshots(), do_lxcapi_clone(), do_lxcapi_rename(), do_lxcapi_snapshot(), do_lxcapi_snapshot_restore(), do_snapshot_destroy(), list_active_containers(), list_all_containers(), list_defined_containers(), ls_get(), lxc_attach(), lxc_destroy_container_on_signal(), main(), mod_all_rdeps(), print_info(), put_attach_context(), put_lxc_container(), restore(), and restore_finalize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lxc_get_global_config_item()

const char* lxc_get_global_config_item ( const char *  key)

Get the value for a global config key.

Parameters
keyThe name of the config key
Returns
String representing the current value for the key.

Definition at line 3325 of file lxccontainer.c.

References key, and lxc_global_config_value().

Referenced by lxc_arguments_parse(), and main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lxc_get_version()

const char* lxc_get_version ( void  )

Determine version of LXC.

Returns
Static string representing version of LXC in use.
Note
Returned string must not be freed.

Definition at line 3330 of file lxccontainer.c.

References LXC_VERSION.

Referenced by print_version_exit().

Here is the caller graph for this function:

◆ lxc_get_wait_states()

int lxc_get_wait_states ( const char **  states)

Obtain a list of all container states.

Parameters
[out]statesCaller-allocated array to hold all states (may be NULL).
Returns
Number of container states.
Note
Passing NULL for states allows the caller to first calculate how many states there are before calling the function again, the second time providing a suitably-sized array to store the static string pointers in.
The states array should be freed by the caller, but not the strings the elements point to.

Definition at line 5407 of file lxccontainer.c.

References lxc_state2str(), and MAX_STATE.

Here is the call graph for this function:

◆ lxc_has_api_extension()

bool lxc_has_api_extension ( const char *  extension)

Check if an API extension is supported by this LXC instance.

Parameters
extensionAPI extension to check for.

Definition at line 5758 of file lxccontainer.c.

References api_extensions, nr_api_extensions, and strequal().

Here is the call graph for this function:

◆ lxc_rcv_status()

static int lxc_rcv_status ( int  state_socket)
static

Definition at line 819 of file lxccontainer.c.

References lxc_abstract_unix_rcv_credential(), state, and TRACE.

Referenced by wait_on_daemonized_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lxc_rmdir_onedev_wrapper()

static int lxc_rmdir_onedev_wrapper ( void *  data)
static

Definition at line 2931 of file lxccontainer.c.

References lxc_rmdir_onedev().

Referenced by container_destroy().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lxc_set_config_item_locked()

int lxc_set_config_item_locked ( struct lxc_conf conf,
const char *  key,
const char *  v 
)

Definition at line 3126 of file lxccontainer.c.

References do_append_unexp_config_line(), do_clear_unexp_config_line(), key, lxc_config_value_empty(), lxc_get_config(), and lxc_config_t::set.

Referenced by do_set_config_item_locked().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lxc_unlink_exec_wrapper()

static int lxc_unlink_exec_wrapper ( void *  data)
static

Definition at line 2937 of file lxccontainer.c.

Referenced by container_destroy().

Here is the caller graph for this function:

◆ lxcapi_add_device_node()

static bool lxcapi_add_device_node ( struct lxc_container c,
const char *  a1,
const char *  a2 
)
static

Definition at line 4692 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_attach()

static int lxcapi_attach ( struct lxc_container c,
lxc_attach_exec_t  exec_function,
void *  exec_payload,
lxc_attach_options_t options,
pid_t *  attached_process 
)
static

Definition at line 4033 of file lxccontainer.c.

References current_config, and lxc_attach().

Referenced by lxc_container_new().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lxcapi_attach_interface()

static bool lxcapi_attach_interface ( struct lxc_container c,
const char *  a1,
const char *  a2 
)
static

Definition at line 4748 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_attach_run_wait()

static int lxcapi_attach_run_wait ( struct lxc_container c,
lxc_attach_options_t options,
const char *  program,
const char *const  argv[] 
)
static

Definition at line 4072 of file lxccontainer.c.

References current_config, do_lxcapi_attach_run_wait(), and lxc_container::lxc_conf.

Referenced by lxc_container_new().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lxcapi_attach_run_waitl()

static int lxcapi_attach_run_waitl ( struct lxc_container c,
lxc_attach_options_t options,
const char *  program,
const char *  arg,
  ... 
)
static

Definition at line 5206 of file lxccontainer.c.

References current_config, do_lxcapi_attach_run_wait(), ERROR, and lxc_va_arg_list_to_argv_const().

Referenced by lxc_container_new().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lxcapi_checkpoint()

static bool lxcapi_checkpoint ( struct lxc_container c,
char *  a1,
bool  a2,
bool  a3 
)
static

Definition at line 4948 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_clear_config()

static void lxcapi_clear_config ( struct lxc_container c)
static

Definition at line 1750 of file lxccontainer.c.

References lxc_container::lxc_conf, and lxc_conf_free().

Referenced by lxc_container_new().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lxcapi_clear_config_item()

static bool lxcapi_clear_config_item ( struct lxc_container c,
const char *  a1 
)
static

Definition at line 2233 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_clone()

static struct lxc_container* lxcapi_clone ( struct lxc_container c,
const char *  newname,
const char *  lxcpath,
int  flags,
const char *  bdevtype,
const char *  bdevdata,
uint64_t  newsize,
char **  hookargs 
)
static

Definition at line 3980 of file lxccontainer.c.

References current_config, do_lxcapi_clone(), and lxc_container::lxc_conf.

Referenced by do_lxcapi_rename(), do_lxcapi_snapshot_restore(), and lxc_container_new().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lxcapi_config_file_name()

static char* lxcapi_config_file_name ( struct lxc_container c)
static

Definition at line 3185 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_console()

static int lxcapi_console ( struct lxc_container c,
int  ttynum,
int  stdinfd,
int  stdoutfd,
int  stderrfd,
int  escape 
)
static

Definition at line 559 of file lxccontainer.c.

References current_config, and lxc_console().

Referenced by lxc_container_new().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lxcapi_console_getfd()

static int lxcapi_console_getfd ( struct lxc_container c,
int *  a1,
int *  a2 
)
static

Definition at line 557 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_console_log()

static int lxcapi_console_log ( struct lxc_container c,
struct lxc_console_log a1 
)
static

Definition at line 598 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_create()

static bool lxcapi_create ( struct lxc_container c,
const char *  t,
const char *  bdevtype,
struct bdev_specs specs,
int  flags,
char *const  argv[] 
)
static

Definition at line 1935 of file lxccontainer.c.

References current_config, do_lxcapi_create(), lxc_storage::flags, and lxc_container::lxc_conf.

Referenced by lxc_container_new().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lxcapi_createl()

static bool lxcapi_createl ( struct lxc_container c,
const char *  t,
const char *  bdevtype,
struct bdev_specs specs,
int  flags,
  ... 
)
static

Definition at line 2151 of file lxccontainer.c.

References current_config, do_lxcapi_create(), ERROR, and lxc_va_arg_list_to_argv().

Referenced by lxc_container_new().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lxcapi_destroy()

static bool lxcapi_destroy ( struct lxc_container c)
static

Definition at line 3109 of file lxccontainer.c.

Referenced by do_lxcapi_destroy_with_snapshots(), and lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_destroy_with_snapshots()

static bool lxcapi_destroy_with_snapshots ( struct lxc_container c)
static

Definition at line 3124 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_detach_interface()

static bool lxcapi_detach_interface ( struct lxc_container c,
const char *  a1,
const char *  a2 
)
static

Definition at line 4849 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_devpts_fd()

static int lxcapi_devpts_fd ( struct lxc_container c)
static

Definition at line 628 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_freeze()

static bool lxcapi_freeze ( struct lxc_container c)
static

Definition at line 526 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_get_cgroup_item()

static int lxcapi_get_cgroup_item ( struct lxc_container c,
const char *  a1,
char *  a2,
int  a3 
)
static

Definition at line 3323 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_get_config_item()

static int lxcapi_get_config_item ( struct lxc_container c,
const char *  a1,
char *  a2,
int  a3 
)
static

Definition at line 2577 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_get_config_path()

static const char * lxcapi_get_config_path ( struct lxc_container c)
static

Definition at line 3193 of file lxccontainer.c.

References lxc_container::config_path.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_get_interfaces()

static char** lxcapi_get_interfaces ( struct lxc_container c)
static

Definition at line 2427 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_get_ips()

static char** lxcapi_get_ips ( struct lxc_container c,
const char *  a1,
const char *  a2,
int  a3 
)
static

Definition at line 2556 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_get_keys()

static int lxcapi_get_keys ( struct lxc_container c,
const char *  a1,
char *  a2,
int  a3 
)
static

Definition at line 2623 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_get_running_config_item()

static char* lxcapi_get_running_config_item ( struct lxc_container c,
const char *  a1 
)
static

Definition at line 2594 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_init_pid()

static pid_t lxcapi_init_pid ( struct lxc_container c)
static

Definition at line 608 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_init_pidfd()

static int lxcapi_init_pidfd ( struct lxc_container c)
static

Definition at line 618 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_is_defined()

static bool lxcapi_is_defined ( struct lxc_container c)
static

Definition at line 475 of file lxccontainer.c.

Referenced by do_lxcapi_destroy(), do_lxcapi_destroy_with_snapshots(), do_lxcapi_rename(), do_lxcapi_snapshot(), do_lxcapi_snapshot_list(), do_lxcapi_snapshot_restore(), and lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_is_running()

static bool lxcapi_is_running ( struct lxc_container c)
static

Definition at line 506 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_load_config()

static bool lxcapi_load_config ( struct lxc_container c,
const char *  a1 
)
static

Definition at line 686 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_may_control()

static bool lxcapi_may_control ( struct lxc_container c)
static

Definition at line 4548 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_migrate()

static int lxcapi_migrate ( struct lxc_container c,
unsigned int  a1,
struct migrate_opts a2,
unsigned int  a3 
)
static

Definition at line 4933 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_mount()

static int lxcapi_mount ( struct lxc_container c,
const char *  a1,
const char *  a2,
const char *  a3,
unsigned long  a4,
const void *  a5,
struct lxc_mount a6 
)
static

Definition at line 5145 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_reboot()

static bool lxcapi_reboot ( struct lxc_container c)
static

Definition at line 1982 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_reboot2()

static bool lxcapi_reboot2 ( struct lxc_container c,
int  a1 
)
static

Definition at line 2051 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_remove_device_node()

static bool lxcapi_remove_device_node ( struct lxc_container c,
const char *  a1,
const char *  a2 
)
static

Definition at line 4704 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_rename()

static bool lxcapi_rename ( struct lxc_container c,
const char *  a1 
)
static

Definition at line 4031 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_restore()

static bool lxcapi_restore ( struct lxc_container c,
char *  a1,
bool  a2 
)
static

Definition at line 4962 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_save_config()

static bool lxcapi_save_config ( struct lxc_container c,
const char *  a1 
)
static

Definition at line 2685 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_seccomp_notify_fd()

static int lxcapi_seccomp_notify_fd ( struct lxc_container c)
static

Definition at line 5244 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_seccomp_notify_fd_active()

static int lxcapi_seccomp_notify_fd_active ( struct lxc_container c)
static

Definition at line 5254 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_set_cgroup_item()

static bool lxcapi_set_cgroup_item ( struct lxc_container c,
const char *  a1,
const char *  a2 
)
static

Definition at line 3298 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_set_config_item()

static bool lxcapi_set_config_item ( struct lxc_container c,
const char *  a1,
const char *  a2 
)
static

Definition at line 3183 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_set_config_path()

static bool lxcapi_set_config_path ( struct lxc_container c,
const char *  a1 
)
static

Definition at line 3273 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_shutdown()

static bool lxcapi_shutdown ( struct lxc_container c,
int  a1 
)
static

Definition at line 2149 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_snapshot()

static int lxcapi_snapshot ( struct lxc_container c,
const char *  a1 
)
static

Definition at line 4240 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_snapshot_destroy()

static bool lxcapi_snapshot_destroy ( struct lxc_container c,
const char *  a1 
)
static

Definition at line 4523 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_snapshot_destroy_all()

static bool lxcapi_snapshot_destroy_all ( struct lxc_container c)
static

Definition at line 4538 of file lxccontainer.c.

Referenced by do_lxcapi_destroy_with_snapshots(), and lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_snapshot_list()

static int lxcapi_snapshot_list ( struct lxc_container c,
struct lxc_snapshot **  a1 
)
static

Definition at line 4372 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_snapshot_restore()

static bool lxcapi_snapshot_restore ( struct lxc_container c,
const char *  a1,
const char *  a2 
)
static

Definition at line 4452 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_start()

static bool lxcapi_start ( struct lxc_container c,
int  useinit,
char *const  argv[] 
)
static

Definition at line 1143 of file lxccontainer.c.

References current_config, do_lxcapi_start(), and lxc_container::lxc_conf.

Referenced by lxc_container_new().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lxcapi_startl()

static bool lxcapi_startl ( struct lxc_container c,
int  useinit,
  ... 
)
static

Definition at line 1156 of file lxccontainer.c.

References current_config, do_lxcapi_start(), lxc_container::lxc_conf, and lxc_va_arg_list_to_argv().

Referenced by lxc_container_new().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lxcapi_state()

static const char* lxcapi_state ( struct lxc_container c)
static

Definition at line 488 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_stop()

static bool lxcapi_stop ( struct lxc_container c)
static

Definition at line 1203 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_umount()

static int lxcapi_umount ( struct lxc_container c,
const char *  a1,
unsigned long  a2,
struct lxc_mount a3 
)
static

Definition at line 5204 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_unfreeze()

static bool lxcapi_unfreeze ( struct lxc_container c)
static

Definition at line 547 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_wait()

static bool lxcapi_wait ( struct lxc_container c,
const char *  a1,
int  a2 
)
static

Definition at line 734 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_want_close_all_fds()

static bool lxcapi_want_close_all_fds ( struct lxc_container c,
bool  a1 
)
static

Definition at line 720 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcapi_want_daemonize()

static bool lxcapi_want_daemonize ( struct lxc_container c,
bool  a1 
)
static

Definition at line 703 of file lxccontainer.c.

Referenced by lxc_container_new().

Here is the caller graph for this function:

◆ lxcsnap_free()

static void lxcsnap_free ( struct lxc_snapshot s)
static

Definition at line 4242 of file lxccontainer.c.

Referenced by do_lxcapi_snapshot_list().

Here is the caller graph for this function:

◆ lxctemplatefilename()

static char* lxctemplatefilename ( char *  tpath)
static

Definition at line 1307 of file lxccontainer.c.

Referenced by create_run_template().

Here is the caller graph for this function:

◆ mod_all_rdeps()

void mod_all_rdeps ( struct lxc_container c,
bool  inc 
)

Definition at line 2816 of file lxccontainer.c.

References __do_fclose, __do_free, lxc_container::config_path, ERROR, getline(), lxc_container_new(), lxc_container_put(), mod_rdep(), lxc_container::name, PATH_MAX, remove_trailing_newlines(), and strnprintf.

Referenced by container_destroy(), copy_storage(), and lxc_destroy_container_on_signal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mod_rdep()

static bool mod_rdep ( struct lxc_container c0,
struct lxc_container c,
bool  inc 
)
static

Definition at line 2688 of file lxccontainer.c.

References container_disk_lock(), container_disk_unlock(), ERROR, lxc_strmmap(), lxc_strmunmap(), O_CLOEXEC, PATH_MAX, strnprintf, and SYSERROR.

Referenced by mod_all_rdeps().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ongoing_create()

static int ongoing_create ( struct lxc_container c)
static

Definition at line 128 of file lxccontainer.c.

References __do_close, __do_free, lxc_container::config_path, F_OFD_GETLK, LXC_CREATE_FAILED, LXC_CREATE_INCOMPLETE, LXC_CREATE_ONGOING, LXC_CREATE_SUCCESS, LXC_PARTIAL_FNAME, must_realloc(), lxc_container::name, O_CLOEXEC, and strnprintf.

Referenced by do_lxcapi_start(), and lxc_container_new().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ prepend_lxc_header()

static bool prepend_lxc_header ( char *  path,
const char *  t,
char *const  argv[] 
)
static

Definition at line 1628 of file lxccontainer.c.

References ERROR, get_template_path(), and SYSERROR.

Referenced by do_lxcapi_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ push_arg()

static void push_arg ( char ***  argp,
char *  arg,
int *  nargs 
)
static

Definition at line 761 of file lxccontainer.c.

References must_copy_string().

Referenced by split_init_cmd().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ remove_all_snapshots()

static bool remove_all_snapshots ( const char *  path)
static

Definition at line 4479 of file lxccontainer.c.

References __do_closedir, do_snapshot_destroy(), strequal(), and SYSERROR.

Referenced by do_lxcapi_snapshot_destroy_all().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ remove_from_array()

static bool remove_from_array ( char ***  names,
char *  cname,
int  size 
)
static

Definition at line 2319 of file lxccontainer.c.

References ERROR, and get_from_array().

Referenced by list_active_containers(), list_all_containers(), and list_defined_containers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ remove_partial()

static void remove_partial ( struct lxc_container c,
int  fd 
)
static

Definition at line 211 of file lxccontainer.c.

References __do_free, lxc_container::config_path, LXC_PARTIAL_FNAME, must_realloc(), lxc_container::name, strnprintf, and SYSERROR.

Referenced by do_lxcapi_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_config_filename()

static bool set_config_filename ( struct lxc_container c)
static

Definition at line 3207 of file lxccontainer.c.

References lxc_container::config_path, lxc_container::configfile, LXC_CONFIG_FNAME, lxc_container::name, and strnprintf.

Referenced by do_lxcapi_set_config_path(), and lxc_container_new().

Here is the caller graph for this function:

◆ should_default_to_snapshot()

static bool should_default_to_snapshot ( struct lxc_container c0,
struct lxc_container c1 
)
static

Definition at line 3553 of file lxccontainer.c.

References __do_free, btrfs_same_fs(), lxc_container::config_path, is_btrfs_fs(), is_btrfs_subvol(), lxc_container::lxc_conf, must_realloc(), lxc_container::name, lxc_rootfs::path, lxc_conf::rootfs, and strnprintf.

Referenced by copy_storage().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ split_init_cmd()

static char** split_init_cmd ( const char *  incmd)
static

Definition at line 778 of file lxccontainer.c.

References __do_free, lxc_iterate_parts, must_copy_string(), and push_arg().

Referenced by do_lxcapi_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ string_cmp()

static int string_cmp ( char **  first,
char **  second 
)
inlinestatic

Definition at line 2251 of file lxccontainer.c.

Referenced by add_to_array(), and get_from_array().

Here is the caller graph for this function:

◆ wait_on_daemonized_start()

static bool wait_on_daemonized_start ( struct lxc_handler handler,
int  pid 
)
static

Definition at line 838 of file lxccontainer.c.

References close_prot_errno_disarm, DEBUG, ERROR, lxc_rcv_status(), lxc_state2str(), pid, RUNNING, state, lxc_handler::state_socket_pair, SYSERROR, TRACE, and wait_for_pid().

Referenced by do_lxcapi_start().

Here is the call graph for this function:
Here is the caller graph for this function: