Re: [gdm-list] Request for info: number of logged users




Rui:

I think a better solution to this problem would be to pop-up a dialog asking the user if they really want to shutdown/reboot the machine.
This is what is done on Windows if you are logged in as multiple users
and select Shutdown, for example.

It might be a bit confusing if the menu choices seem to appear and
disappear based on whether someone is logged in via XDMCP or such.

I'm interested in creating a patch for gdm to implement the following behaviour:
only when there are no logged in users into a machine (that gdm knows about...)
should the menu options for halting, rebooting and putting to sleep a machine be
available. Would this be interesting for gdm upstream?

Anyway, looking through (a little part) of the code I couldn't find a way to
know how many users does the gdm daemon think that are logged in. We could hack
this parsing the system's utmp file but that doesn't seem a clean option. So, is
there currently a way of knowing how many users are logged in?

I think you aren't so much concerned in the number of users, but the
number of displays that GDM is currently managing.

You can tell how many displays are connected by looping over the "displays" variable in the daemon. Note the functionality of how
GDM_SUP_ATTACHED_SERVERS is implemented in the gdm_handle_user_message
function.  This gdmflexiserver command does what you want.

We also should keep in mind what kind of users are we talking about. We can
distinguish between at least 3 kinds:

1. users that logged in such a way that gdm wasn't involved (this would require
   reading utmp I guess)
>
2. users that logged using gdm but remotely.
3. users that logged using gdm locally.

Dealing with just cases 2 and 3 would be OK.

You probably also care about flexible servers started by gdmflexiserver
and running on different VT's, or perhaps you are considering these the
same as #3.

GDM_SUP_ALL_SERVERS tells you all servers, and GDM_SUP_ATTACHED_SERVERS tells you #3. So you can figure out the remote users

Any pointers into relevant parts of the code would be highly apreciated since
gdm seems to be quite a beast and I don't have the time currently to get very
intimate with it.

Brian



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]