site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=1gVWmlyLEpQD3dQmB43N768SHMIA/X70rqA3kOPNMLs=; b=L9Baw4+9K8qgSfHYjFriXXpN84Dy0IYMPldKPt14lmTHnTdwRzMowK3VbTzCZSVt2t /R1dHQnzFHocJMTVupvARm8E5ACmaIqQi4XBfkOpUvL90SWnjB2jRvMIyoPqQPpNaxJZ 8Y/Y/FiwK3gER9ESIEIO3STqPTZkBucr+xNus= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=Q6KTIDSFJ0BVqF7liWIevENS90RM8cjyoTKcxejh6asODqYOFDa+AwwoMo4sWR/kZ/ S5OYcJXKfcJnpP4YiYysN3MII23kyzo7vw7NBNUggPHiIjmvrH8wTzl08xy7HbOHoHK6 LnT3SIhTz4myG7JvJFFC3bzD0a9lU1U9YCM6Y= On Sat, Aug 21, 2010 at 3:09 AM, Dave Keck <davekeck@gmail.com> wrote:
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 */
Sorry, does this return only the user active in the foreground (visible window)? Or the list of all users (currently active or not) in fast user switching?
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 (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/dreamcat4%40gmail.com
This email sent to dreamcat4@gmail.com
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com