Date: Thu, 1 Nov 2001 17:42:41 -0500 From: Garance A Drosihn <drosih@rpi.edu> To: Julian Elischer <julian@elischer.org>, Robert Watson <rwatson@FreeBSD.ORG> Cc: arch@FreeBSD.ORG Subject: Re: Changes to suser() and friends Message-ID: <p05101006b8077cf25f07@[128.113.24.47]> In-Reply-To: <Pine.BSF.4.21.0111011332350.42259-100000@InterJet.elischer.org> References: <Pine.BSF.4.21.0111011332350.42259-100000@InterJet.elischer.org>
next in thread | previous in thread | raw e-mail | index | archive | help
At 1:35 PM -0800 11/1/01, Julian Elischer wrote:
>On Thu, 1 Nov 2001, Robert Watson wrote:
>
>>
>> error = suser(p->p_ucred);
>> or
>> error = suser(td->td_proc->p_ucred);
>> or
>> error = suser(td->td_ucred);
>
>the reason for the existance of suser_td is so that it could be called
>by functions for which 'thread *' was an opaque pointer.. i.e. there
>are many places that use suser() and suser_td() that do not include
>proc.h and thus do not know about any sub elements of the thread
>structure. (or proc structure)
Hmm. It is nicer when fewer source files are mucking around in the
internals of a data structure. Still, it would be nice to collapse
to fewer routines. Would the following be any better?
int suser __P((struct ucred *cred, struct proc *proc, int flag));
int suser_td __P((struct ucred *cred, struct thread *thread, int flag));
and say that the current 'suser(struct proc *)'
be done as new 'suser(NULL, struct proc *, 0)',
and the current 'suser_td(struct thread *)'
be done as new 'suser_td(NULL, struct thread *, 0)'
or is that too stupid for words? Or maybe switch the positions of
'cred' and 'proc/thread', just so the most common callers would just
have 'NULL, 0' as the last two parameters. Does that add too much
overhead?
[disclaimer: this is clearly not my area of coding, so it may very
well be that the above *is* too stupid for words... :-) ]
--
Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu
Senior Systems Programmer or gad@freebsd.org
Rensselaer Polytechnic Institute or drosih@rpi.edu
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p05101006b8077cf25f07>
