Hide 'struct ucred' behind '#ifdef _KERNEL', this should stop userland

from attempting to use it for good.  There is a catch, kvm_proc.c needs
to '#define _KERNEL' to get at the ucred.

Requested by: rwatson
This commit is contained in:
alfred 2002-08-16 07:01:43 +00:00
parent abb7e5b790
commit 997e76e7c0
2 changed files with 5 additions and 0 deletions

View File

@ -52,6 +52,9 @@ static char sccsid[] = "@(#)kvm_proc.c 8.3 (Berkeley) 9/23/93";
*/
#include <sys/param.h>
#define _KERNEL
#include <sys/ucred.h>
#undef _KERNEL
#include <sys/user.h>
#include <sys/proc.h>
#include <sys/exec.h>

View File

@ -49,6 +49,7 @@
* Please do not inspect cr_uid directly to determine superuserness.
* Only the suser() or suser_cred() function should be used for this.
*/
#ifdef _KERNEL
struct ucred {
u_int cr_ref; /* reference count */
#define cr_startcopy cr_uid
@ -68,6 +69,7 @@ struct ucred {
};
#define NOCRED ((struct ucred *)0) /* no credential available */
#define FSCRED ((struct ucred *)-1) /* filesystem credential */
#endif /* _KERNEL */
/*
* This is the external representation of struct ucred.