From owner-freebsd-questions Tue Mar 19 17:26:49 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id RAA18661 for questions-outgoing; Tue, 19 Mar 1996 17:26:49 -0800 (PST) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id RAA18656 for ; Tue, 19 Mar 1996 17:26:44 -0800 (PST) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id SAA25545; Tue, 19 Mar 1996 18:20:58 -0700 From: Terry Lambert Message-Id: <199603200120.SAA25545@phaeton.artisoft.com> Subject: Re: Question To: oleg@nnk.univers.chernovtsy.ua (Oleg N.Kolesnikov) Date: Tue, 19 Mar 1996 18:20:57 -0700 (MST) Cc: questions@FreeBSD.ORG In-Reply-To: from "Oleg N.Kolesnikov" at Mar 19, 96 11:04:22 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-questions@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > How can I get the state of DCD-bit under FreeBSD using C ? > What function should I use ? You need to look at t_state in the tty struct... man gtty and ignore the fact that it's a legacy interface, since the cross-reference to the ioctl() man page and tty(4) and ioctl(2) doesn't document the TIOCGETP/TIOCSETP (like the stty/gtty man page said it does). You are actually supposed to *not* look at this value; instead, you are supposed to extablish the port as your controlling tty, set -CLOCAL and HUPCL, and trap the SIGHUP's that will be sent to your process on on-to-off DCD transitions. Look at the "tip" and "cu" sources for details. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.