olson@modular.UUCP (Jon Olson) (04/17/88)
Does anyone know anything about the TIOCUCNTL mode for Unix pty ports? I have an application using pty ports that requires hooks into ioctl calls made by the slave process on a pty port to emulate certain terminal functions such as baud-rate changes and modem control on remote RS232 ports. I have searched through unix doc's and find nothing about what this mode is for, yet it exists in <sys/ioctl.h>. The comments about it say "set/clr user controller mode". -- Jon Olson, Modular Mining Systems USENET: {ihnp4,allegra,cmcl2,hao!noao}!arizona!modular!olson INTERNET: modular!olson@arizona.edu
gwyn@brl-smoke.ARPA (Doug Gwyn ) (04/17/88)
In article <576@modular.UUCP> olson@modular.UUCP (Jon Olson) writes: >Does anyone know anything about the TIOCUCNTL mode for Unix pty ports? ioctl(fd, TIOCUCNTL, &flag) enables (if flag nonzero) or disables (if flag zero) the transmission of ioctl information through a pty. Unfortunately only one byte of ioctl information can be transmitted per ioctl. The main use of TIOCUCNTL is for user-mode terminal multiplexing, as in the "mpx" utility that supports AT&T Teletype 5620 or 630 dot-mapped display terminals in their "layers" mode of operation. It is the analogue of JSMPX in the "xt" kernel-multiplexing version.
muller@sdcc7.ucsd.EDU (Keith Muller) (04/18/88)
On 4.3 BSD this changes the reads on the master side pty to always be preceeded by a extra byte. If the first byte on a read is a 0, then the rest of the data is the result of a write on the slave side. A nonzero first byte is the user ioctl sent. For example here are two ioctls for this mode. WHen a slave side process does a ioctl(0, JBOOT, 0) the master side on a read will see (JBOOT&0xff) as the first byte. JMPX is a special case and is not passed through, it is used to detect is a psuedo port is in the TIOCUCNTL mode. #define JBOOT _IO(u, 1) #define JMPX _IO(u, 0) Watch out though, sun for example has decided to use this mode for its on purposes and it it does not work this way. Keith Muller University of California muller@ucsd.edu
mike@turing.UNM.EDU (Michael I. Bushnell) (04/20/88)
In article <576@modular.UUCP> olson@modular.UUCP (Jon Olson) writes: >Does anyone know anything about the TIOCUCNTL mode for Unix pty ports? Take a look at pty(4). It quite clearly describes the function of TIOCUCNTL. (On 4.3BSD, at least.) N u m q u a m G l o r i a D e o Michael I. Bushnell HASA - "A" division 14308 Skyline Rd NE Computer Science Dept. Albuquerque, NM 87123 OR Farris Engineering Ctr. OR University of New Mexico mike@turing.unm.edu Albuquerque, NM 87131 {ucbvax,gatech}!unmvax!turing.unm.edu!mike
mouse@mcgill-vision.UUCP (der Mouse) (04/26/88)
In article <1013@sdcc7.ucsd.EDU>, muller@sdcc7.ucsd.EDU (Keith Muller) writes: > [explanation of TIOCUCNTL mode] > #define JBOOT _IO(u, 1) > #define JMPX _IO(u, 0) Do it right: #define JBOOT UIOCCMD(1) #define JMPX UIOCCMD(0) The original questioner didn't specify what system this was for. The definition for UIOCCMD exists on 4.3. It doesn't exist in our current (3.5) Sun <sys/ioctl.h>, even though TIOCUCNTL does; can someone at Sun explain why this is? (It's not the only 4.3 feature that's only half implemented; the fd_set type for select is in the same state. The typedef is present but the FD_ZERO, FD_SET, FD_CLR, FD_ISSET macros are missing. Is it too much to ask for them to either do it or not do it, but not halfway? (Apparently so.) grumble grumble....) Anyway, I'd recommend not using TIOCUCNTL on a Sun, because it appears to be different from the 4.3 version (no UIOCCMD), and pty(4) doesn't document it at all, so there's no reason to believe it will do anything useful. For all I can tell, it may do a complete reformat of the disk. der Mouse uucp: mouse@mcgill-vision.uucp arpa: mouse@larry.mcrcim.mcgill.edu
muller@sdcc7.ucsd.EDU (Keith Muller) (04/27/88)
Several vendors support TIOCUCNTL, but do not define UIOCMD in ioctl.h which is why #define JBOOT _IO(u, 1) etc was suggested over UIOCMD, there is no "rightness" here. As for sun, TIOCUCNTL does nothing as ptyioctl() in tty_pty.c does not have any support for it. Almost all of the semantics of TIOCUCNTL is performed by the TIOCTCNTL ioctl on the sun. There is one major difference: TIOCTCNTL only passes some of the 't' ioctls through and not the user defined 'u' ioctls. (The 't' ioctls alter the slave side and they also appear as the first byte on the master side with TIOCTCNTL. TIOCUCNTL just passes through to the master side without no changes to the slave side). I have patches for tty_pty.c on suns that allow both TIOCUCNTL and TIOCTCNTL to work. Keith Muller University of California
chris@mimsy.UUCP (Chris Torek) (04/27/88)
In article <1019@sdcc7.ucsd.EDU> muller@sdcc7.ucsd.EDU (Keith Muller) writes: >Several vendors support TIOCUCNTL, but do not define UIOCMD in ioctl.h which >is why #define JBOOT _IO(u, 1) etc was suggested over UIOCMD, there is no >"rightness" here. Actually, there is; _IO is an internal macro and its first argument might change, so UIOCCMD is right and _IO is wrong. (If you do not believe _IO's first argument might change, think again. It already did! UIOCCMD is now defined as _IO('u', n).) -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris