Re: current_task(), struct proc...
Re: current_task(), struct proc...
- Subject: Re: current_task(), struct proc...
- From: Herb Petschauer <email@hidden>
- Date: Tue, 26 Jul 2005 09:20:03 -0700
On 7/21/05, Mike Smith <email@hidden> wrote:
>
>
> On Jul 20, 2005, at 5:24 PM, Herb Petschauer wrote:
>
> Under Panther, I can see that in this scenario, current_task() ==
> p->task. I can't see why that wouldn't always be true (in this
> scenario, I need to do more code reading for a better blanket
> statement and it's not really important at the moment). Is it safe to
> just port my ioctl callback routine to use current_task() for both
> Tiger and Panther?
> In a general sense, no. You should use the proc out of the vfs_context_t
> and fetch its task; this is the mechanism by which proxy work is enabled.
>
> However, if you're in the ioctl handler there is AFAIK no way to be called
> except on the requester's task, so you're probably safe.
>
> If you have a vfs_context_t to hand, you can sanity-check the context's proc
> against current_proc() just to be sure; if the two don't match then
> something
> odd is going on.
>
> = Mike
>
Yes, I did some more code reading before going on a few days vacation.
In the general case I'd never assume current_task() == p->task :-)
Thanks for the added info (the Panther verision current asserts
current_task() == p->task and so far so good apparently) and another
sanity assert...
Cheers!
H.
_______________________________________________
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