Make GCPAGs_perproc_func cleaner for FBSD case

Partially rewrite 2cf1f10a to reduce code clutter.
Instead of accessing pproc->p_ucred directly in afs_GCPAGs_perproc_func(),
push this access into a FBSD-specific afs_proc2cred() function.
This is not quite right, since we do not lock the proc mutex, but
in the same way as the old version and with more reasonable preprocessor
conditionals.
This also eliminates a probably-needless call to osi_Panic.

Change-Id: Ib403132f31cc13f8c4581cb89ecc8938d0a0dd88
Reviewed-on: http://gerrit.openafs.org/1672
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
Ben Kaduk 2010-03-30 20:34:02 -04:00 committed by Derrick Brashear
parent c0f1970909
commit 053522f534
2 changed files with 13 additions and 8 deletions

View File

@ -430,15 +430,24 @@ afs_osi_proc2cred(afs_proc_t * pr)
NGROUPS * sizeof(gid_t));
return &cr;
}
#elif defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
#elif defined(AFS_FBSD_ENV)
const afs_ucred_t *
afs_osi_proc2cred(afs_proc_t * pr)
{
/*
* This whole function is kind of an ugly hack. For one, the
* 'const' is a lie. Also, we should probably be holding the
* proc mutex around all accesses to the credentials structure,
* but the present API does not allow this.
*/
return pr->p_ucred;
}
#elif defined(AFS_DARWIN_ENV)
const afs_ucred_t *
afs_osi_proc2cred(afs_proc_t * pr)
{
afs_ucred_t *rv = NULL;
static afs_ucred_t cr;
#if defined(AFS_FBSD80_ENV)
osi_Panic("proc2cred broken for dynamic cr_groups");
#endif
if (pr == NULL) {
return NULL;

View File

@ -631,11 +631,7 @@ afs_GCPAGs_perproc_func(afs_proc_t * pproc)
afs_GCPAGs_perproc_count++;
#if defined(AFS_FBSD80_ENV)
pcred = pproc->p_ucred; /* XXX locking (or just use thread creds) */
#else
pcred = afs_osi_proc2cred(pproc);
#endif
if (!pcred)
return;