TIOCNOTTY under SCO System V/386

Bill Kennedy bill at ssbn.WLK.COM
Sun Jun 23 00:28:30 AEST 1991


> stockett at jeanluc.UUCP (Jeffrey M. Stockett) writes:
>>I'm trying to port over some code from a BSD machine to SCO System V/386,
>>and I have run into a problem with [TIOCNOTTY]
chip at chinacat.unicom.com (Chip Rosenthal) follows up:
>
>Following code is from Richard Steven's daemon_start() routine.  This
>is all explained in his book `UNIX Network Programming'.  It's a good
>book and Richard is a great guy - I think y'all should buy two or three
>copies.  Sources are on UUNET in (I think) ~/networking/netprog.tar.Z.

I second the motion regarding the book.  It has been invaluable as a
source of examples in various techniques and I have used the material
from netprog.tar.Z.  Buy the book, work with the programs.  You'll know
a lot more about this stuff than you thought you wanted to.

In the daemon_start example there is a subtle trap.  Back in the days of
the kerosene ethernet you could decide, fairly easily, what OS you were
running with a simple #ifdef such as in the example below.  My favorite
for distinguishing between System V and BSD was #ifdef FIONREAD.  That
is no longer enough.  The cross fertilization between the OS' is such that
if you're using Interactive TCP/IP FIONREAD is, indeed, defined.  The
example that Chip posted contains another such puddle.
[ ... example code deleted except for what I'm talking about ... ]

>#ifdef	SIGTSTP		/* BSD */

Sorry, not any more, since Interactive implemented job control you've got
it.  Maybe there's something else that's still BSD unique but not SIGSTP.
[ ... ]

>#else	/* System V */

Possibly equally lethal if the #ifdef isn't 100% kosher.  Richard says clearly
that his examples are for Berkeley and System V and makes no claim to work
with anything else but this is going to break in a hybridized OS.  How come I
know that?  :-)

My point is not to criticize the article or the example but rather to warn
that the technique may be flawed unless your using the same OS' that the
author did.  Since it's all sample and experimental code I just deleted those
pieces that didn't apply in my environment (ISC 3.2.2 with their TCP/IP) and
ditched the #ifdef's that sent me down the wrong chute.
-- 
Bill Kennedy  internet  bill at ssbn.WLK.COM or ssbn!bill at attmail.COM
              uucp      {att,cs.utexas.edu,pyramid!daver}!ssbn.wlk.com!bill



More information about the Comp.unix.sysv386 mailing list