network/uinet/sys/kern/kern_proc.c
/*
 * This sysctl allows a process to retrieve ps_strings structure location of
 * another process.
 */
This sysctl allows a process to retrieve ps_strings structure location of
another process.
This sysctl allows a process to retrieve ps_strings structure location of another process .
static int
sysctl_kern_proc_ps_strings(SYSCTL_HANDLER_ARGS)
{
	int *name = (int *)arg1;
	u_int namelen = arg2;
	struct proc *p;
	vm_offset_t ps_strings;
	int error;
#ifdef COMPAT_FREEBSD32
	uint32_t ps_strings32;
#endif
	if (namelen != 1)
		return (EINVAL);
	error = pget((pid_t)name[0], PGET_CANDEBUG, &p);
	if (error != 0)
		return (error);
#ifdef COMPAT_FREEBSD32
	if ((req->flags & SCTL_MASK32) != 0) {
		ps_strings32 = SV_PROC_FLAG(p, SV_ILP32) != 0 ?
		    PTROUT(p->p_sysent->sv_psstrings) : 0;
		PROC_UNLOCK(p);
		error = SYSCTL_OUT(req, &ps_strings32, sizeof(ps_strings32));
		return (error);
	}
#endif
	ps_strings = p->p_sysent->sv_psstrings;
	PROC_UNLOCK(p);
	error = SYSCTL_OUT(req, &ps_strings, sizeof(ps_strings));
	return (error);
}
static int sysctl_kern_proc_ps_strings ( SYSCTL_HANDLER_ARGS ) { int * name = ( int * ) arg1 ; u_int namelen = arg2 ; struct proc * p ; vm_offset_t ps_strings ; int error ; #ifdef COMPAT_FREEBSD32 uint32_t ps_strings32 ; #endif if ( namelen != 1 ) return ( EINVAL ) ; error = pget ( ( pid_t ) name [ 0 ] , PGET_CANDEBUG , & p ) ; if ( error != 0 ) return ( error ) ; #ifdef COMPAT_FREEBSD32 if ( ( req -> flags & SCTL_MASK32 ) != 0 ) { ps_strings32 = SV_PROC_FLAG ( p , SV_ILP32 ) != 0 ? PTROUT ( p -> p_sysent -> sv_psstrings ) : 0 ; PROC_UNLOCK ( p ) ; error = SYSCTL_OUT ( req , & ps_strings32 , sizeof ( ps_strings32 ) ) ; return ( error ) ; } #endif ps_strings = p -> p_sysent -> sv_psstrings ; PROC_UNLOCK ( p ) ; error = SYSCTL_OUT ( req , & ps_strings , sizeof ( ps_strings ) ) ; return ( error ) ; }
This sysctl allows a process to retrieve ps_strings structure location of
 another process.
This sysctl allows a process to retrieve ps_strings structure location of another process .
/*
		 * We return 0 if the 32 bit emulation request is for a 64 bit
		 * process.
		 */