[systemd-devel] [PATCH] logind: Add a two new variables to the user session tracking file.

Colin Guthrie gmane at colin.guthr.ie
Tue Sep 4 01:13:47 PDT 2012


So I can confirm with all six of these patches applied, that everything
now works as it should.

My only question remaining is the semantic change to the functions below.

'Twas brillig, and Colin Guthrie at 03/09/12 23:57 did gyre and gimble:
> diff --git a/src/login/sd-login.c b/src/login/sd-login.c
> index 1978a05..88dd510 100644
> --- a/src/login/sd-login.c
> +++ b/src/login/sd-login.c
> @@ -259,11 +259,11 @@ static int uid_get_array(uid_t uid, const char *variable, char ***array) {
>  }
>  
>  _public_ int sd_uid_get_sessions(uid_t uid, int require_active, char ***sessions) {
> -        return uid_get_array(uid, require_active ? "ACTIVE_SESSIONS" : "SESSIONS", sessions);
> +        return uid_get_array(uid, require_active == 2 ? "ONLINE_SESSIONS" : (require_active ? "ACTIVE_SESSIONS" : "SESSIONS"), sessions);
>  }
>  
>  _public_ int sd_uid_get_seats(uid_t uid, int require_active, char ***seats) {
> -        return uid_get_array(uid, require_active ? "ACTIVE_SEATS" : "SEATS", seats);
> +        return uid_get_array(uid, require_active == 2 ? "ONLINE_SEATS" : (require_active ? "ACTIVE_SEATS" : "SEATS"), seats);
>  }
>  
>  static int file_of_session(const char *session, char **_p) {

I'd be tempted to make require_active == 0 to search for
ONLINE_SESSIONS= (i.e. a change from the current behaviour where this
would search SESSIONS=). This seems more practically useful and would
prevent the need to fix things in external programs that would rather
see this behaviour (which I'm guess is most of them).

A value of 2 (or -1?) could still be used to search for the SESSONS= value.

WDYT?

Col




-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/



More information about the systemd-devel mailing list