diff options
author | alfred <alfred@FreeBSD.org> | 2002-03-28 18:12:27 +0000 |
---|---|---|
committer | alfred <alfred@FreeBSD.org> | 2002-03-28 18:12:27 +0000 |
commit | 111877501466e7f27ae602dcaa18a3745c00d023 (patch) | |
tree | d043b8ff5f47cf12d07a3ca22fc8267873c1f3f3 /sys/kern/kern_proc.c | |
parent | 8dd2bd6957e72f9fad0d4b5b7b15d881ae090f4f (diff) | |
download | FreeBSD-src-111877501466e7f27ae602dcaa18a3745c00d023.zip FreeBSD-src-111877501466e7f27ae602dcaa18a3745c00d023.tar.gz |
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
Diffstat (limited to 'sys/kern/kern_proc.c')
-rw-r--r-- | sys/kern/kern_proc.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index b81141b..79849bc 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 |