github.com/schwarzm/garden-linux@v0.0.0-20150507151835-33bca2147c47/old/linux_backend/src/wsh/msg.h (about)

     1  #ifndef MSG_H
     2  #define MSG_H 1
     3  
     4  #define MSG_VERSION 1
     5  
     6  #include <sys/time.h>
     7  #include <sys/resource.h>
     8  
     9  #include "pwd.h"
    10  
    11  typedef struct msg__array_s msg__array_t;
    12  typedef struct msg__rlimit_s msg__rlimit_t;
    13  typedef struct msg__user_s msg__user_t;
    14  typedef struct msg__dir_s msg__dir_t;
    15  typedef struct msg_request_s msg_request_t;
    16  typedef struct msg_response_s msg_response_t;
    17  
    18  struct msg__array_s {
    19    int count;
    20    char buf[8 * 1024];
    21  };
    22  
    23  struct msg__rlimit_s {
    24    int count;
    25    struct {
    26      int id;
    27      struct rlimit rlim;
    28    } rlim[RLIMIT_NLIMITS];
    29  };
    30  
    31  struct msg__user_s {
    32    char name[32];
    33  };
    34  
    35  struct msg__dir_s {
    36    char path[1024];
    37  };
    38  
    39  struct msg_request_s {
    40    int version;
    41    int tty;
    42    msg__array_t arg;
    43    msg__array_t env;
    44    msg__rlimit_t rlim;
    45    msg__user_t user;
    46    msg__dir_t dir;
    47  };
    48  
    49  struct msg_response_s {
    50    int version;
    51  };
    52  
    53  int msg_array_import(msg__array_t * a, int count, const char ** ptr);
    54  const char ** msg_array_export(msg__array_t * a);
    55  
    56  int msg_rlimit_import(msg__rlimit_t *);
    57  int msg_rlimit_export(msg__rlimit_t *);
    58  
    59  int msg_user_import(msg__user_t *u, const char *name);
    60  int msg_user_export(msg__user_t *u, struct passwd *pw);
    61  
    62  int msg_dir_import(msg__dir_t *d, const char *dir);
    63  
    64  void msg_request_init(msg_request_t *req);
    65  void msg_response_init(msg_response_t *res);
    66  
    67  #endif