FreeBSD/sys/kern/sys_procdesc.c
/*
 * Retrieve the PID associated with a process descriptor.
 */
Retrieve the PID associated with a process descriptor.
Retrieve the PID associated with a process descriptor .
int
kern_pdgetpid(struct thread *td, int fd, cap_rights_t *rightsp, pid_t *pidp)
{
	struct file *fp;
	int error;
	error = fget(td, fd, rightsp, &fp);
	if (error)
		return (error);
	if (fp->f_type != DTYPE_PROCDESC) {
		error = EBADF;
		goto out;
	}
	*pidp = procdesc_pid(fp);
out:
	fdrop(fp, td);
	return (error);
}
int kern_pdgetpid ( struct thread * td , int fd , cap_rights_t * rightsp , pid_t * pidp ) { struct file * fp ; int error ; error = fget ( td , fd , rightsp , & fp ) ; if ( error ) return ( error ) ; if ( fp -> f_type != DTYPE_PROCDESC ) { error = EBADF ; goto out ; } * pidp = procdesc_pid ( fp ) ; out : fdrop ( fp , td ) ; return ( error ) ; }
Retrieve the PID associated with a process descriptor.
Retrieve the PID associated with a process descriptor .