1 /* 2 * Copyright (C) Igor Sysoev 3 * Copyright (C) NGINX, Inc. 4 */ 5 6 #ifndef _NXT_CLONE_H_INCLUDED_ 7 #define _NXT_CLONE_H_INCLUDED_ 8 9 10 #if (NXT_HAVE_CLONE_NEWUSER) 11 12 typedef int64_t nxt_cred_t; 13 14 typedef struct { 15 nxt_cred_t container; 16 nxt_cred_t host; 17 nxt_cred_t size; 18 } nxt_clone_map_entry_t; 19 20 typedef struct { 21 nxt_uint_t size; 22 nxt_clone_map_entry_t *map; 23 } nxt_clone_credential_map_t; 24 25 #endif 26 27 typedef struct { 28 nxt_int_t flags; 29 30 #if (NXT_HAVE_CLONE_NEWUSER) 31 nxt_clone_credential_map_t uidmap; 32 nxt_clone_credential_map_t gidmap; 33 #endif 34 35 } nxt_clone_t; 36 37 38 #define nxt_is_clone_flag_set(flags, test) \ 39 ((flags & CLONE_##test) == CLONE_##test) 40 41 42 #if (NXT_HAVE_CLONE_NEWUSER) 43 44 NXT_EXPORT nxt_int_t nxt_clone_credential_map(nxt_task_t *task, pid_t pid, 45 nxt_credential_t *creds, nxt_clone_t *clone); 46 NXT_EXPORT nxt_int_t nxt_clone_vldt_credential_uidmap(nxt_task_t *task, 47 nxt_clone_credential_map_t *map, nxt_credential_t *creds); 48 NXT_EXPORT nxt_int_t nxt_clone_vldt_credential_gidmap(nxt_task_t *task, 49 nxt_clone_credential_map_t *map, nxt_credential_t *creds); 50 51 #endif 52 53 54 #endif /* _NXT_CLONE_H_INCLUDED_ */ 55