Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2673129ybz; Sun, 19 Apr 2020 07:02:31 -0700 (PDT) X-Google-Smtp-Source: APiQypJDnPHUFEOqKjmFIMF+WIPZ+t1TSF/4fqg11k80teDf/q/1z7kwfu/y5d4el4sL1jxpgFS3 X-Received: by 2002:a50:8e01:: with SMTP id 1mr10194690edw.26.1587304951467; Sun, 19 Apr 2020 07:02:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587304951; cv=none; d=google.com; s=arc-20160816; b=MT1Q/o00jdBeVyXTN4/tUBs5QMKGEKs0eH3/32ectDeA/3xUedtf9K9CkyRxC18KYo mgc+oSqF6/c7kpzGyt++tHs91KcltyW9NgABCmpsERKLwwkJNkA/58VeY+ItYdcx866q l6ZZ0/LRw6LbVng8aqKzDNhAdhedrCWTBobYDnyAwmHicdvYGs2GDpsoFH1lYl5/RB83 iFiu7pIndNmOXasgl4wxHIxHO8xEicaWx2/2qbENDl5uZeaFJgPyoKxiGR481Is76bq7 imKuEzWXv2foUhI5/CK00jrkgp8ixZpsd0/MEkm7uczkbiuLlqeV66xHn4/g0tthPgn7 O0fA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:message-id:references:subject:cc:to:from :date; bh=71MPVu/xguMCxIpwixe+rokOYvK1qRXTqVDZ8Q0a7q0=; b=Ogm5nld6a1VkcLZX2nnTcjubA+LPupnObO53ccUjIRePN7G8V6PQ7X9JXrhphpnqpP AjoAPSFlnJhfa9v51C4tOK3SeusVwAdoJvt2edOY18jwDW+0twAll7eNPdvvq+Fphelk 7MkeXKbqrV3xcc3Hcwm6xdXsYw+coRFebbTI8qItUo4u6VlsH28twzHQDCtX3ZoqIhg0 D6JaEbuYBN++jSDxBQdt2UcMdEZx72DedIsQ59ZFzrw2BG+HQBPk5UiFbiG+Xz38BxKo UWoICnIjwYAlNhs11dSApa9t7vfKCvmCfDzwmHbqK0Jeo15CgAcCj7ZJTfb8FYDtI8CP fDrQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y21si1133607eju.232.2020.04.19.07.02.08; Sun, 19 Apr 2020 07:02:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726335AbgDSN5v (ORCPT + 99 others); Sun, 19 Apr 2020 09:57:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726091AbgDSN5t (ORCPT ); Sun, 19 Apr 2020 09:57:49 -0400 Received: from Galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78002C061A41 for ; Sun, 19 Apr 2020 06:57:49 -0700 (PDT) Received: from p5de0bf0b.dip0.t-ipconnect.de ([93.224.191.11] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jQASB-0002ml-GC; Sun, 19 Apr 2020 15:57:47 +0200 Received: from nanos.tec.linutronix.de (localhost [IPv6:::1]) by nanos.tec.linutronix.de (Postfix) with ESMTP id 11D5BFFBA2; Sun, 19 Apr 2020 15:57:47 +0200 (CEST) Date: Sun, 19 Apr 2020 13:56:43 -0000 From: Thomas Gleixner To: Linus Torvalds Cc: linux-kernel@vger.kernel.org, x86@kernel.org Subject: [GIT pull] timers/urgent for 5.7-rc2 References: <158730459860.31269.9496277256253823777.tglx@nanos.tec.linutronix.de> Message-ID: <158730460342.31269.11473437311616524528.tglx@nanos.tec.linutronix.de> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Content-Disposition: inline X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Linus, please pull the latest timers/urgent branch from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers-urgent-2020-04-19 up to: 94d440d61846: proc, time/namespace: Show clock symbolic names in /proc/pid/timens_offsets An update for the proc interface of time namespaces: Use symbolic names instead of clockid numbers. The usability nuisance of numbers was noticed by Michael when polishing the man page. Thanks, tglx ------------------> Andrei Vagin (1): proc, time/namespace: Show clock symbolic names in /proc/pid/timens_offsets fs/proc/base.c | 14 +++++++++++++- kernel/time/namespace.c | 15 ++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/fs/proc/base.c b/fs/proc/base.c index 6042b646ab27..572898dd16a0 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -1573,6 +1573,7 @@ static ssize_t timens_offsets_write(struct file *file, const char __user *buf, noffsets = 0; for (pos = kbuf; pos; pos = next_line) { struct proc_timens_offset *off = &offsets[noffsets]; + char clock[10]; int err; /* Find the end of line and ensure we don't look past it */ @@ -1584,10 +1585,21 @@ static ssize_t timens_offsets_write(struct file *file, const char __user *buf, next_line = NULL; } - err = sscanf(pos, "%u %lld %lu", &off->clockid, + err = sscanf(pos, "%9s %lld %lu", clock, &off->val.tv_sec, &off->val.tv_nsec); if (err != 3 || off->val.tv_nsec >= NSEC_PER_SEC) goto out; + + clock[sizeof(clock) - 1] = 0; + if (strcmp(clock, "monotonic") == 0 || + strcmp(clock, __stringify(CLOCK_MONOTONIC)) == 0) + off->clockid = CLOCK_MONOTONIC; + else if (strcmp(clock, "boottime") == 0 || + strcmp(clock, __stringify(CLOCK_BOOTTIME)) == 0) + off->clockid = CLOCK_BOOTTIME; + else + goto out; + noffsets++; if (noffsets == ARRAY_SIZE(offsets)) { if (next_line) diff --git a/kernel/time/namespace.c b/kernel/time/namespace.c index 3b30288793fe..53bce347cd50 100644 --- a/kernel/time/namespace.c +++ b/kernel/time/namespace.c @@ -338,7 +338,20 @@ static struct user_namespace *timens_owner(struct ns_common *ns) static void show_offset(struct seq_file *m, int clockid, struct timespec64 *ts) { - seq_printf(m, "%d %lld %ld\n", clockid, ts->tv_sec, ts->tv_nsec); + char *clock; + + switch (clockid) { + case CLOCK_BOOTTIME: + clock = "boottime"; + break; + case CLOCK_MONOTONIC: + clock = "monotonic"; + break; + default: + clock = "unknown"; + break; + } + seq_printf(m, "%-10s %10lld %9ld\n", clock, ts->tv_sec, ts->tv_nsec); } void proc_timens_show_offsets(struct task_struct *p, struct seq_file *m)