LXC
/home/tamuki/work32/lxc-git_20131226/build/src/lxc/attach_options.h
Go to the documentation of this file.
00001 
00025 #ifndef _LXC_ATTACH_OPTIONS_H
00026 #define _LXC_ATTACH_OPTIONS_H
00027 
00028 #include <sys/types.h>
00029 
00030 #ifdef  __cplusplus
00031 extern "C" {
00032 #endif
00033 
00037 typedef enum lxc_attach_env_policy_t {
00038     LXC_ATTACH_KEEP_ENV,   
00039     LXC_ATTACH_CLEAR_ENV   
00040 } lxc_attach_env_policy_t;
00041 
00042 enum {
00043     /* the following are on by default: */
00044     LXC_ATTACH_MOVE_TO_CGROUP        = 0x00000001, 
00045     LXC_ATTACH_DROP_CAPABILITIES     = 0x00000002, 
00046     LXC_ATTACH_SET_PERSONALITY       = 0x00000004, 
00047     LXC_ATTACH_LSM_EXEC              = 0x00000008, 
00048 
00049     /* the following are off by default */
00050     LXC_ATTACH_REMOUNT_PROC_SYS      = 0x00010000, 
00051     LXC_ATTACH_LSM_NOW               = 0x00020000, 
00052 
00053     /* we have 16 bits for things that are on by default
00054      * and 16 bits that are off by default, that should
00055      * be sufficient to keep binary compatibility for
00056      * a while
00057      */
00058     LXC_ATTACH_DEFAULT               = 0x0000FFFF  
00059 };
00060 
00062 #define LXC_ATTACH_LSM (LXC_ATTACH_LSM_EXEC | LXC_ATTACH_LSM_NOW)
00063 
00072 typedef int (*lxc_attach_exec_t)(void* payload);
00073 
00077 typedef struct lxc_attach_options_t {
00079     int attach_flags;
00080 
00082     int namespaces;
00083 
00087     long personality;
00088 
00093     char* initial_cwd;
00094 
00100     uid_t uid;
00101 
00107     gid_t gid;
00108 
00110     lxc_attach_env_policy_t env_policy;
00111 
00113     char** extra_env_vars;
00114 
00118     char** extra_keep_env;
00119 
00128     int stdin_fd; 
00129     int stdout_fd; 
00130     int stderr_fd; 
00132 } lxc_attach_options_t;
00133 
00135 #define LXC_ATTACH_OPTIONS_DEFAULT \
00136     { \
00137         /* .attach_flags = */   LXC_ATTACH_DEFAULT, \
00138         /* .namespaces = */     -1, \
00139         /* .personality = */    -1, \
00140         /* .initial_cwd = */    NULL, \
00141         /* .uid = */            (uid_t)-1, \
00142         /* .gid = */            (gid_t)-1, \
00143         /* .env_policy = */     LXC_ATTACH_KEEP_ENV, \
00144         /* .extra_env_vars = */ NULL, \
00145         /* .extra_keep_env = */ NULL, \
00146         /* .stdin_fd = */       0, 1, 2 \
00147     }
00148 
00152 typedef struct lxc_attach_command_t {
00153     char* program; 
00154     char** argv;   
00155 } lxc_attach_command_t;
00156 
00164 extern int lxc_attach_run_command(void* payload);
00165 
00173 extern int lxc_attach_run_shell(void* payload);
00174 
00175 #ifdef  __cplusplus
00176 }
00177 #endif
00178 
00179 #endif
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines