[BACK]Return to uipc_socket.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / kern

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/kern/uipc_socket.c between version 1.141.2.4 and 1.148

version 1.141.2.4, 2008/03/23 02:05:01 version 1.148, 2007/12/05 07:06:55
Line 1 
Line 1 
 /*      uipc_socket.c,v 1.141.2.3 2008/01/09 01:56:28 matt Exp  */  /*      $NetBSD$        */
   
 /*-  /*-
  * Copyright (c) 2002, 2007, 2008 The NetBSD Foundation, Inc.   * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc.
  * All rights reserved.   * All rights reserved.
  *   *
  * This code is derived from software contributed to The NetBSD Foundation   * This code is derived from software contributed to The NetBSD Foundation
Line 68 
Line 68 
  */   */
   
 #include <sys/cdefs.h>  #include <sys/cdefs.h>
 __KERNEL_RCSID(0, "uipc_socket.c,v 1.141.2.3 2008/01/09 01:56:28 matt Exp");  __KERNEL_RCSID(0, "$NetBSD$");
   
 #include "opt_sock_counters.h"  #include "opt_sock_counters.h"
 #include "opt_sosend_loan.h"  #include "opt_sosend_loan.h"
Line 280  sodoloanfree(struct vm_page **pgs, void 
Line 280  sodoloanfree(struct vm_page **pgs, void 
 }  }
   
 static size_t  static size_t
 sodopendfree(void)  sodopendfree()
 {  {
         size_t rv;          size_t rv;
   
Line 299  sodopendfree(void)
Line 299  sodopendfree(void)
  */   */
   
 static size_t  static size_t
 sodopendfreel(void)  sodopendfreel()
 {  {
         struct mbuf *m, *next;          struct mbuf *m, *next;
         size_t rv = 0;          size_t rv = 0;
Line 580  sobind(struct socket *so, struct mbuf *n
Line 580  sobind(struct socket *so, struct mbuf *n
 }  }
   
 int  int
 solisten(struct socket *so, int backlog, struct lwp *l)  solisten(struct socket *so, int backlog)
 {  {
         int     s, error;          int     s, error;
   
         s = splsoftnet();          s = splsoftnet();
         error = (*so->so_proto->pr_usrreq)(so, PRU_LISTEN, NULL,          error = (*so->so_proto->pr_usrreq)(so, PRU_LISTEN, NULL,
             NULL, NULL, l);              NULL, NULL, NULL);
         if (error != 0) {          if (error != 0) {
                 splx(s);                  splx(s);
                 return error;                  return error;
Line 660  soclose(struct socket *so)
Line 660  soclose(struct socket *so)
                                 goto drop;                                  goto drop;
                 }                  }
                 if (so->so_options & SO_LINGER) {                  if (so->so_options & SO_LINGER) {
                         if ((so->so_state & SS_ISDISCONNECTING) && so->so_nbio)                          if ((so->so_state & SS_ISDISCONNECTING) &&
                               (so->so_state & SS_NBIO))
                                 goto drop;                                  goto drop;
                         while (so->so_state & SS_ISCONNECTED) {                          while (so->so_state & SS_ISCONNECTED) {
                                 error = tsleep((void *)&so->so_timeo,                                  error = tsleep((void *)&so->so_timeo,
Line 869  sosend(struct socket *so, struct mbuf *a
Line 870  sosend(struct socket *so, struct mbuf *a
                         snderr(EMSGSIZE);                          snderr(EMSGSIZE);
                 if (space < resid + clen &&                  if (space < resid + clen &&
                     (atomic || space < so->so_snd.sb_lowat || space < clen)) {                      (atomic || space < so->so_snd.sb_lowat || space < clen)) {
                         if (so->so_nbio)                          if (so->so_state & SS_NBIO)
                                 snderr(EWOULDBLOCK);                                  snderr(EWOULDBLOCK);
                         sbunlock(&so->so_snd);                          sbunlock(&so->so_snd);
                         error = sbwait(&so->so_snd);                          error = sbwait(&so->so_snd);
Line 1109  soreceive(struct socket *so, struct mbuf
Line 1110  soreceive(struct socket *so, struct mbuf
                 }                  }
                 if (uio->uio_resid == 0)                  if (uio->uio_resid == 0)
                         goto release;                          goto release;
                 if (so->so_nbio || (flags & MSG_DONTWAIT)) {                  if ((so->so_state & SS_NBIO) || (flags & MSG_DONTWAIT)) {
                         error = EWOULDBLOCK;                          error = EWOULDBLOCK;
                         goto release;                          goto release;
                 }                  }
Line 1682  sogetopt(struct socket *so, int level, i
Line 1683  sogetopt(struct socket *so, int level, i
 void  void
 sohasoutofband(struct socket *so)  sohasoutofband(struct socket *so)
 {  {
   
         fownsignal(so->so_pgid, SIGURG, POLL_PRI, POLLPRI|POLLRDBAND, so);          fownsignal(so->so_pgid, SIGURG, POLL_PRI, POLLPRI|POLLRDBAND, so);
         selnotify(&so->so_rcv.sb_sel, POLLPRI | POLLRDBAND, 0);          selwakeup(&so->so_rcv.sb_sel);
 }  }
   
 static void  static void
Line 1795  soo_kqfilter(struct file *fp, struct kno
Line 1795  soo_kqfilter(struct file *fp, struct kno
                 sb = &so->so_snd;                  sb = &so->so_snd;
                 break;                  break;
         default:          default:
                 return (EINVAL);                  return (1);
         }          }
         SLIST_INSERT_HEAD(&sb->sb_sel.sel_klist, kn, kn_selnext);          SLIST_INSERT_HEAD(&sb->sb_sel.sel_klist, kn, kn_selnext);
         sb->sb_flags |= SB_KNOTE;          sb->sb_flags |= SB_KNOTE;
         return (0);          return (0);
 }  }
   
 static int  
 sodopoll(struct socket *so, int events)  
 {  
         int revents;  
   
         revents = 0;  
   
         if (events & (POLLIN | POLLRDNORM))  
                 if (soreadable(so))  
                         revents |= events & (POLLIN | POLLRDNORM);  
   
         if (events & (POLLOUT | POLLWRNORM))  
                 if (sowritable(so))  
                         revents |= events & (POLLOUT | POLLWRNORM);  
   
         if (events & (POLLPRI | POLLRDBAND))  
                 if (so->so_oobmark || (so->so_state & SS_RCVATMARK))  
                         revents |= events & (POLLPRI | POLLRDBAND);  
   
         return revents;  
 }  
   
 int  
 sopoll(struct socket *so, int events)  
 {  
         int revents = 0;  
         int s;  
   
         if ((revents = sodopoll(so, events)) != 0)  
                 return revents;  
   
         KERNEL_LOCK(1, curlwp);  
         s = splsoftnet();  
   
         if ((revents = sodopoll(so, events)) == 0) {  
                 if (events & (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)) {  
                         selrecord(curlwp, &so->so_rcv.sb_sel);  
                         so->so_rcv.sb_flags |= SB_SEL;  
                 }  
   
                 if (events & (POLLOUT | POLLWRNORM)) {  
                         selrecord(curlwp, &so->so_snd.sb_sel);  
                         so->so_snd.sb_flags |= SB_SEL;  
                 }  
         }  
   
         splx(s);  
         KERNEL_UNLOCK_ONE(curlwp);  
   
         return revents;  
 }  
   
   
 #include <sys/sysctl.h>  #include <sys/sysctl.h>
   
 static int sysctl_kern_somaxkva(SYSCTLFN_PROTO);  static int sysctl_kern_somaxkva(SYSCTLFN_PROTO);

Legend:
Removed from v.1.141.2.4  
changed lines
  Added in v.1.148

CVSweb <webmaster@jp.NetBSD.org>