From owner-freebsd-bugs@FreeBSD.ORG Mon Mar 21 15:40:02 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A1AE11065673 for ; Mon, 21 Mar 2011 15:40:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 602428FC1B for ; Mon, 21 Mar 2011 15:40:02 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p2LFe2gx036732 for ; Mon, 21 Mar 2011 15:40:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p2LFe2wW036731; Mon, 21 Mar 2011 15:40:02 GMT (envelope-from gnats) Resent-Date: Mon, 21 Mar 2011 15:40:02 GMT Resent-Message-Id: <201103211540.p2LFe2wW036731@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Poul-Henning Kamp Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67A6F106566C for ; Mon, 21 Mar 2011 15:31:43 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 2E2F08FC1F for ; Mon, 21 Mar 2011 15:31:42 +0000 (UTC) Received: from critter.freebsd.dk (critter.freebsd.dk [192.168.61.3]) by phk.freebsd.dk (Postfix) with ESMTP id DF3AA5DF8 for ; Mon, 21 Mar 2011 15:15:08 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.14.4/8.14.4) with ESMTP id p2LFF874027068 for ; Mon, 21 Mar 2011 15:15:08 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.14.4/8.14.4/Submit) id p2LFF8Ca027067; Mon, 21 Mar 2011 15:15:08 GMT (envelope-from phk) Message-Id: <201103211515.p2LFF8Ca027067@critter.freebsd.dk> Date: Mon, 21 Mar 2011 15:15:08 GMT From: Poul-Henning Kamp To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: kern/155752: tcdrain(3) does not work with uart(4) driver X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Poul-Henning Kamp List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Mar 2011 15:40:02 -0000 >Number: 155752 >Category: kern >Synopsis: tcdrain(3) does not work with uart(4) driver >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Mar 21 15:40:01 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Poul-Henning Kamp >Release: FreeBSD 9.0-CURRENT amd64 >Organization: >Environment: System: FreeBSD critter.freebsd.dk 9.0-CURRENT FreeBSD 9.0-CURRENT #0 r218760M: Thu Feb 17 06:36:02 UTC 2011 root@critter.freebsd.dk:/usr/obj/freebsd/head/sys/CRITTER amd64 Also affected: FreeBSD 8.1-RELEASE >Description: With the change from sio(4) to uart(4), tcdrain(3) broke. Now tcdrain(3) only tests if the characters have been delivered to the uart(4) subdriver, it does not wait for them to have actually been sent on the wire. This prevents half-duplex communications with CTS/RTS from working. This contradicts both our own manpage and The Open Group Standards. >How-To-Repeat: #define AZ(x) assert ((x) == 0) int j, fd; fd = open(), makeraw() etc. set speed 300BPS j = TIOCM_RTS; AZ(ioctl(fd, TIOCMBIS, &j)); assert(3 == write(fd, "FOO", 3)) AZ(tcdrain(fd)); AZ(ioctl(fd, TIOCMBIC, &j)); Observe that RTS flips high + low, long before the three characters make it out through the TXD pin. >Fix: There don't seem to be a newbus uart(4) method to ask or wait until all transmitted characters have been sent. One is obviously necessary. >Release-Note: >Audit-Trail: >Unformatted: