X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/d7e50217d7adf6e52786a38bcaa4cd698cb9a79e..55e303ae13a4cf49d70f2294092726f2fffb9ef2:/bsd/kern/sys_socket.c diff --git a/bsd/kern/sys_socket.c b/bsd/kern/sys_socket.c index a215a42bc..c501134a1 100644 --- a/bsd/kern/sys_socket.c +++ b/bsd/kern/sys_socket.c @@ -60,6 +60,7 @@ #include #include #include +#include #include #include #include @@ -80,8 +81,10 @@ int soo_close __P((struct file *fp, struct proc *p)); int soo_select __P((struct file *fp, int which, void * wql, struct proc *p)); +int soo_kqfilter __P((struct file *fp, struct knote *kn, struct proc *p)); + struct fileops socketops = - { soo_read, soo_write, soo_ioctl, soo_select, soo_close }; + { soo_read, soo_write, soo_ioctl, soo_select, soo_close, soo_kqfilter }; /* ARGSUSED */ int @@ -346,6 +349,7 @@ soo_select(fp, which, wql, p) register int s = splnet(); int retnum=0; + if (so == NULL || so == (struct socket*)-1) goto done; switch (which) { @@ -414,14 +418,17 @@ soo_close(fp, p) struct proc *p; { int error = 0; + struct socket *sp; + + sp = (struct socket *)fp->f_data; + fp->f_data = NULL; thread_funnel_switch(KERNEL_FUNNEL, NETWORK_FUNNEL); - if (fp->f_data) - error = soclose((struct socket *)fp->f_data); + if (sp) + error = soclose(sp); thread_funnel_switch(NETWORK_FUNNEL, KERNEL_FUNNEL); - fp->f_data = 0; return (error); }