Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!linus!decvax!harpo!seismo!hao!hplabs!sri-unix!dbj@rice
From: dbj%rice@sri-unix.UUCP
Newsgroups: net.unix
Subject: Re:  non-blocking read
Message-ID: <16803@sri-arpa.UUCP>
Date: Thu, 16-Feb-84 21:25:37 EST
Article-I.D.: sri-arpa.16803
Posted: Thu Feb 16 21:25:37 1984
Date-Received: Mon, 20-Feb-84 01:24:41 EST
Lines: 19

From:  Dave Johnson 

        "Dup(0) will give you a new kernel file-structure to play with ..."

WRONG!  Dup(0) will only make another reference to the file structure that
already exists for that file descriptor by incrementing the reference count
in f_count and pointing to it by an element of the array u.u_ofile.  It does
NOT allocate a new "struct file" which is where the file's modes such as
O_NDELAY are kept.  Doing a dup(0) will not help the problem at all.  The
only solution (short of doing something gross to the kernel) is to either
re-open the specific terminal by name (e.g., /dev/tty01) or (better yet)
to open /dev/tty to get the new file structure to set into non-blocking
mode.


                                        Dave Johnson
                                        Dept. of Math Science
                                        Rice University
                                        dbj@rice