TIOCGWINSZ on SCO UNIX 3.2

Guy Harris guy at auspex.auspex.com
Wed Dec 5 07:29:48 AEST 1990


>   if (ioctl(0, TIOCGWINSZ, &xwin) == 0)
...

>So far all I get is an errno of 22.

*Sigh* time for another "egrep", 'cuz I sure haven't memorized the UNIX
error numbers:

	auspex% egrep 22 /usr/include/sys/errno.h
	#define EINVAL          22              /* Invalid argument */

OK, there we go.

EINVAL on an "ioctl()" call tends to indicate that the object on which
you did the "ioctl()" doesn't support it.  S5R3-ish systems *tend* not
to support it on anything other than pseudo-ttys; are you doing this on
a pseudo-tty, or on a real terminal (or perhaps on a "virtual terminal"
or whatever the multiscreen thingies on 386 UNIXes are called)?  If not,
you may be stuck.

>This code works fine on many other systems (different include files
>though) such as Sun, HP, IBM RS/6000, DG AViiON, etc.

Most of those systems probably adopted TIOCGWINSZ from BSD; you may also
be using a window system terminal emulator or a remote login on those
systems, in which case you'd probably be on a pseudo-tty.  BSD didn't
restrict TIOCGWINSZ to pseudo-ttys.



More information about the Comp.unix.sysv386 mailing list