Date: Wed, 11 Feb 2009 16:28:49 +0000 (UTC) From: Ed Schouten <ed@FreeBSD.org> To: cvs-src-old@freebsd.org Subject: cvs commit: src/sys/kern tty.c src/sys/sys tty.h src/usr.sbin/pstat pstat.8 pstat.c Message-ID: <200902111633.n1BGXOMN051369@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200902111633.n1BGXOMN051369>