From: Adrian Reber Date: Mon, 9 Mar 2020 12:20:51 +0000 (+0000) Subject: unshare: use '-T' for time namespace instead of '-t' X-Git-Tag: v2.36-rc1~190 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f218fd97847498f505ebb31888261d8cccfcc28b;p=thirdparty%2Futil-linux.git unshare: use '-T' for time namespace instead of '-t' While working on getting time namespace support into 'nsenter' it was not possible to use '-t' to enter a time namespace as '-t' is the short option for '--target'. Fortunately '-T' is still available in 'nsenter' and 'unshare' and therefore let's change 'unshare' to use the same flag for the time namespace as 'nsenter'. Signed-off-by: Adrian Reber --- diff --git a/sys-utils/unshare.1 b/sys-utils/unshare.1 index 4d70f3f290..957f701718 100644 --- a/sys-utils/unshare.1 +++ b/sys-utils/unshare.1 @@ -141,7 +141,7 @@ namespace is created by a bind mount. Unshare the cgroup namespace. If \fIfile\fP is specified then persistent namespace is created by bind mount. .TP -.BR \-t , " \-\-time"[=\fIfile\fP] +.BR \-T , " \-\-time"[=\fIfile\fP] Unshare the time namespace. If \fIfile\fP is specified then a persistent namespace is created by a bind mount. The \fB\-\-monotonic\fP and \fB\-\-boottime\fP options can be used to specify the corresponding diff --git a/sys-utils/unshare.c b/sys-utils/unshare.c index b67e023c7d..8652ebdaf8 100644 --- a/sys-utils/unshare.c +++ b/sys-utils/unshare.c @@ -285,7 +285,7 @@ static void __attribute__((__noreturn__)) usage(void) fputs(_(" -p, --pid[=] unshare pid namespace\n"), out); fputs(_(" -U, --user[=] unshare user namespace\n"), out); fputs(_(" -C, --cgroup[=] unshare cgroup namespace\n"), out); - fputs(_(" -t, --time[=] unshare time namespace\n"), out); + fputs(_(" -T, --time[=] unshare time namespace\n"), out); fputs(USAGE_SEPARATOR, out); fputs(_(" -f, --fork fork before launching \n"), out); fputs(_(" -r, --map-root-user map current user to root (implies --user)\n"), out); @@ -335,7 +335,7 @@ int main(int argc, char *argv[]) { "pid", optional_argument, NULL, 'p' }, { "user", optional_argument, NULL, 'U' }, { "cgroup", optional_argument, NULL, 'C' }, - { "time", optional_argument, NULL, 't' }, + { "time", optional_argument, NULL, 'T' }, { "fork", no_argument, NULL, 'f' }, { "kill-child", optional_argument, NULL, OPT_KILLCHILD }, @@ -379,7 +379,7 @@ int main(int argc, char *argv[]) textdomain(PACKAGE); close_stdout_atexit(); - while ((c = getopt_long(argc, argv, "+fhVmuinpCtUrR:w:S:G:c", longopts, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "+fhVmuinpCTUrR:w:S:G:c", longopts, NULL)) != -1) { switch (c) { case 'f': forkit = 1; @@ -419,7 +419,7 @@ int main(int argc, char *argv[]) if (optarg) set_ns_target(CLONE_NEWCGROUP, optarg); break; - case 't': + case 'T': unshare_flags |= CLONE_NEWTIME; if (optarg) set_ns_target(CLONE_NEWTIME, optarg);