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,
55  /* We have 16 bits for things that are on by default and 16 bits that
56  * are off by default, that should be sufficient to keep binary
57  * compatibility for a while
58  */
59  LXC_ATTACH_DEFAULT = 0x0000FFFF
60 };
61 
63 #define LXC_ATTACH_LSM (LXC_ATTACH_LSM_EXEC | LXC_ATTACH_LSM_NOW)
64 
73 typedef int (*lxc_attach_exec_t)(void* payload);
74 
78 typedef struct lxc_attach_options_t {
81 
84 
90 
95  char* initial_cwd;
96 
102  uid_t uid;
103 
109  gid_t gid;
110 
112  lxc_attach_env_policy_t env_policy;
113 
116 
121 
130  int stdin_fd;
131  int stdout_fd;
132  int stderr_fd;
135 
137 #define LXC_ATTACH_OPTIONS_DEFAULT \
138  { \
139  /* .attach_flags = */ LXC_ATTACH_DEFAULT, \
140  /* .namespaces = */ -1, \
141  /* .personality = */ -1, \
142  /* .initial_cwd = */ NULL, \
143  /* .uid = */ (uid_t)-1, \
144  /* .gid = */ (gid_t)-1, \
145  /* .env_policy = */ LXC_ATTACH_KEEP_ENV, \
146  /* .extra_env_vars = */ NULL, \
147  /* .extra_keep_env = */ NULL, \
148  /* .stdin_fd = */ 0, 1, 2 \
149  }
150 
154 typedef struct lxc_attach_command_t {
155  char* program;
156  char** argv;
158 
166 extern int lxc_attach_run_command(void* payload);
167 
175 extern int lxc_attach_run_shell(void* payload);
176 
177 #ifdef __cplusplus
178 }
179 #endif
180 
181 #endif
int stdin_fd
Definition: attach_options.h:130
Definition: attach_options.h:154
int namespaces
Definition: attach_options.h:83
char * program
Definition: attach_options.h:155
uid_t uid
Definition: attach_options.h:102
Definition: attach_options.h:44
int stderr_fd
Definition: attach_options.h:132
char ** extra_env_vars
Definition: attach_options.h:115
Definition: attach_options.h:59
Definition: attach_options.h:38
lxc_attach_env_policy_t
Definition: attach_options.h:37
char ** extra_keep_env
Definition: attach_options.h:120
Definition: attach_options.h:51
int attach_flags
Definition: attach_options.h:80
struct lxc_attach_options_t lxc_attach_options_t
char ** argv
Definition: attach_options.h:156
Definition: attach_options.h:39
gid_t gid
Definition: attach_options.h:109
int lxc_attach_run_command(void *payload)
Run a command in the container.
int(* lxc_attach_exec_t)(void *payload)
Definition: attach_options.h:73
long personality
Definition: attach_options.h:89
Definition: attach_options.h:53
struct lxc_attach_command_t lxc_attach_command_t
Definition: attach_options.h:47
lxc_attach_env_policy_t env_policy
Definition: attach_options.h:112
Definition: attach_options.h:78
Definition: attach_options.h:50
Definition: attach_options.h:46
char * initial_cwd
Definition: attach_options.h:95
int lxc_attach_run_shell(void *payload)
Run a shell command in the container.
Definition: attach_options.h:45
int stdout_fd
Definition: attach_options.h:131