non-blocking read

dbj%rice at sri-unix.UUCP dbj%rice at sri-unix.UUCP
Fri Feb 17 12:25:37 AEST 1984


From:  Dave Johnson <dbj at rice>

        "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 at rice



More information about the Comp.unix mailing list