From owner-freebsd-questions Tue Mar 12 06:27:32 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id GAA17636 for questions-outgoing; Tue, 12 Mar 1996 06:27:32 -0800 (PST) Received: from spoon.beta.com (root@[199.165.180.33]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id GAA17631 for ; Tue, 12 Mar 1996 06:27:27 -0800 (PST) Received: from localhost (mcgovern@localhost [127.0.0.1]) by spoon.beta.com (8.6.12/8.6.9) with SMTP id JAA02030 for ; Tue, 12 Mar 1996 09:03:04 -0500 Message-Id: <199603121403.JAA02030@spoon.beta.com> X-Authentication-Warning: spoon.beta.com: Host localhost didn't use HELO protocol To: questions@freebsd.org Subject: Last of the ioctl questions... Date: Tue, 12 Mar 1996 09:03:03 -0500 From: "Brian J. McGovern" Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Ok. Almost think I got it. Just a couple of more questions. 1.) The two calls - TIOCSTI and TIOCCONS. I can get TIOCSTI to work when I'm root. Is it possible to make it work for a non-root user who has the port open? With TIOCCONS, I've yet been able to make it work, even as root. What conditions must be met for a program to be able to redirect console output? 2.) When opening a tty device for outbound communications (ie - local host is initiating the communication), I call open with O_RDWR | O_NONBLOCK. For inbound, I open it with just O_RDWR. I then call a TIOCEXCL ioctl to "lock" the port so that no one else can open it. I then call TIOCNXCL before the close() to free it. Is this the correct method, or is there a "more correct" method for locking the device. Thanks, as always, Brian