Re: Getting the User/Owner of another process
Re: Getting the User/Owner of another process
- Subject: Re: Getting the User/Owner of another process
- From: "John Farmer" <email@hidden>
- Date: Tue, 30 Sep 2003 08:51:22 -0700
Sorry for the confusion. I am working on 10.2.6, I am not working with
Panther... yet. I have expectations of those same problems you mentioned,
and more for 10.3. I am writing a Startup Item, Preference Pane, and Driver
for networking. Since you cannot have mutliple users running simulaniously
in 10.2, I can rely on getting the User that owns Finder, since there will
only ever be one user that owns Finder at one time, also according to the
documentation for NSUserName() and NSFullUserName() these expectations are
reasonable, because there will only ever be one user logged in. The way the
driver, pref pane, and startup item work together I need to find a reliable
way to get the user name when I log in so that the startup item (which is a
daemon) can set the preferences to the pref pane and the driver.
Sorry for the confusion, and thanks for the help,
John D. Farmer
----- Original Message -----
From: "Alastair J.Houghton" <email@hidden>
To: "John Farmer" <email@hidden>
Cc: <email@hidden>
Sent: Tuesday, September 30, 2003 8:31 AM
Subject: Re: Getting the User/Owner of another process
>
On Tuesday, September 30, 2003, at 03:51 pm, John Farmer wrote:
>
>
> I need to be able to get the User/Owner of another process, like
>
> Finder. I
>
> need to do this because I need to get the user name of the person
>
> currently
>
> logged in. Now before you berate me, I did try to use NSUserName(),
>
> NSFullUserName() functions.
>
>
>
> There seems to be a very subtle bug in these functions.
>
>
No, there isn't a bug. Your expectation is wrong; given that many
>
people can be logged in to a machine simultaneously, and given that
>
they are executing as the "root" user, it wouldn't make sense for these
>
functions to return anything else.
>
>
> So I need to someway get the name of the person logged in, in a
>
> Startup Item
>
> so I can setup the last preferences for the app and driver I am
>
> writing.
>
>
There are three *big* problems here:
>
>
1. There might not be anyone logged in.
>
>
2. There might be multiple users logged in (i.e. several Finder
>
processes running as different users/groups).
>
>
3. Panther's fast user switching feature means that the user that owns
>
the main display can change at the click of a button. This may well
>
cause you complications.
>
>
What is your driver for? You need to think carefully about which user
>
should own your device and therefore under what circumstances you
>
should apply their preferences. For example, a driver for a removable
>
media device should probably respect the preferences of whoever mounted
>
it, whereas a driver for an input device should respect the preferences
>
of the user that currently owns the main display.
>
>
Kind regards,
>
>
Alastair.
_______________________________________________
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.