0

From an interactive user session for a logged in user I can use SessionGetInfo function to obtain the calling process' session ID:

SecuritySessionId sessID;
SessionAttributeBits flags;

if(SessionGetInfo(callerSecuritySession,
                             &sessID,
                             &flags) == errSecSuccess)
{
    printf("session ID=%d", sessID);
}

But how do I enumerate all such session IDs from my launch daemon? Or session IDs for all currently logged in users.

c00000fd
  • 20,994
  • 29
  • 177
  • 400

1 Answers1

1

There's a badly documented utmpx.h set of functions. And for that specific reason you would need to use setutxent, getutxent, endutxent functions. Check a code example here.

ahmd0
  • 16,633
  • 33
  • 137
  • 233