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
This commit is contained in:
Alfred Perlstein 2002-03-28 18:12:27 +00:00
parent 74c66edafa
commit c1508b28c6
2 changed files with 48 additions and 46 deletions

View File

@ -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

View File

@ -55,8 +55,6 @@
#else
#include <sys/pcpu.h>
#endif
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/ucred.h>
#include <machine/proc.h> /* Machine-dependent proc substruct. */
#include <vm/uma.h>
@ -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);