Path: utzoo!utgpu!news-server.csri.toronto.edu!utcs.toronto.edu!cks Newsgroups: comp.unix.ultrix From: cks@hawkwind.utcs.toronto.edu (Chris Siebenmann) Subject: ttys and the POSIXification of Ultrix (Ultrix 4.0, possibly +) Message-ID: <1991Feb25.223042.8566@jarvis.csri.toronto.edu> Summary: avoid -YPOSIX and -Y[SYSTEM_FIVE] Keywords: braindamage Organization: Ziebmef home away from home Date: 26 Feb 91 03:30:42 GMT Lines: 44 /* * A program that illustrates a problem with Ultrix POSIXification * incant: cc -YPOSIX tty-bug.c; stty new; stty; ./a.out /dev/tty; stty * to see the bug. * incant: cc tty-bug.c; stty new; stty; ./a.out /dev/tty; stty * to see the bug go away. * (Note: the bug also occurs if you compile for System V or if you * use ./a.out `tty`.) * * The bug is that whenever a tty is opened by a program is POSIX * or SysV mode, the line discipline on that tty is instantly changed * to termios. This is braindamaged. It also seems to be deliberate; * see tty_def_open() in sys/sys/tty.c. * * Workaround: Never compile a program for POSIX or System V environments, * learn to love termios line discipline, start saying 'stty new' or * 'stty old' after all dubious commands, or never ever point a POSIX * or System V program near a terminal. In particular, don't compile * the 4.3BSD syslogging patches from jtkohl@MIT.EDU (John T Kohl) * with -YPOSIX, or your console line discipline will randomly change * to termios. */ #include #include main(argc, argv) int argc; char **argv; { int fd, i; for (i = 1; i < argc; i++) { fd = open(argv[i], O_WRONLY, 0); if (fd < 0) perror(argv[i]); (void) close(fd); } return 0; } -- "You don't *run* programs on Ultrix." - Mark Moraes "Right, you chase them." - Rayan Zachariassen cks@hawkwind.utcs.toronto.edu ...!{utgpu,utzoo,watmath}!utgpu!cks Brought to you by Super Global Mega Corp .com