Re: current user if started from /Library/StartupItems
Re: current user if started from /Library/StartupItems
- Subject: Re: current user if started from /Library/StartupItems
- From: Kris Amico <email@hidden>
- Date: Mon, 03 Feb 2003 19:08:44 -0800
Polling ps and parsing the results is one way to do it, but also could one
not use SCDynamicStoreCopyConsoleUser from the SystemConfiguration
framework? Cool thing about this approach is that you may also passively
listen for a change to that data in the dynamic store so that you never have
to poll anything at all or do any parsing. I think that data lives in the
dynamic store at "State:/Users/ConsoleUser". In fact,
SCDynamicStoreKeyCreateConsoleUser can create this SCD notification key for
you.
On 2/3/03 5:25 PM, "Sherm Pendley" <email@hidden> wrote:
>
On Monday, February 3, 2003, at 08:06 PM, Frank Fenn wrote:
>
>
> The problem is that every function NSUserName, getenv("USER"),
>
> getiud() returns the root user.
>
>
That's not a bug, it's a *feature*. :-) Those functions are returning
>
the correct answer, as anything that's run as a StartupItem is run as
>
root.
>
>
> How do I get the actual console user?
>
>
You could periodically do a "ps -alx" and parse its output to see what
>
user ID the Finder, Dock, WindowServer, etc., are running under.
>
>
sherm--
>
>
UNIX: Where /sbin/init is Job 1.
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
--
Kris Amico <email@hidden>, AIM: Kris Amico
Senior Software Engineer
Macintosh Client Software Development
EarthLink, Inc.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.