Path: utzoo!attcan!uunet!samsung!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!hplabs!hpfcso!hpfcdc!rer From: rer@hpfcdc.HP.COM (Rob Robason) Newsgroups: comp.sys.hp Subject: Re: Beware of serial port programs run by users Message-ID: <5570372@hpfcdc.HP.COM> Date: 6 Feb 90 06:14:58 GMT References: <235@cmic.UUCP> Organization: HP Ft. Collins, Co. Lines: 50 > The response center considers this a feature. I consider it a bug. You > decide for yourself. > /* use of CSTOP instead of CSTOPB screws a 4-port mux up */ > /* even the ports you're not using!!! */ > /* right */ > RAU_Line_Settings.c_cflag = B2400 | CSTOPB | CREAD | CS8 | PARENB | PARODD > /* wrong */ > RAU_Line_Settings.c_cflag = B2400 | CSTOP | CREAD | CS8 | PARENB | PARODD CSTOP is a flow control character definition (^S, get it: Cntl-STOP) and part of a set of predefined default characters in . It has nothing to do with CSTOPB which is a Control operation to set the number of STOP Bits on characters transmitted, totally unrelated to flow control. In the example you cited above, you obviously made a typographical error and should not expect the application to work. Just out of curiosity, and for fun, I tried to disect what you were REALLY doing, from definitions in termio.h: /* default control chars */ # define CSTOP 023 /* cntl s */ /* Control Modes */ # define CSTOPB 0000200 /* Send two stop bits, else one */ /* Baud Rate Values */ # define _CBAUD 0000037 # define B0 0 /* Hang up */ # define B50 0000001 /* 50 baud */ # define B75 0000002 /* 75 baud */ [middle of sequential list deleted...] # define B38400 0000022 /* 38400 baud */ I note that the 023 value you're tring to impose as a command is, in fact, within the masked value of speed control values but is not even a currently defined speed. I would expect such use to result in unpredictable behavior. You are telling the interface to do something we haven't defined. One could argue that some sort of error checking could be invoked. Such error checking would be costly in terms of performance, and would certainly not be consistent with the typical low-level expectations of ioctl() operations. While we take responsibility for our defects, we can't fix the UNIX* out of UNIX. This is one of those elusive bugs like I see so often with programs that get lost in malloc()/free() operations: it is definitely a coding defect and could have resulted from hundreds of potential typos. *UNIX is a trademark of AT&T in the U.S.A. and in other countries. Rob "blame the inventor" Robason