Project

General

Profile

Actions

Bug #3255

closed

atime on pty devices increments faster than system time, even if idle

Added by dancrossnyc almost 4 years ago. Updated almost 4 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Kernel
Target version:
Start date:
01/10/2021
Due date:
% Done:

0%

Estimated time:

Description

The 'atime' on a PTY device seems to increment monotonically at a rate faster than than the system clock if the device is idle.

I noticed this because the output of commands that show idle time (w, finger, etc) always shows the associated login as active, even when it isn't.

For example, if I am logged in on pts/0 and pts/1, and deliberately leave pts/1 idle for some time, then run `date; stat /dev/pts/1; date` I observe the following output:

Sun Jan 10 20:36:31 UTC 2021
1114963967 1435 crw--w---- 1 cross tty 8449 0 "Jan 10 20:59:23 2021" "Jan 10 20:13:39 2021" "Jan 10 13:55:47 2021" 4096 0 0 /dev/pts/1
Sun Jan 10 20:36:31 UTC 2021

Curiously, using the device resets `atime`. Here, I switch to pts/1 and run something (e.g., 'echo foo' or 'ls') and probe again:

Sun Jan 10 20:37:57 UTC 2021
1114963967 1435 crw--w---- 1 cross tty 8449 0 "Jan 10 20:38:00 2021" "Jan 10 20:37:54 2021" "Jan 10 13:55:47 2021" 4096 0 0 /dev/pts/1
Sun Jan 10 20:37:57 UTC 2021

(the one second lag is due to me switching windows and recalling the command, but the atime was reset to the time I ran some command.)

uname output:

DragonFly my.host.org 5.8-RELEASE DragonFly v5.8.3-RELEASE #10: Thu Sep 24 19:19:45 EDT 2020 :/usr/obj/home/justin/release/5_8/sys/X86_64_GENERIC x86_64

I've tried this with several shells and mechanisms for logging in: the behavior seems invariant regardless of using e.g., ash, bash, zsh, sshd or even the venerable telnetd.

Actions #1

Updated by dancrossnyc almost 4 years ago

Sorry, in case it wasn't clear, I should have mentioned in the original report that I run the `date; stat /dev/pts/1; date` commands from my session logged in on /dev/pts/0.

Actions #2

Updated by dillon almost 4 years ago

  • Status changed from New to Resolved
  • Assignee set to dillon

Fixed. The devfs code uses a quick shortcut to avoid having to obtain VFS timestamps on every read() and write() to a device. This shortcut code had reversed a calculation, causing the times to appear to increment on their own with no activity.

Actions

Also available in: Atom PDF