Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'timers-urgent-2020-04-19' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull time namespace fix from Thomas Gleixner:
"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"

* tag 'timers-urgent-2020-04-19' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
proc, time/namespace: Show clock symbolic names in /proc/pid/timens_offsets

+27 -2
+13 -1
fs/proc/base.c
··· 1573 1573 noffsets = 0; 1574 1574 for (pos = kbuf; pos; pos = next_line) { 1575 1575 struct proc_timens_offset *off = &offsets[noffsets]; 1576 + char clock[10]; 1576 1577 int err; 1577 1578 1578 1579 /* Find the end of line and ensure we don't look past it */ ··· 1585 1584 next_line = NULL; 1586 1585 } 1587 1586 1588 - err = sscanf(pos, "%u %lld %lu", &off->clockid, 1587 + err = sscanf(pos, "%9s %lld %lu", clock, 1589 1588 &off->val.tv_sec, &off->val.tv_nsec); 1590 1589 if (err != 3 || off->val.tv_nsec >= NSEC_PER_SEC) 1591 1590 goto out; 1591 + 1592 + clock[sizeof(clock) - 1] = 0; 1593 + if (strcmp(clock, "monotonic") == 0 || 1594 + strcmp(clock, __stringify(CLOCK_MONOTONIC)) == 0) 1595 + off->clockid = CLOCK_MONOTONIC; 1596 + else if (strcmp(clock, "boottime") == 0 || 1597 + strcmp(clock, __stringify(CLOCK_BOOTTIME)) == 0) 1598 + off->clockid = CLOCK_BOOTTIME; 1599 + else 1600 + goto out; 1601 + 1592 1602 noffsets++; 1593 1603 if (noffsets == ARRAY_SIZE(offsets)) { 1594 1604 if (next_line)
+14 -1
kernel/time/namespace.c
··· 338 338 339 339 static void show_offset(struct seq_file *m, int clockid, struct timespec64 *ts) 340 340 { 341 - seq_printf(m, "%d %lld %ld\n", clockid, ts->tv_sec, ts->tv_nsec); 341 + char *clock; 342 + 343 + switch (clockid) { 344 + case CLOCK_BOOTTIME: 345 + clock = "boottime"; 346 + break; 347 + case CLOCK_MONOTONIC: 348 + clock = "monotonic"; 349 + break; 350 + default: 351 + clock = "unknown"; 352 + break; 353 + } 354 + seq_printf(m, "%-10s %10lld %9ld\n", clock, ts->tv_sec, ts->tv_nsec); 342 355 } 343 356 344 357 void proc_timens_show_offsets(struct task_struct *p, struct seq_file *m)