aboutsummaryrefslogtreecommitdiff
path: root/toys/other/unshare.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2012-11-13 17:14:08 -0600
committerRob Landley <rob@landley.net>2012-11-13 17:14:08 -0600
commit7aa651a6a4496d848f86de9b1e6b3a003256a01f (patch)
tree6995fb4b7cc2e90a6706b0239ebaf95d9dbab530 /toys/other/unshare.c
parent571b0706cce45716126776d0ad0f6ac65f4586e3 (diff)
downloadtoybox-7aa651a6a4496d848f86de9b1e6b3a003256a01f.tar.gz
Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
The actual code should be the same afterward, this is just cosmetic refactoring.
Diffstat (limited to 'toys/other/unshare.c')
-rw-r--r--toys/other/unshare.c46
1 files changed, 21 insertions, 25 deletions
diff --git a/toys/other/unshare.c b/toys/other/unshare.c
index bdee66bc..9a938186 100644
--- a/toys/other/unshare.c
+++ b/toys/other/unshare.c
@@ -1,26 +1,24 @@
-/* vi: set sw=4 ts=4:
- *
- * unshare.c - run command in new context
+/* unshare.c - run command in new context
*
* Copyright 2011 Rob Landley <rob@landley.net>
USE_UNSHARE(NEWTOY(unshare, "<1^nium", TOYFLAG_USR|TOYFLAG_BIN))
config UNSHARE
- bool "unshare"
- default y
- depends on TOYBOX_CONTAINER
- help
- usage: unshare [-muin] COMMAND...
-
- Create new namespace(s) for this process and its children, so some
- attribute is not shared with the parent process. This is part of
- Linux Containers. Each process can have its own:
-
- -m Mount/unmount tree
- -u Host and domain names
- -i SysV IPC (message queues, semaphores, shared memory)
- -n Network address, sockets, routing, iptables
+ bool "unshare"
+ default y
+ depends on TOYBOX_CONTAINER
+ help
+ usage: unshare [-muin] COMMAND...
+
+ Create new namespace(s) for this process and its children, so some
+ attribute is not shared with the parent process. This is part of
+ Linux Containers. Each process can have its own:
+
+ -m Mount/unmount tree
+ -u Host and domain names
+ -i SysV IPC (message queues, semaphores, shared memory)
+ -n Network address, sockets, routing, iptables
*/
#include "toys.h"
@@ -29,15 +27,13 @@ extern int unshare (int __flags);
void unshare_main(void)
{
- unsigned flags[]={CLONE_NEWNS, CLONE_NEWUTS, CLONE_NEWIPC, CLONE_NEWNET,0};
- unsigned f=0;
- int i;
+ unsigned flags[]={CLONE_NEWNS, CLONE_NEWUTS, CLONE_NEWIPC, CLONE_NEWNET, 0};
+ unsigned f=0;
+ int i;
- for (i=0; flags[i]; i++)
- if (toys.optflags & (1<<i))
- f |= flags[i];
+ for (i=0; flags[i]; i++) if (toys.optflags & (1<<i)) f |= flags[i];
- if(unshare(f)) perror_exit("failed");
+ if(unshare(f)) perror_exit("failed");
- xexec(toys.optargs);
+ xexec(toys.optargs);
}