Article View: gnu.gcc.bug
Article #448Re: Possible ioctl bug?
From: S. Mujica
Date: Mon, 10 Jul 1989 20:27
Date: Mon, 10 Jul 1989 20:27
68 lines
2732 bytes
2732 bytes
on 9 Jul 89 22:33:18 GMT,
dwho@nmtsun.nmt.edu (David Olix) said:
> Path: ucla-cs!usc!cs.utexas.edu!uunet!deimos.cis.ksu.edu!unmvax!nmtsun!dwho
> Lines: 29
> Compiler: gcc 1.35
> Machine: VAX 11/750
> OS: Unix 4.3 BSD
> Problem: ioctl function call returns error
> Program: test.c
> #include <sys/ioctl.h>
> struct sgttyb arg;
> void main()
> {
> if (ioctl(0, TIOCGETP, &arg) < 0)
> perror("ioctl");
> }
> Compiled with:
> gcc -g -o test test.c
> Output:
> ioctl: Inappropriate ioctl for device
> I don't know if this a problem with gcc or what, but when I compile the
> same program using cc, there is no output (as expected). Any help would
> be useful. Please respond via e-mail
> TIA,
> --David Olix (dwho@nmtsun.nmt.edu)
The following is in the node (gcc)Installation node of the gcc Info
files ( I have installed gcc with the fixed include files, and your
test program seems to work ok, SunOS 4.0, SUN 3/280, gcc 1.35):
*Warning: the GNU CPP may not work for `ioctl.h', `ttychars.h'
and other system header files unless the `-traditional' option
is used.* The bug is in the header files: at least on some
machines, they rely on behavior that is incompatible with ANSI
C. This behavior consists of substituting for macro argument
names when they appear inside of character constants. The
`-traditional' option tells GNU CC to behave the way these
headers expect.
Because of this problem, you might prefer to configure GNU CC to
use the system's own C preprocessor. To do so, make the file
`/usr/local/lib/gcc-cpp' a link to `/lib/cpp'.
Alternatively, on Sun systems and 4.3BSD at least, you can
correct the include files by running the shell script
`fixincludes'. This installs modified, corrected copies of the
files `ioctl.h', `ttychars.h' and many others, in a special
directory where only GNU CC will normally look for them. This
script will work on various systems because it choose the files
by searching all the system headers for the problem cases that
we know about.
Sergio Mujica mujica@cs.ucla.edu
Computer Science Department, UCLA
Technical Details
Message-ID:
<MUJICA.89Jul10132739@ra.cs.ucla.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!elroy.jpl.nasa.gov!ucla-cs!cs.ucla.edu!mujicaReferences:
<2835@nmtsun.nmt.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!elroy.jpl.nasa.gov!ucla-cs!cs.ucla.edu!mujica From: mujica@ra.cs.ucla.edu (S. Mujica) Newsgroups: gnu.gcc.bug Subject: Re: Possible ioctl bug? Message-ID: <MUJICA.89Jul10132739@ra.cs.ucla.edu> Date: 10 Jul 89 20:27:39 GMT References: <2835@nmtsun.nmt.edu> Sender: news@CS.UCLA.EDU Organization: Computer Science Department, UCLA Lines: 68 In-reply-to: dwho@nmtsun.nmt.edu's message of 9 Jul 89 22:33:18 GMT