2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 #include <afsconfig.h>
11 #include "afs/param.h"
14 #include "afs/sysincludes.h" /* Standard vendor system headers */
15 #include "afsincludes.h" /* Afs-based standard headers */
16 #include "afs/afs_stats.h" /* afs statistics */
20 /* afs_osi_TraverseProcTable() - Walk through the systems process
21 * table, calling afs_GCPAGs_perproc_func() for each process.
25 #if (defined(AFS_DARWIN_ENV) && !defined(AFS_DARWIN80_ENV))
27 afs_osi_TraverseProcTable(void)
30 LIST_FOREACH(p
, &allproc
, p_list
) {
31 if (p
->p_stat
== SIDL
)
33 if (p
->p_stat
== SZOMB
)
35 if (p
->p_flag
& P_SYSTEM
)
37 afs_GCPAGs_perproc_func(p
);
42 /* return a pointer (sometimes a static copy ) to the cred for a
44 * subsequent calls may overwrite the previously returned value.
47 #if defined(AFS_DARWIN80_ENV)
50 afs_osi_proc2cred(afs_proc_t
* pr
)
52 afs_ucred_t
*rv
= NULL
;
53 static afs_ucred_t cr
;
59 pcred
= proc_ucred(pr
);
61 afs_set_cr_uid(&cr
, afs_cr_uid(pcred
));
62 cr
.cr_ngroups
= pcred
->cr_ngroups
;
63 memcpy(cr
.cr_groups
, pcred
->cr_groups
,
64 NGROUPS
* sizeof(gid_t
));
70 afs_osi_proc2cred(afs_proc_t
* pr
)
72 afs_ucred_t
*rv
= NULL
;
73 static afs_ucred_t cr
;
79 if ((pr
->p_stat
== SSLEEP
) || (pr
->p_stat
== SRUN
)
80 || (pr
->p_stat
== SSTOP
)) {
83 afs_set_cr_uid(&cr
, afs_cr_uid(pr
->p_cred
->pc_ucred
));
84 cr
.cr_ngroups
= pr
->p_cred
->pc_ucred
->cr_ngroups
;
85 memcpy(cr
.cr_groups
, pr
->p_cred
->pc_ucred
->cr_groups
,
86 NGROUPS
* sizeof(gid_t
));
96 #endif /* AFS_GCPAGS */