Tcl Source Code

View Ticket
Login
Ticket UUID: 1903339
Title: ifdef reduction - USE_FIONBIO
Type: Patch Version: None
Submitter: jenglish Created on: 2008-02-27 19:24:00
Subsystem: 52. Portability Support Assigned To: jenglish
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2008-02-29 03:43:10
Resolution: Fixed Closed By: jenglish
    Closed on: 2008-02-28 20:43:10
Description:
Attached patch consolidates all code conditionalized on -DUSE_FIONBIO into one place, TclUnixSetBlockingMode() in unix/tclUnixCompat.c (new routine).
User Comments: jenglish added on 2008-02-29 03:43:09:
Logged In: YES 
user_id=68433
Originator: YES

Patch committed.

jenglish added on 2008-02-28 03:21:12:
Logged In: YES 
user_id=68433
Originator: YES

Notes: second patch may impact platforms where -DUSE_SGTTY or -DUSE_TERMIO are in effect.  I am unable to test this, because the oldest Unices I have available (AIX 4.1, IRIX 5.3, both circa 1997) already support -DUSE_TERMIOS and fcntl( ... O_NONBLOCK ...).

USE_FIONBIO was first introduced in Tcl 7.6 (1996-10-16), and was enabled only for AIX*, OSF*, SunOS-4*, and ULTRIX-4.*.
The following appears in unix/configure.in starting with Tcl 8.0 (1997-08-13):

    # There used to be code here to use FIONBIO under AIX.  However, it
    # was reported that FIONBIO doesn't work under AIX 3.2.5.  Since
    # using O_NONBLOCK seems fine under AIX 4.*, I removed the FIONBIO
    # code (JO, 5/31/97).

The ULTRIX-4.* branch was removed with this commit:

+2006-01-10  Daniel Steffen  <[email protected]>
+
+* unix/configure:    add caching, use AC_CACHE_CHECK instead of
+* unix/configure.in: AC_CACHE_VAL where possible, consistent message
+* unix/tcl.m4:       quoting, sync relevant tclconfig/tcl.m4 changes and
+gratuitous formatting differences, fix SC_CONFIG_MANPAGES with default
+argument, Darwin improvements to SC_LOAD_*CONFIG.

However, it is still present in core-8-4-branch and Tcl 8.4.18.  

At any rate, in CVS HEAD, USE_FIONBIO is down to OSF* and SunOS-4.*.
File Added: 0003-Remove-inoperative-comment-and-chain-of-undefs.patch

jenglish added on 2008-02-28 03:21:11:

File Added - 268324: 0003-Remove-inoperative-comment-and-chain-of-undefs.patch

jenglish added on 2008-02-28 02:52:35:

File Added - 268317: 0002-Reduce-scope-of-sys-filio.h-and-sys-ioctl.h.patch

Logged In: YES 
user_id=68433
Originator: YES

With that out of the way, the <sys/ioctl.h> and <sys/filio.h> #includes ("for FIONBIO") can be moved out of unix/tclUnixPort.h into unix/tclUnixCompat.c.  

And with *that* out of the way, the comment at the top of unix/tclUnixChan.c:

/*
 * sys/ioctl.h has already been included by tclPort.h. Including termios.h or
 * termio.h causes a bunch of warning messages because some duplicate (but not
 * contradictory) #defines exist in termios.h and/or termio.h
 */

becomes inoperative and can be removed, along with the following chain of #undef's.

(Archaeology: this bit first appeared in the Tcl 8.0 release (1997-08-12); it is not clear on which platform the conflicting #includes were causing a problem.)

sys/ioctl.h is re-#included later on, along with termios.h, in the -DUSE_TERMIOS branch, which is the most common configuration, and there don't seem to be any reports about conflicts recently.
File Added: 0002-Reduce-scope-of-sys-filio.h-and-sys-ioctl.h.patch

jenglish added on 2008-02-28 02:24:00:

File Added - 268310: 0001-ifdef-reduction-USE_FIONBIO.patch

Attachments: