xref: /unit/src/nxt_clone.h (revision 1595:d1884e46cf71)
11182St.nateldemoura@f5.com /*
21182St.nateldemoura@f5.com  * Copyright (C) Igor Sysoev
31182St.nateldemoura@f5.com  * Copyright (C) NGINX, Inc.
41182St.nateldemoura@f5.com  */
51182St.nateldemoura@f5.com 
6*1488St.nateldemoura@f5.com #ifndef _NXT_CLONE_H_INCLUDED_
7*1488St.nateldemoura@f5.com #define _NXT_CLONE_H_INCLUDED_
81182St.nateldemoura@f5.com 
91182St.nateldemoura@f5.com 
101306St.nateldemoura@f5.com #if (NXT_HAVE_CLONE_NEWUSER)
111306St.nateldemoura@f5.com 
121306St.nateldemoura@f5.com typedef struct {
131306St.nateldemoura@f5.com     nxt_int_t                   container;
141306St.nateldemoura@f5.com     nxt_int_t                   host;
151306St.nateldemoura@f5.com     nxt_int_t                   size;
161306St.nateldemoura@f5.com } nxt_clone_map_entry_t;
171306St.nateldemoura@f5.com 
181306St.nateldemoura@f5.com typedef struct {
191306St.nateldemoura@f5.com     nxt_uint_t                  size;
201306St.nateldemoura@f5.com     nxt_clone_map_entry_t       *map;
211306St.nateldemoura@f5.com } nxt_clone_credential_map_t;
221306St.nateldemoura@f5.com 
231306St.nateldemoura@f5.com #endif
241306St.nateldemoura@f5.com 
251306St.nateldemoura@f5.com typedef struct {
261306St.nateldemoura@f5.com     nxt_int_t                   flags;
271182St.nateldemoura@f5.com 
281182St.nateldemoura@f5.com #if (NXT_HAVE_CLONE_NEWUSER)
291306St.nateldemoura@f5.com     nxt_clone_credential_map_t  uidmap;
301306St.nateldemoura@f5.com     nxt_clone_credential_map_t  gidmap;
311306St.nateldemoura@f5.com #endif
321306St.nateldemoura@f5.com 
331306St.nateldemoura@f5.com } nxt_clone_t;
341306St.nateldemoura@f5.com 
351306St.nateldemoura@f5.com 
361306St.nateldemoura@f5.com pid_t nxt_clone(nxt_int_t flags);
371306St.nateldemoura@f5.com 
381306St.nateldemoura@f5.com 
39*1488St.nateldemoura@f5.com #define nxt_is_clone_flag_set(flags, test)                                    \
40*1488St.nateldemoura@f5.com     ((flags & CLONE_##test) == CLONE_##test)
411306St.nateldemoura@f5.com 
42*1488St.nateldemoura@f5.com 
43*1488St.nateldemoura@f5.com #if (NXT_HAVE_CLONE_NEWUSER)
441306St.nateldemoura@f5.com 
451306St.nateldemoura@f5.com NXT_EXPORT nxt_int_t nxt_clone_credential_map(nxt_task_t *task, pid_t pid,
461306St.nateldemoura@f5.com     nxt_credential_t *creds, nxt_clone_t *clone);
471306St.nateldemoura@f5.com NXT_EXPORT nxt_int_t nxt_clone_vldt_credential_uidmap(nxt_task_t *task,
481306St.nateldemoura@f5.com     nxt_clone_credential_map_t *map, nxt_credential_t *creds);
491306St.nateldemoura@f5.com NXT_EXPORT nxt_int_t nxt_clone_vldt_credential_gidmap(nxt_task_t *task,
501306St.nateldemoura@f5.com     nxt_clone_credential_map_t *map, nxt_credential_t *creds);
511306St.nateldemoura@f5.com 
521182St.nateldemoura@f5.com #endif
531182St.nateldemoura@f5.com 
54*1488St.nateldemoura@f5.com 
55*1488St.nateldemoura@f5.com #endif /* _NXT_CLONE_H_INCLUDED_ */
56