summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_clone.h
blob: 6cea1bd7ecb837da8446755de3e4b9ecd9eecd57 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
 * Copyright (C) Igor Sysoev
 * Copyright (C) NGINX, Inc.
 */

#ifndef _NXT_CLONE_H_INCLUDED_
#define _NXT_CLONE_H_INCLUDED_


#if (NXT_HAVE_CLONE_NEWUSER)

typedef struct {
    nxt_int_t                   container;
    nxt_int_t                   host;
    nxt_int_t                   size;
} nxt_clone_map_entry_t;

typedef struct {
    nxt_uint_t                  size;
    nxt_clone_map_entry_t       *map;
} nxt_clone_credential_map_t;

#endif

typedef struct {
    nxt_int_t                   flags;

#if (NXT_HAVE_CLONE_NEWUSER)
    nxt_clone_credential_map_t  uidmap;
    nxt_clone_credential_map_t  gidmap;
#endif

} nxt_clone_t;


#define nxt_is_clone_flag_set(flags, test)                                    \
    ((flags & CLONE_##test) == CLONE_##test)


#if (NXT_HAVE_CLONE_NEWUSER)

NXT_EXPORT nxt_int_t nxt_clone_credential_map(nxt_task_t *task, pid_t pid,
    nxt_credential_t *creds, nxt_clone_t *clone);
NXT_EXPORT nxt_int_t nxt_clone_vldt_credential_uidmap(nxt_task_t *task,
    nxt_clone_credential_map_t *map, nxt_credential_t *creds);
NXT_EXPORT nxt_int_t nxt_clone_vldt_credential_gidmap(nxt_task_t *task,
    nxt_clone_credential_map_t *map, nxt_credential_t *creds);

#endif


#endif /* _NXT_CLONE_H_INCLUDED_ */