Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!execu!sequoia!balkan!wrangler!ssbn!bill From: bill@ssbn.WLK.COM (Bill Kennedy) Newsgroups: comp.unix.sysv386 Subject: Re: TIOCNOTTY under SCO System V/386 Keywords: TIOCNOTTY Message-ID: <2086@ssbn.WLK.COM> Date: 22 Jun 91 14:28:30 GMT References: <54@jeanluc.UUCP> <1991Jun21.171242.15171@chinacat.unicom.com> Reply-To: bill@ssbn.WLK.COM (Bill Kennedy) Distribution: na Organization: W.L. Kennedy Jr. and Associates, Pipe Creek, TX Lines: 45 > stockett@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@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@ssbn.WLK.COM or ssbn!bill@attmail.COM uucp {att,cs.utexas.edu,pyramid!daver}!ssbn.wlk.com!bill