LXC
attach_options.h
Go to the documentation of this file.
1 
25 #ifndef __LXC_ATTACH_OPTIONS_H
26 #define __LXC_ATTACH_OPTIONS_H
27 
28 #include <sys/types.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
41 
42 enum {
43  /* The following are on by default: */
47  LXC_ATTACH_LSM_EXEC = 0x00000008,
49  /* The following are off by default: */
51  LXC_ATTACH_LSM_NOW = 0x00020000,
52  /* Set PR_SET_NO_NEW_PRIVS to block execve() gainable privileges. */
53  LXC_ATTACH_NO_NEW_PRIVS = 0x00040000,
54  LXC_ATTACH_TERMINAL = 0x00080000,
56  /* We have 16 bits for things that are on by default and 16 bits that
57  * are off by default, that should be sufficient to keep binary
58  * compatibility for a while
59  */
60  LXC_ATTACH_DEFAULT = 0x0000FFFF
61 };
62 
64 #define LXC_ATTACH_LSM (LXC_ATTACH_LSM_EXEC | LXC_ATTACH_LSM_NOW)
65 
74 typedef int (*lxc_attach_exec_t)(void* payload);
75 
79 typedef struct lxc_attach_options_t {
82 
85 
91 
96  char* initial_cwd;
97 
103  uid_t uid;
104 
110  gid_t gid;
111 
114 
117 
122 
131  int stdin_fd;
132  int stdout_fd;
133  int stderr_fd;
137  int log_fd;
139 
141 #define LXC_ATTACH_OPTIONS_DEFAULT \
142  { \
143  /* .attach_flags = */ LXC_ATTACH_DEFAULT, \
144  /* .namespaces = */ -1, \
145  /* .personality = */ -1, \
146  /* .initial_cwd = */ NULL, \
147  /* .uid = */ (uid_t)-1, \
148  /* .gid = */ (gid_t)-1, \
149  /* .env_policy = */ LXC_ATTACH_KEEP_ENV, \
150  /* .extra_env_vars = */ NULL, \
151  /* .extra_keep_env = */ NULL, \
152  /* .stdin_fd = */ 0, \
153  /* .stdout_fd = */ 1, \
154  /* .stderr_fd = */ 2, \
155  /* .log_fd = */ -EBADF, \
156  }
157 
161 typedef struct lxc_attach_command_t {
162  char* program;
163  char** argv;
165 
173 extern int lxc_attach_run_command(void* payload);
174 
182 extern int lxc_attach_run_shell(void* payload);
183 
184 #ifdef __cplusplus
185 }
186 #endif
187 
188 #endif
lxc_attach_options_t::gid
gid_t gid
Definition: attach_options.h:110
lxc_attach_env_policy_t
lxc_attach_env_policy_t
Definition: attach_options.h:37
LXC_ATTACH_CLEAR_ENV
@ LXC_ATTACH_CLEAR_ENV
Definition: attach_options.h:39
lxc_attach_options_t::personality
long personality
Definition: attach_options.h:90
lxc_attach_exec_t
int(* lxc_attach_exec_t)(void *payload)
Definition: attach_options.h:74
LXC_ATTACH_REMOUNT_PROC_SYS
@ LXC_ATTACH_REMOUNT_PROC_SYS
Definition: attach_options.h:50
lxc_attach_options_t::initial_cwd
char * initial_cwd
Definition: attach_options.h:96
lxc_attach_options_t::stdout_fd
int stdout_fd
Definition: attach_options.h:132
LXC_ATTACH_SET_PERSONALITY
@ LXC_ATTACH_SET_PERSONALITY
Definition: attach_options.h:46
lxc_attach_options_t::env_policy
lxc_attach_env_policy_t env_policy
Definition: attach_options.h:113
LXC_ATTACH_DROP_CAPABILITIES
@ LXC_ATTACH_DROP_CAPABILITIES
Definition: attach_options.h:45
lxc_attach_options_t::log_fd
int log_fd
Definition: attach_options.h:137
LXC_ATTACH_NO_NEW_PRIVS
@ LXC_ATTACH_NO_NEW_PRIVS
Definition: attach_options.h:53
LXC_ATTACH_LSM_EXEC
@ LXC_ATTACH_LSM_EXEC
Definition: attach_options.h:47
LXC_ATTACH_TERMINAL
@ LXC_ATTACH_TERMINAL
Definition: attach_options.h:54
lxc_attach_options_t::namespaces
int namespaces
Definition: attach_options.h:84
lxc_attach_command_t
Definition: attach_options.h:161
lxc_attach_options_t::stdin_fd
int stdin_fd
Definition: attach_options.h:131
lxc_attach_run_shell
int lxc_attach_run_shell(void *payload)
Run a shell command in the container.
lxc_attach_options_t
Definition: attach_options.h:79
lxc_attach_options_t
struct lxc_attach_options_t lxc_attach_options_t
lxc_attach_options_t::uid
uid_t uid
Definition: attach_options.h:103
lxc_attach_options_t::extra_env_vars
char ** extra_env_vars
Definition: attach_options.h:116
lxc_attach_command_t::argv
char ** argv
Definition: attach_options.h:163
lxc_attach_run_command
int lxc_attach_run_command(void *payload)
Run a command in the container.
LXC_ATTACH_DEFAULT
@ LXC_ATTACH_DEFAULT
Definition: attach_options.h:60
lxc_attach_options_t::extra_keep_env
char ** extra_keep_env
Definition: attach_options.h:121
lxc_attach_command_t
struct lxc_attach_command_t lxc_attach_command_t
lxc_attach_options_t::attach_flags
int attach_flags
Definition: attach_options.h:81
lxc_attach_options_t::stderr_fd
int stderr_fd
Definition: attach_options.h:133
LXC_ATTACH_MOVE_TO_CGROUP
@ LXC_ATTACH_MOVE_TO_CGROUP
Definition: attach_options.h:44
LXC_ATTACH_LSM_NOW
@ LXC_ATTACH_LSM_NOW
Definition: attach_options.h:51
LXC_ATTACH_KEEP_ENV
@ LXC_ATTACH_KEEP_ENV
Definition: attach_options.h:38
lxc_attach_command_t::program
char * program
Definition: attach_options.h:162