github.com/apptainer/singularity@v3.1.1+incompatible/cmd/starter/c/include/starter.h (about)

     1  /*
     2    Copyright (c) 2018-2019, Sylabs, Inc. All rights reserved.
     3  
     4    This software is licensed under a 3-clause BSD license.  Please
     5    consult LICENSE.md file distributed with the sources of this project regarding
     6    your rights to use or distribute this software.
     7  */
     8  
     9  #ifndef _SINGULARITY_STARTER_H
    10  #define _SINGULARITY_STARTER_H
    11  
    12  #include <limits.h>
    13  #include <sys/user.h>
    14  
    15  #define fatalf(b...)     singularity_message(ERROR, b); \
    16                           exit(1)
    17  #define debugf(b...)     singularity_message(DEBUG, b)
    18  #define verbosef(b...)   singularity_message(VERBOSE, b)
    19  #define warningf(b...)   singularity_message(WARNING, b)
    20  #define errorf(b...)     singularity_message(ERROR, b)
    21  
    22  #define MAX_JSON_SIZE       128*1024
    23  #define MAX_MAP_SIZE        4096
    24  #define MAX_NS_PATH_SIZE    PATH_MAX
    25  #define MAX_GID             32
    26  
    27  struct fdlist {
    28      int *fds;
    29      unsigned int num;
    30  };
    31  
    32  struct capabilities {
    33      unsigned long long permitted;
    34      unsigned long long effective;
    35      unsigned long long inheritable;
    36      unsigned long long bounding;
    37      unsigned long long ambient;
    38  };
    39  
    40  struct namespace {
    41      unsigned int flags;
    42      char network[MAX_NS_PATH_SIZE];
    43      char mount[MAX_NS_PATH_SIZE];
    44      char user[MAX_NS_PATH_SIZE];
    45      char ipc[MAX_NS_PATH_SIZE];
    46      char uts[MAX_NS_PATH_SIZE];
    47      char cgroup[MAX_NS_PATH_SIZE];
    48      char pid[MAX_NS_PATH_SIZE];
    49  };
    50  
    51  struct container {
    52      pid_t pid;
    53  
    54      unsigned char isSuid;
    55      unsigned char noNewPrivs;
    56  
    57      char uidMap[MAX_MAP_SIZE];
    58      char gidMap[MAX_MAP_SIZE];
    59  
    60      uid_t targetUID;
    61      gid_t targetGID[MAX_GID];
    62      int numGID;
    63  
    64      unsigned char isInstance;
    65      unsigned long mountPropagation;
    66      unsigned char sharedMount;
    67      unsigned char joinMount;
    68      unsigned char bringLoopbackInterface;
    69  };
    70  
    71  struct json {
    72      char config[MAX_JSON_SIZE];
    73      size_t size;
    74  };
    75  
    76  struct cConfig {
    77      struct capabilities capabilities;
    78      struct namespace namespace;
    79      struct container container;
    80      struct json json;
    81  };
    82  
    83  #endif /* _SINGULARITY_STARTER_H */