added unshare_umount example
This commit is contained in:
parent
df522e679f
commit
7c30e3f974
15
examples/unshare_umount.c
Normal file
15
examples/unshare_umount.c
Normal 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");
|
||||||
|
}
|
Reference in New Issue
Block a user