Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!convex!usenet From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.lang.perl Subject: Re: can't get ioctl value Keywords: close but still no cigar Message-ID: <1991May20.190235.16387@convex.com> Date: 20 May 91 19:02:35 GMT References: <1991May15.003413.22693@csl.dl.nec.com> <1991May20.162515.24759@csl.dl.nec.com> Sender: usenet@convex.com (news access account) Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 46 Nntp-Posting-Host: pixel.convex.com From the keyboard of harrison@csl.dl.nec.com (Mark Harrison): :Following up to my own article, I am coming closer to figuring out :why my ioctl's are not working. It seems that I am not getting a :definition of struct something, or of &int. :Any suggestions? Did I leave out a step somewhere to the the :definitions of struct and &int? yes: you should first of all have %sizeof defined, so that $sizeof{'int'} = 4; # or whatever $sizeof{'struct winsize'} = 8; # or whatever There are some old tools I once wrote in the src/perl/h2pl directory that can serve as a starting point for this. :These lines are from /usr/local/lib/perl/sys/ttycom.ph: :> eval 'sub TIOCGWINSZ { &_IOR("t", 104, struct winsize);}'; should be eval 'sub TIOCGWINSZ { &_IOR("t", 104, \'struct winsize\');}'; :> eval 'sub TIOCSCTTY { &_IO("t", 132);}'; :> eval 'sub TIOCGPGRP { &_IOR("t", 119, \'int\');}'; :#!/usr/local/bin/perl :require "sys/ioctl.ph"; :require "sys/ioccom.ph"; :require "sys/ttycom.ph"; :defined(&TIOCSCTTY)=1 :value is :536900740: : :defined(&TIOCGWINSZ)=1 :value is :: : :defined(&TIOCGPGRP)=1 :Undefined subroutine "main'int" called at (eval) line 1. You really ought to check $@ after calling these. I would bet that you've got other evals blowing up in there. --tom -- Tom Christiansen tchrist@convex.com convex!tchrist "So much mail, so little time."