svn commit: r241796 - user/andre/tcp_workqueue/sys/kern

Andre Oppermann andre at FreeBSD.org
Sun Oct 21 08:29:59 UTC 2012


Author: andre
Date: Sun Oct 21 08:29:58 2012
New Revision: 241796
URL: http://svn.freebsd.org/changeset/base/241796

Log:
  In sonewconn() be more verbose in the log(DEBUG,) messages on socket
  creation failures on accept(2).  Also include the pointer to the PCB
  so it can be attributed to a particular application by corresponding
  it to "netstat -A" output.

Modified:
  user/andre/tcp_workqueue/sys/kern/uipc_socket.c

Modified: user/andre/tcp_workqueue/sys/kern/uipc_socket.c
==============================================================================
--- user/andre/tcp_workqueue/sys/kern/uipc_socket.c	Sun Oct 21 08:09:09 2012	(r241795)
+++ user/andre/tcp_workqueue/sys/kern/uipc_socket.c	Sun Oct 21 08:29:58 2012	(r241796)
@@ -474,16 +474,18 @@ sonewconn(struct socket *head, int conns
 #else
 	if (over) {
 #endif
-		log(LOG_DEBUG, "%s: Listen queue overflow: %i in queue",
-		    __func__, over);
+		log(LOG_DEBUG, "%s: pcb %p: Listen queue overflow: "
+		    "%i already in queue awaiting acceptance\n",
+		    __func__, head->so_pcb, over);
 		return (NULL);
 	}
 	VNET_ASSERT(head->so_vnet != NULL, ("%s:%d so_vnet is NULL, head=%p",
 	    __func__, __LINE__, head));
 	so = soalloc(head->so_vnet);
 	if (so == NULL) {
-		log(LOG_DEBUG, "%s: Socket allocation failure: "
-		    "limit reached or out of memory", __func__);
+		log(LOG_DEBUG, "%s: pcb %p: New socket allocation failure: "
+		    "limit reached or out of memory\n",
+		    __func__, head->so_pcb);
 		return (NULL);
 	}
 	if ((head->so_options & SO_ACCEPTFILTER) != 0)
@@ -502,11 +504,16 @@ sonewconn(struct socket *head, int conns
 	knlist_init_mtx(&so->so_rcv.sb_sel.si_note, SOCKBUF_MTX(&so->so_rcv));
 	knlist_init_mtx(&so->so_snd.sb_sel.si_note, SOCKBUF_MTX(&so->so_snd));
 	VNET_SO_ASSERT(head);
-	if (soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat) ||
-	    (*so->so_proto->pr_usrreqs->pru_attach)(so, 0, NULL)) {
+	if (soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat)) {
 		sodealloc(so);
-		log(LOG_DEBUG, "%s: soreserve() or pru_attach() failed ",
-		    __func__);
+		log(LOG_DEBUG, "%s: pcb %p: soreserve() failed\n",
+		    __func__, head->so_pcb);
+		return (NULL);
+	}
+	if ((*so->so_proto->pr_usrreqs->pru_attach)(so, 0, NULL)) {
+		sodealloc(so);
+		log(LOG_DEBUG, "%s: pcb %p: pru_attach() failed\n",
+		    __func__, head->so_pcb);
 		return (NULL);
 	}
 	so->so_rcv.sb_lowat = head->so_rcv.sb_lowat;


More information about the svn-src-user mailing list