FreeBSD/sys/kern/kern_event.c
/*
 * Register the kev w/ the kq specified by fd.
 */
Register the kev w/ the kq specified by fd.
Register the kev w / the kq specified by fd .
int 
kqfd_register(int fd, struct kevent *kev, struct thread *td, int waitok)
{
	struct kqueue *kq;
	struct file *fp;
	cap_rights_t rights;
	int error;
	error = fget(td, fd, cap_rights_init(&rights, CAP_KQUEUE_CHANGE), &fp);
	if (error != 0)
		return (error);
	if ((error = kqueue_acquire(fp, &kq)) != 0)
		goto noacquire;
	error = kqueue_register(kq, kev, td, waitok);
	kqueue_release(kq, 0);
noacquire:
	fdrop(fp, td);
	return error;
}
int kqfd_register ( int fd , struct kevent * kev , struct thread * td , int waitok ) { struct kqueue * kq ; struct file * fp ; cap_rights_t rights ; int error ; error = fget ( td , fd , cap_rights_init ( & rights , CAP_KQUEUE_CHANGE ) , & fp ) ; if ( error != 0 ) return ( error ) ; if ( ( error = kqueue_acquire ( fp , & kq ) ) != 0 ) goto noacquire ; error = kqueue_register ( kq , kev , td , waitok ) ; kqueue_release ( kq , 0 ) ; noacquire : fdrop ( fp , td ) ; return error ; }
Register the kev w/ the kq specified by fd.
Register the kev w / the kq specified by fd .