Skip to content

Commit

Permalink
ns: add primitive support for time namespaces
Browse files Browse the repository at this point in the history
We don't set time slices for now, but we at least add support for
unsharing the time namespace.
  • Loading branch information
Snaipe committed May 13, 2020
1 parent fa1eb1f commit dbd5661
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions bst.1.scd
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Users of bst may choose to opt-out of some of the isolation.
- *mount*
- *network* (since Linux 2.6.24)
- *pid* (since Linux 3.8)
- *time* (since Linux 5.6)
- *uts* (since Linux 2.6.19)
- *user* (since Linux 3.8)

Expand Down
7 changes: 6 additions & 1 deletion enter.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ enum {
BST_CLONE_NEWPID = 0x20000000,
BST_CLONE_NEWUSER = 0x10000000,
BST_CLONE_NEWIPC = 0x08000000,
BST_CLONE_NEWTIME = 0x00000080,

ALL_NAMESPACES = 0
| BST_CLONE_NEWCGROUP
Expand All @@ -53,7 +54,9 @@ enum {
| BST_CLONE_NEWNET
| BST_CLONE_NEWPID
| BST_CLONE_NEWUSER
| BST_CLONE_NEWUTS,
| BST_CLONE_NEWUTS
| BST_CLONE_NEWTIME
,
};

static int opts_to_unshareflags(const struct entry_settings *opts)
Expand All @@ -64,6 +67,7 @@ static int opts_to_unshareflags(const struct entry_settings *opts)
{ "mount", BST_CLONE_NEWNS },
{ "network", BST_CLONE_NEWNET },
{ "pid", BST_CLONE_NEWPID },
{ "time", BST_CLONE_NEWTIME },
{ "user", BST_CLONE_NEWUSER },
{ "uts", BST_CLONE_NEWUTS },
{ "all", ALL_NAMESPACES },
Expand Down Expand Up @@ -125,6 +129,7 @@ int enter(const struct entry_settings *opts)
BST_CLONE_NEWNET,
BST_CLONE_NEWIPC,
BST_CLONE_NEWCGROUP,
BST_CLONE_NEWTIME,
0,
};

Expand Down

0 comments on commit dbd5661

Please sign in to comment.