Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!mcvax!kth!sunic!dkuug!daimi!glad From: glad@daimi.dk (Michael Glad) Newsgroups: comp.sources.bugs Subject: Re: atty on Sun 3 Message-ID: <2461@daimi.dk> Date: 3 Jun 89 12:34:49 GMT Sender: news@daimi.dk Reply-To: glad@daimi.dk (Michael Glad) Organization: DAIMI: Computer Science Department, Aarhus University, Denmark Lines: 59 I see no need to discuss the compiler flags used in compiling atty on Suns. A few days ago, I compiled atty and tried to run it with the same disappointing result as reported in this news group. I recompiled it using -g and used gdb (the nice GNU debugger) to locate the crash. Atty core dumps because it calls abort. It calls abort because an pty ioctl fails. The ioctl fails because it tries to set terminal modes on the master side of the pty instead of on the slave side. I don't know if that's possible on other systems but it won't work on SunOS 4.0 suns, see the enclosed program: #include #include #include #include /* Michael Glad, glad@daimi.dk, 1989-06-03 */ main(argc,argv) int argc; char **argv; { int s; struct termios t; /* Too lazy to search for a pty, let's hope this one is free */ /* Change it if not configured in your kernel */ if((s=open("/dev/ptyr0",O_RDONLY))<0) { perror("couldn't open pty"); exit(1); } if(ioctl(s,TCGETS,(char*)&t)<0) { perror("ioctl failed"); exit(1); } close(s); exit(0); } When compiled using gcc or cc it produces the reported error message: "Inappropriate ioctl for device". I think atty needs patches for Sun's. I'm not going to do anything about it as I'm very satisfied with the command editing facilities in tcsh (a patched csh). /Michael Glad glad@daimi.dk