Re: w idle time issue

"Dr. Werner Fink" <[email protected]> Fri, 6 Dec 2024 11:10:19 +0100
Newsgroups gmane.linux.procps.devel
Message-ID <[email protected]>
--GKL2gm0k7bmp70Uu
Content-Type: text/plain; protected-headers=v1; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Date: Fri, 6 Dec 2024 11:10:19 +0100
From: "Dr. Werner Fink" <[email protected]>
To: [email protected]
Subject: Re: [procps] w idle time issue

On 2024/12/04 21:38:25 +1100, Craig Small wrote:
> Hello All,
>   I've recently become aware that w is not reporting the idle time of use=
rs
> on X or Wayland sessions correctly. Looking back at it, it looks like this
> has been the way it has been since the days of kernel 4.19 at least.
>=20
> Idle time is found by stat()ing the relevant /dev/ttyX file and looking at
> the access time of the file. When a user is active, this time increments,
> when idle it no longer updates.
>=20
> For ssh and VTY sessions, this still occurs and the idle times track the
> actual active user times (within 8 seconds). So if a ssh user is idle for=
 5
> minutes, the atime for the file will be five minutes ago and w will say
> they are idle for 5 minutes.
>=20
> For X/Wayland this is not the case. The atime for the file is roughly when
> the X/Wayland server starts; probably when the uid of the file changes.
>=20
> So, two things:
> Has anyone got a system out there where the idle time is correct for their
> X/Wayland users and if so what is it?
> Anyone got any idea how to get the idle time for these types of users?

Here the idle time of the session manager is seen, e.g. gnome-session-binary

Some more ... with the switch to systemd logind the open terminals are
also not visible anymore ... only a simply `ls -l /dev/pts/[0-9]*` will
show those (including those caused by an ssh login) ... with the help
of lsof also user(s) can be seen

Werner

--=20
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr

--GKL2gm0k7bmp70Uu
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQJgBAABCABKFiEEGwa/WjgpkPvLonW+UOkNVR3Bay4FAmdSzYssFIAAAAAAFQAO
cGthLWFkZHJlc3NAZ251cGcub3Jnd2VybmVyQHN1c2UuZGUACgkQUOkNVR3Bay7m
/A/+KSA+msOloFheVN0AG/76bJJ2I3EKHrxw4N79EJksUj8VEGNm88ud7vcvh6s0
4kggpUpmH6wwkKzxjNwY1/tAkkZBylENmI0jYx11Jk2mq2Jq1ls7DmlPBUND+9c1
xKOmnJspZwhYrA4QVpi/Ri54qVrQZmEAyy98cGNh3jFVuiBNptp7OZLIszpcS/dS
EhGQhFm3t3H3FJPeFUt9/Jvv30DkM2/xfcNpQ4cfa7PNzMva72sbWw8Tbv1WAiWb
Ju1B9Ui5FCUs9zw1Fw/9pustlfktUveGJ71WVbyBVN8YVw0c/7poDYQHssi5fP18
Bwuf150RnT3ZaNIJz2XJTmzfTImDZ8rJ9CmU303adUWlQJOIwu/DPB55gLexoz8R
pSfMe3cS6KE8+BSd2UT217+zKQP1tGD5t/bZviFbwL3j2v+C5MyzIvWM7YgelNp4
lNSY1RO6YTl7L056oc2fPubswstabtXsN0NnCZW+C6CdLiPpDKlgfipGfxt/Cl7w
B/wNvX8Os/KcbGnrJBca0wBSF2HbbRfa99EGPAsC1HvNW1Gndij4WFz0gTq3rm6/
kAIDahF+l+hjcaG0c7RsCj11uBXtW8gvW+SDVSFTVPiDbFFXl1/PYxvHxC0ZtjUJ
5jtYFpDd1/KB/t5Vb0uHnHkZyVUJwMdilmHbJa7A1MIZ/6E=
=MM+D
-----END PGP SIGNATURE-----

--GKL2gm0k7bmp70Uu--