#include <pakfire/pakfire.h>
+int pakfire_mount_change_propagation(struct pakfire* pakfire, int propagation, const char* path);
+
int pakfire_mount_make_mounpoint(struct pakfire* pakfire, const char* path);
int pakfire_bind(struct pakfire* pakfire, const char* src, const char* dst, int flags);
const char* root = pakfire_get_path(jail->pakfire);
const char* arch = pakfire_get_arch(jail->pakfire);
+ // Change mount propagation to slave to receive anything from the parent namespace
+ r = pakfire_mount_change_propagation(jail->pakfire, MS_SLAVE, "/");
+ if (r)
+ return r;
+
// Make root a mountpoint in the new mount namespace
r = pakfire_mount_make_mounpoint(jail->pakfire, root);
if (r)
return r;
+ // Change mount propagation to private
+ r = pakfire_mount_change_propagation(jail->pakfire, MS_PRIVATE, root);
+ if (r)
+ return r;
+
// Change root (unless root is /)
if (!pakfire_on_root(jail->pakfire)) {
// Mount everything
{ NULL },
};
+int pakfire_mount_change_propagation(struct pakfire* pakfire, int propagation, const char* path) {
+ DEBUG(pakfire, "Changing mount propagation on %s\n", path);
+
+ int r = mount(NULL, path, NULL, propagation|MS_REC, NULL);
+ if (r)
+ ERROR(pakfire, "Failed to change mount propagation on %s: %m\n", path);
+
+ return r;
+}
+
static int pakfire_mount_is_mountpoint(struct pakfire* pakfire, const char* path) {
// XXX THIS STILL NEEDS TO BE IMPLEMENTED
return 1;