svn commit: r209595 - head/sys/kern

John Baldwin jhb at FreeBSD.org
Tue Jun 29 20:44:20 UTC 2010


Author: jhb
Date: Tue Jun 29 20:44:19 2010
New Revision: 209595
URL: http://svn.freebsd.org/changeset/base/209595

Log:
  Send SIGPIPE to the thread that issued the offending system call
  rather than to the entire process.
  
  Reported by:	Anit Chakraborty
  Reviewed by:	kib, deischen (concept)
  MFC after:	1 week

Modified:
  head/sys/kern/sys_generic.c
  head/sys/kern/sys_socket.c
  head/sys/kern/uipc_syscalls.c

Modified: head/sys/kern/sys_generic.c
==============================================================================
--- head/sys/kern/sys_generic.c	Tue Jun 29 20:43:39 2010	(r209594)
+++ head/sys/kern/sys_generic.c	Tue Jun 29 20:44:19 2010	(r209595)
@@ -532,7 +532,7 @@ dofilewrite(td, fd, fp, auio, offset, fl
 		/* Socket layer is responsible for issuing SIGPIPE. */
 		if (fp->f_type != DTYPE_SOCKET && error == EPIPE) {
 			PROC_LOCK(td->td_proc);
-			psignal(td->td_proc, SIGPIPE);
+			tdsignal(td, SIGPIPE);
 			PROC_UNLOCK(td->td_proc);
 		}
 	}

Modified: head/sys/kern/sys_socket.c
==============================================================================
--- head/sys/kern/sys_socket.c	Tue Jun 29 20:43:39 2010	(r209594)
+++ head/sys/kern/sys_socket.c	Tue Jun 29 20:44:19 2010	(r209595)
@@ -102,7 +102,7 @@ soo_write(struct file *fp, struct uio *u
 	error = sosend(so, 0, uio, 0, 0, 0, uio->uio_td);
 	if (error == EPIPE && (so->so_options & SO_NOSIGPIPE) == 0) {
 		PROC_LOCK(uio->uio_td->td_proc);
-		psignal(uio->uio_td->td_proc, SIGPIPE);
+		tdsignal(uio->uio_td, SIGPIPE);
 		PROC_UNLOCK(uio->uio_td->td_proc);
 	}
 	return (error);

Modified: head/sys/kern/uipc_syscalls.c
==============================================================================
--- head/sys/kern/uipc_syscalls.c	Tue Jun 29 20:43:39 2010	(r209594)
+++ head/sys/kern/uipc_syscalls.c	Tue Jun 29 20:44:19 2010	(r209595)
@@ -794,7 +794,7 @@ kern_sendit(td, s, mp, flags, control, s
 		if (error == EPIPE && !(so->so_options & SO_NOSIGPIPE) &&
 		    !(flags & MSG_NOSIGNAL)) {
 			PROC_LOCK(td->td_proc);
-			psignal(td->td_proc, SIGPIPE);
+			tdsignal(td, SIGPIPE);
 			PROC_UNLOCK(td->td_proc);
 		}
 	}
@@ -2444,7 +2444,7 @@ sctp_generic_sendmsg (td, uap)
 		if (error == EPIPE && !(so->so_options & SO_NOSIGPIPE) &&
 		    !(uap->flags & MSG_NOSIGNAL)) {
 			PROC_LOCK(td->td_proc);
-			psignal(td->td_proc, SIGPIPE);
+			tdsignal(td, SIGPIPE);
 			PROC_UNLOCK(td->td_proc);
 		}
 	}
@@ -2562,7 +2562,7 @@ sctp_generic_sendmsg_iov(td, uap)
 		if (error == EPIPE && !(so->so_options & SO_NOSIGPIPE) &&
 		    !(uap->flags & MSG_NOSIGNAL)) {
 			PROC_LOCK(td->td_proc);
-			psignal(td->td_proc, SIGPIPE);
+			tdsignal(td, SIGPIPE);
 			PROC_UNLOCK(td->td_proc);
 		}
 	}


More information about the svn-src-head mailing list