Advertisement
Guest User

simple unshared mount namespace

a guest
Nov 4th, 2014
861
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.36 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <sched.h>
  4. #include <linux/sched.h>
  5. #include <unistd.h>
  6.  
  7. int main() {
  8.   int ret;
  9.   if (ret = unshare(CLONE_NEWNS) != 0) {
  10.     fprintf(stderr, "ERROR: unshare returned: %s\n", strerror(ret));
  11.     _exit(1);
  12.   }
  13.   printf("unshared into new mount namespace\n");
  14.   printf("sleeping for 1000\n");
  15.   sleep(1000);
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement