Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Current active login session
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Current active login session



On Sat, Aug 21, 2010 at 3:09 AM, Dave Keck <email@hidden> 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      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
 _______________________________________________
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

References: 
 >Current active login session (From: Antoine Missout <email@hidden>)
 >Re: Current active login session (From: "Quinn \"The Eskimo!\"" <email@hidden>)
 >Re: Current active login session (From: Antoine Missout <email@hidden>)
 >Re: Current active login session (From: "Quinn \"The Eskimo!\"" <email@hidden>)
 >Re: Current active login session (From: Antoine Missout <email@hidden>)
 >Re: Current active login session (From: "Quinn \"The Eskimo!\"" <email@hidden>)
 >Re: Current active login session (From: Antoine Missout <email@hidden>)
 >Re: Current active login session (From: Dave Keck <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.