From owner-freebsd-hackers Tue May 14 09:10:08 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id JAA20714 for hackers-outgoing; Tue, 14 May 1996 09:10:08 -0700 (PDT) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id JAA20708 for ; Tue, 14 May 1996 09:10:05 -0700 (PDT) Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.12/8.6.9) id CAA10288; Wed, 15 May 1996 02:01:34 +1000 Date: Wed, 15 May 1996 02:01:34 +1000 From: Bruce Evans Message-Id: <199605141601.CAA10288@godzilla.zeta.org.au> To: freebsd-hackers@FreeBSD.org, tom@uces.bangor.ac.uk Subject: Re: write and pty's Sender: owner-hackers@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk >... >After some hours with xxgdb and libraries compiled with debugging symbols, >I tracked the problem to a write call. This write call returns 0 even >though it appears that a charater has been written. The fact that this >call returns 0 means that the write pointer in the cmdtool code is not >updated and so it is written again etc. (you get the picture) >... >I am running FreeBSD-2.2-SNAP 960128 with the xview-3.2 patched for X11R6. >The problem also exists on 2.1-RELEASE. This should be fixed in current SNAPs and stables (versions after April 11). It happened for most writes of more than about 100 bytes if PF_REMOTE was set. Bruce Index: tty_pty.c =================================================================== RCS file: /a/ncvs/src/sys/kern/tty_pty.c,v retrieving revision 1.37 retrieving revision 1.38 diff -c -1 -r1.37 -r1.38 *** tty_pty.c 1996/03/11 02:24:39 1.37 --- tty_pty.c 1996/04/11 18:43:37 1.38 *************** *** 33,35 **** * @(#)tty_pty.c 8.4 (Berkeley) 2/20/95 ! * $Id: tty_pty.c,v 1.37 1996/03/11 02:24:39 hsu Exp $ */ --- 33,35 ---- * @(#)tty_pty.c 8.4 (Berkeley) 2/20/95 ! * $Id: tty_pty.c,v 1.38 1996/04/11 18:43:37 bde Exp $ */ *************** *** 536,539 **** } ! if (cc) ! cc -= b_to_q((char *)cp, cc, &tp->t_canq); } --- 536,550 ---- } ! if (cc > 0) { ! cc = b_to_q((char *)cp, cc, &tp->t_canq); ! /* ! * XXX we don't guarantee that the canq size ! * is >= TTYHOG, so the above b_to_q() may ! * leave some bytes uncopied. However, space ! * is guaranteed for the null terminator if ! * we don't fail here since (TTYHOG - 1) is ! * not a multiple of CBSIZE. ! */ ! if (cc > 0) ! break; ! } } *************** *** 576,578 **** * Come here to wait for slave to open, for space ! * in outq, or space in rawq. */ --- 587,589 ---- * Come here to wait for slave to open, for space ! * in outq, or space in rawq, or an empty canq. */