From d4165eedf5b85bfda3ea6b251f69838857e44925 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Wed, 5 Jul 2017 15:38:42 +0200 Subject: support: Add support_chroot_create and support_chroot_free --- support/namespace.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'support/namespace.h') diff --git a/support/namespace.h b/support/namespace.h index e1ccaa1..859c2fd 100644 --- a/support/namespace.h +++ b/support/namespace.h @@ -60,6 +60,38 @@ bool support_in_uts_namespace (void); non-zero exit status. */ void support_isolate_in_subprocess (void (*callback) (void *), void *closure); +/* Describe the setup of a chroot environment, for + support_chroot_create below. */ +struct support_chroot_configuration +{ + /* File contents. The files are not created if the field is + NULL. */ + const char *resolv_conf; +}; + +/* The result of the creation of a chroot. */ +struct support_chroot +{ + /* Path information. All these paths are relative to the parent + chroot. */ + + /* Path to the chroot directory. */ + char *path_chroot; + + /* Path to the /etc/resolv.conf file. */ + char *path_resolv_conf; +}; + +/* Create a chroot environment. The returned data should be freed + using support_chroot_free below. The files will be deleted when + the process exits. This function does not enter the chroot. */ +struct support_chroot *support_chroot_create + (struct support_chroot_configuration); + +/* Deallocate the chroot information created by + support_chroot_create. */ +void support_chroot_free (struct support_chroot *); + __END_DECLS #endif -- cgit v1.1