added unshare_umount example

This commit is contained in:
Jake Hillion 2022-04-15 21:55:28 +01:00
parent df522e679f
commit 7c30e3f974

15
examples/unshare_umount.c Normal file
View File

@ -0,0 +1,15 @@
#define _GNU_SOURCE
#include <sched.h>
#include <sys/mount.h>
#include <sys/types.h>
#include <dirent.h>
#include <stdio.h>
int main() {
if (unshare(CLONE_NEWNS))
perror("unshare");
if (mount("none", "/", NULL, MS_REC|MS_PRIVATE, NULL))
perror("mount");
if (umount("/"))
perror("umount");
}