util: add ability to execute programs in a specified userns

It's required for dumping tmpfs, where we use tar to save content.
If we need to execute tar from a proper userns to get right uid-s and
gid-s for files.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Andrey Vagin 2015-07-20 12:34:15 +03:00 committed by Pavel Emelyanov
parent 9a8ca1cfff
commit 011231af3b
2 changed files with 18 additions and 0 deletions

View file

@ -170,6 +170,8 @@ extern void *shmalloc(size_t bytes);
extern void shfree_last(void *ptr);
extern int cr_system(int in, int out, int err, char *cmd, char *const argv[]);
extern int cr_system_userns(int in, int out, int err, char *cmd,
char *const argv[], int userns_pid);
extern int cr_daemon(int nochdir, int noclose, int *keep_fd, int close_fd);
extern int is_root_user(void);