ioctl TIOCSTI question

Paul Falstad pfalstad at phoenix.Princeton.EDU
Wed Mar 13 14:12:00 AEST 1991


sono!mayer at sun.com (Ronald &) wrote:
>On a sparcstation, SunOS 4.1 I am having a problem using the termio
>ioctl TIOCSTI [simulate terminal input] when using gcc.  While it
>works as expected under cc, under gcc I get an "Inappropriate ioctl
>for device" error message.  Any ideas what I'm missing?
>/* This program works differently under gcc and cc. Why? */

> ioctl_return = ioctl(fd,TIOCSTI,&a);

Most ioctl's have this problem with ANSI C compilers.  The offending code
is stuff like this in <sys/ioccom.h>:

#define  _IOW(x,y,t) (_IOC_IN|((sizeof(t)&_IOCPARM_MASK)<<16)|('x'<<8)|y)
#define  TIOCSTI     _IOW(t, 114, char)   /* simulate terminal input */

Putting a macro argument in single quotes is non-ANSI.  The solution is
to run the fixincludes script that comes with gcc.  (Note that I
erroneously called this problem a bug in gcc in the zsh documentation.)

--
pfalstad at phoenix.princeton.edu   The Germans are disputing it! Hegel is
arguing that the reality is merely an a priori adjunct of non-absolutistic
ethics; Kant, by the categorical imperative, is holding it ontologically
exists only in the imagination; and Marx is claiming it was off sides.



More information about the Comp.unix.questions mailing list