From c1508b28c6d34835119ee7095acad0ec94eff237 Mon Sep 17 00:00:00 2001 From: Alfred Perlstein Date: Thu, 28 Mar 2002 18:12:27 +0000 Subject: [PATCH] To remove nested include of sys/lock.h and sys/mutex.h from sys/proc.h make the pargs_* functions into non-inlines in kern/kern_proc.c. Requested by: bde --- sys/kern/kern_proc.c | 44 ++++++++++++++++++++++++++++++++++++++ sys/sys/proc.h | 50 ++++---------------------------------------- 2 files changed, 48 insertions(+), 46 deletions(-) diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index b81141bbc70..79849bc0b76 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -944,6 +944,50 @@ sysctl_kern_proc(SYSCTL_HANDLER_ARGS) return (0); } +struct pargs * +pargs_alloc(int len) +{ + struct pargs *pa; + + MALLOC(pa, struct pargs *, sizeof(struct pargs) + len, M_PARGS, + M_WAITOK); + pa->ar_ref = 1; + pa->ar_length = len; + return (pa); +} + +void +pargs_free(struct pargs *pa) +{ + + FREE(pa, M_PARGS); +} + +void +pargs_hold(struct pargs *pa) +{ + + if (pa == NULL) + return; + PARGS_LOCK(pa); + pa->ar_ref++; + PARGS_UNLOCK(pa); +} + +void +pargs_drop(struct pargs *pa) +{ + + if (pa == NULL) + return; + PARGS_LOCK(pa); + if (--pa->ar_ref == 0) { + PARGS_UNLOCK(pa); + pargs_free(pa); + } else + PARGS_UNLOCK(pa); +} + /* * This sysctl allows a process to retrieve the argument list or process * title for another process without groping around in the address space diff --git a/sys/sys/proc.h b/sys/sys/proc.h index d520d634acb..a75a8cfef97 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -55,8 +55,6 @@ #else #include #endif -#include -#include #include #include /* Machine-dependent proc substruct. */ #include @@ -707,50 +705,6 @@ extern uma_zone_t proc_zone; extern int lastpid; -static __inline struct pargs * -pargs_alloc(int len) -{ - struct pargs *pa; - - MALLOC(pa, struct pargs *, sizeof(struct pargs) + len, M_PARGS, - M_WAITOK); - pa->ar_ref = 1; - pa->ar_length = len; - return (pa); -} - -static __inline void -pargs_free(struct pargs *pa) -{ - - FREE(pa, M_PARGS); -} - -static __inline void -pargs_hold(struct pargs *pa) -{ - - if (pa == NULL) - return; - PARGS_LOCK(pa); - pa->ar_ref++; - PARGS_UNLOCK(pa); -} - -static __inline void -pargs_drop(struct pargs *pa) -{ - - if (pa == NULL) - return; - PARGS_LOCK(pa); - if (--pa->ar_ref == 0) { - PARGS_UNLOCK(pa); - pargs_free(pa); - } else - PARGS_UNLOCK(pa); -} - /* * XXX macros for scheduler. Shouldn't be here, but currently needed for * bounding the dubious p_estcpu inheritance in wait1(). @@ -785,6 +739,10 @@ int p_candebug(struct proc *p1, struct proc *p2); int p_cansee(struct proc *p1, struct proc *p2); int p_cansched(struct proc *p1, struct proc *p2); int p_cansignal(struct proc *p1, struct proc *p2, int signum); +struct pargs *pargs_alloc(int len); +void pargs_drop(struct pargs *pa); +void pargs_free(struct pargs *pa); +void pargs_hold(struct pargs *pa); void procinit(void); void proc_linkup(struct proc *p, struct ksegrp *kg, struct kse *ke, struct thread *td);