Project

General

Profile

Actions

Bug #971

open

w(1) is confused by screen

Added by River Tarnell over 10 years ago. Updated over 10 years ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
cmd - userland programs
Start date:
2011-04-28
Due date:
% Done:

0%

Estimated time:
Difficulty:
Tags:
Gerrit CR:

Description

Correct output from 'w' when using screen in non-login mode:

login% w
  2:41pm  up 23 day(s), 15:11,  3 users,  load average: 0.38, 0.32, 0.33
User     tty           login@  idle   JCPU   PCPU  what
river    pts/8        Wed11am  2:00     11      6  -zsh
river    pts/9        Wed 2pm                      -zsh
river    pts/11       Wed11am            2      2  screen -rd

When switching one screen window to logged in mode (:login on), it continues to print 3 users, although there are now 4:

login% w
  2:41pm  up 23 day(s), 15:11,  3 users,  load average: 0.34, 0.31, 0.33
User     tty           login@  idle   JCPU   PCPU  what
river    pts/8        Wed11am  2:00     11      6  -zsh
river    pts/9        Wed 2pm                      -zsh
river    pts/11       Wed11am            2      2  screen -rd
river    pts/12        2:41pm         1:52   1:52  epic5 felicity__ irc.freenode.ne

Output from 'who' for comparison:

river      pts/8        Apr 27 11:47    (ilythia.tcx.org.uk)
river      pts/9        Apr 27 14:05    (ilythia.tcx.org.uk)
river      pts/11       Apr 27 11:40    (ilythia.tcx.org.uk)
river      pts/12       Apr 28 14:41    (:pts/11:S.0)
Actions #1

Updated by Albert Lee over 10 years ago

Quote attributed to Bryan: "Unbelievably, for utmp entries which correspond to running processes (thatis, utmp entries of type USER_PROCESS), the e_exit field is zero ifthe entry was created by superuser, or NONROOT_USR otherwise (I'mnot making this up). NONROOT_USR is #define'd to be 2 (despite thefact that there is no 1; Moonbeam was probably just trying to flip the bird to The Man). Interestingly, there is no 3, or anything else for thatmatter. There is, however, a macro to get at this value: nonuser() (probably added by Moonbeam while in Rehab in the Nancy Reganite mid '80s).The macro is used virtually nowhere, with one notable exception:(you guessed it) who(1)."

Actions #2

Updated by Albert Lee over 10 years ago

  • Category set to cmd - userland programs
  • Priority changed from Normal to Low
Actions #3

Updated by River Tarnell over 10 years ago

In short, the first line of w's output counts only 'root' processes, while the listing displays processes from all users. This seems confusing and not very useful: either something is a user, or it's not.

Actions

Also available in: Atom PDF