Re: Current active login session
Re: Current active login session
- Subject: Re: Current active login session
- From: Dave Keck <email@hidden>
- Date: Fri, 20 Aug 2010 22:09:22 -0400
I use the utmpx APIs to determine the existing console users from a
daemon process; see the UTXplorer example (which I believe Quinn
wrote?).
==========
#import <utmpx.h>
- (NSSet *)userNamesForExistingUserSessions
{
struct utmpx *currentEntry = nil;
NSMutableSet *result = nil;
result = [NSMutableSet set];
setutxent();
while (currentEntry = getutxent())
{
/* Verify that we have a user and that currentEntry's session is a GUI ('console') session */
if (currentEntry->ut_type == USER_PROCESS && !strcmp(currentEntry->ut_line, "console"))
[result addObject: [NSString stringWithUTF8String: currentEntry->ut_user]];
}
endutxent();
return result;
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden