From owner-cvs-src-old@FreeBSD.ORG Wed Feb 11 16:33:27 2009 Return-Path: Delivered-To: cvs-src-old@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 885F6106564A for ; Wed, 11 Feb 2009 16:33:27 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 749E08FC0A for ; Wed, 11 Feb 2009 16:33:27 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n1BGXPNG051372 for ; Wed, 11 Feb 2009 16:33:25 GMT (envelope-from ed@repoman.freebsd.org) Received: (from svn2cvs@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n1BGXOMN051369 for cvs-src-old@freebsd.org; Wed, 11 Feb 2009 16:33:24 GMT (envelope-from ed@repoman.freebsd.org) Message-Id: <200902111633.n1BGXOMN051369@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: svn2cvs set sender to ed@repoman.freebsd.org using -f From: Ed Schouten Date: Wed, 11 Feb 2009 16:28:49 +0000 (UTC) To: cvs-src-old@freebsd.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/sys/kern tty.c src/sys/sys tty.h src/usr.sbin/pstat pstat.8 pstat.c X-BeenThere: cvs-src-old@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: **OBSOLETE** CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Feb 2009 16:33:27 -0000 ed 2009-02-11 16:28:49 UTC FreeBSD src repository Modified files: sys/kern tty.c sys/sys tty.h usr.sbin/pstat pstat.8 pstat.c Log: SVN rev 188487 on 2009-02-11 16:28:49Z by ed Serialize write() calls on TTYs. Just like the old TTY layer, the current MPSAFE TTY layer does not make any attempt to serialize calls of write(). Data is copied into the kernel in 256 (TTY_STACKBUF) byte chunks. If a write() call occurs at the same time, the data may interleave. This is especially likely when the TTY starts blocking, because the output queue reaches the high watermark. I've implemented this by adding a new flag, TTY_BUSY_OUT, which is used to mark a TTY as having a thread stuck in write(). Because I don't want non-blocking processes to be possibly blocked by a sleeping thread, I'm still allowing it to bypass the protection. According to this message, the Linux kernel returns EAGAIN in such cases, but I think that's a little too restrictive: http://kerneltrap.org/index.php?q=mailarchive/linux-kernel/2007/5/2/85418/thread PR: kern/118287 Revision Changes Path 1.309 +24 -6 src/sys/kern/tty.c 1.113 +3 -0 src/sys/sys/tty.h 1.54 +5 -0 src/usr.sbin/pstat/pstat.8 1.109 +5 -0 src/usr.sbin/pstat/pstat.c