Newsgroups: comp.lang.perl
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!elroy.jpl.nasa.gov!jpl-devvax!lwall
From: lwall@jpl-devvax.jpl.nasa.gov (Larry Wall)
Subject: Re: ioctl() error msg
Message-ID: <1991May18.001739.11835@jpl-devvax.jpl.nasa.gov>
Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall)
Organization: Jet Propulsion Laboratory, Pasadena, CA
References: <6279@tahoe.unr.edu>
Date: Sat, 18 May 1991 00:17:39 GMT

In article <6279@tahoe.unr.edu> jra@equinox.unr.edu (John Anderson) writes:
: i'm a perl rookie... i've been reading the nutshell book, etc. and am
: attempting some ioctl() stuff and am getting a generic error msg.
: perhaps someone could give me a pointer to more info.
: 
: here's the chunk in question:
: --
: #
: # $r_tty is set to "+</dev/tty1"
: #
: open(TTY_IN, $r_tty) || die "Can't open $r_tty ($!)";
: 
: require 'sys/termio.ph';   # h2ph'ed
: require 'sys/ioctl.ph';
: $termio_t = "SSSSccccccccc"; # template of struct termio <sys/termio.h>
: 
: $foo = ioctl(TTY_IN, &TCGETA, $termio) || die "Can't get termio values: $!";
: --
: error msg:
: Return value overflowed string at hang line 31.
: 
: i'm wondering if $foo is getting overflowed or $termio?!
: line 31 is the ioctl line... i've tried tweaking here and there
: (hard-coding the device in open(), etc.) to no avail, am reading the
: passages that ioctl() is system dependent etc. the system that i'm
: running this on is an IBM rs6000 (aix3.1 - no updates), perl4.003. 
: any help would be appreciated.

You probably need to set $sizeof{'struct termio'}, and make sure the
length of the structure is correctly being encoded in the value
of &TCGETA.  $termio is what is getting overwritten.  Look at do_ctl()
in doio.c for more clues.

Larry
