Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/kern/uipc_socket.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/kern/uipc_socket.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.184 retrieving revision 1.186.2.1 diff -u -p -r1.184 -r1.186.2.1 --- src/sys/kern/uipc_socket.c 2009/01/19 02:27:57 1.184 +++ src/sys/kern/uipc_socket.c 2009/05/13 17:21:58 1.186.2.1 @@ -1,11 +1,11 @@ -/* $NetBSD: uipc_socket.c,v 1.184 2009/01/19 02:27:57 christos Exp $ */ +/* $NetBSD: uipc_socket.c,v 1.186.2.1 2009/05/13 17:21:58 jym Exp $ */ /*- - * Copyright (c) 2002, 2007, 2008 The NetBSD Foundation, Inc. + * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe of Wasabi Systems, Inc. + * by Jason R. Thorpe of Wasabi Systems, Inc, and by Andrew Doran. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -63,7 +63,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.184 2009/01/19 02:27:57 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.186.2.1 2009/05/13 17:21:58 jym Exp $"); #include "opt_compat_netbsd.h" #include "opt_sock_counters.h" @@ -680,7 +680,7 @@ soclose(struct socket *so) if ((so->so_state & SS_ISDISCONNECTING) && so->so_nbio) goto drop; while (so->so_state & SS_ISCONNECTED) { - error = sowait(so, so->so_linger * hz); + error = sowait(so, true, so->so_linger * hz); if (error) break; } @@ -1547,6 +1547,20 @@ soshutdown(struct socket *so, int how) return error; } +int +sodrain(struct socket *so) +{ + int error; + + solock(so); + so->so_state |= SS_ISDRAINING; + cv_broadcast(&so->so_cv); + error = soshutdown(so, SHUT_RDWR); + sounlock(so); + + return error; +} + void sorflush(struct socket *so) { @@ -1692,8 +1706,10 @@ sosetopt1(struct socket *so, const struc case SO_ORCVTIMEO: { struct timeval50 otv; error = sockopt_get(sopt, &otv, sizeof(otv)); - if (error) + if (error) { + solock(so); break; + } timeval50_to_timeval(&otv, &tv); opt = opt == SO_OSNDTIMEO ? SO_SNDTIMEO : SO_RCVTIMEO; error = 0; @@ -2076,7 +2092,7 @@ sohasoutofband(struct socket *so) { fownsignal(so->so_pgid, SIGURG, POLL_PRI, POLLPRI|POLLRDBAND, so); - selnotify(&so->so_rcv.sb_sel, POLLPRI | POLLRDBAND, 0); + selnotify(&so->so_rcv.sb_sel, POLLPRI | POLLRDBAND, NOTE_SUBMIT); } static void @@ -2308,7 +2324,7 @@ sysctl_kern_somaxkva(SYSCTLFN_ARGS) } static void -sysctl_kern_somaxkva_setup() +sysctl_kern_somaxkva_setup(void) { KASSERT(socket_sysctllog == NULL);