mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 15:00:12 +00:00
Unix CM: Use macros for process name and id access
This patch uses the new osi_procname() macro to obtain the process name for setpag() warnings on BSD and Darwin, and osi_curproc() to obtain the process identity, simplifying the code. Change-Id: I1f8a4d4bbcdb09eaeea3712b1fffd1aaa3cd2fa7 Reviewed-on: http://gerrit.openafs.org/1878 Reviewed-by: Derrick Brashear <shadow@dementia.org> Reviewed-by: Matt Benjamin <matt@linuxbox.com> Tested-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
parent
4dab5984b7
commit
e57c3b7bf6
@ -108,6 +108,7 @@ extern void osi_fbsd_free(void *p);
|
||||
#define VROOT VV_ROOT
|
||||
#define v_flag v_vflag
|
||||
#define osi_curcred() (curthread->td_ucred)
|
||||
#define osi_curproc() (curthread)
|
||||
#define osi_getpid() (curthread->td_proc->p_pid)
|
||||
#define simple_lock(x) mtx_lock(x)
|
||||
#define simple_unlock(x) mtx_unlock(x)
|
||||
|
@ -177,20 +177,12 @@ afspag_PSetTokens(char *ain, afs_int32 ainSize, afs_ucred_t **acred)
|
||||
if (!tcell) return ESRCH;
|
||||
if (set_parent_pag) {
|
||||
#if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
|
||||
# if defined(AFS_DARWIN_ENV)
|
||||
afs_proc_t *p = current_proc(); /* XXX */
|
||||
char procname[256];
|
||||
proc_selfname(procname, 256);
|
||||
# elif defined(AFS_FBSD_ENV)
|
||||
struct thread *p = curthread;
|
||||
char *procname = p->td_proc->p_comm;
|
||||
# else
|
||||
afs_proc_t *p = curproc; /* XXX */
|
||||
char *procname = p->p_comm;
|
||||
# endif
|
||||
osi_procname(procname, 256);
|
||||
|
||||
afs_warnuser("Process %d (%s) tried to change pags in PSetTokens\n",
|
||||
MyPidxx2Pid(MyPidxx), procname);
|
||||
setpag(p, acred, -1, &pag, 1);
|
||||
setpag(osi_curproc(), acred, -1, &pag, 1);
|
||||
#else
|
||||
setpag(acred, -1, &pag, 1);
|
||||
#endif
|
||||
|
@ -1862,23 +1862,11 @@ DECL_PIOCTL(PSetTokens)
|
||||
if (set_parent_pag) {
|
||||
afs_uint32 pag;
|
||||
#if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
|
||||
# if defined(AFS_DARWIN_ENV)
|
||||
afs_proc_t *p = current_proc(); /* XXX */
|
||||
char procname[256];
|
||||
proc_selfname(procname, 256);
|
||||
# elif defined(AFS_FBSD_ENV)
|
||||
struct thread *p = curthread;
|
||||
char *procname = p->td_proc->p_comm;
|
||||
# elif defined(AFS_NBSD40_ENV)
|
||||
afs_proc_t *p = curproc; /* XXX */
|
||||
char *procname = p->l_proc->p_comm;
|
||||
# else
|
||||
afs_proc_t *p = curproc; /* XXX */
|
||||
char *procname = p->p_comm;
|
||||
# endif
|
||||
osi_procname(procname, 256);
|
||||
afs_warnuser("Process %d (%s) tried to change pags in PSetTokens\n",
|
||||
MyPidxx2Pid(MyPidxx), procname);
|
||||
if (!setpag(p, acred, -1, &pag, 1)) {
|
||||
if (!setpag(osi_curproc(), acred, -1, &pag, 1)) {
|
||||
#else
|
||||
if (!setpag(acred, -1, &pag, 1)) {
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user