J
John W. Krahn
$ perl -v
This is perl, v5.6.0 built for i586-linux
Copyright 1987-2000, Larry Wall
(Yes I know. [My current machine is in the shop so I am stuck with this
old thing.])
I did an strace of ifconfig:
strace /sbin/ifconfig eth0
[ SNIP ]
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 6
[ SNIP ]
ioctl(6, SIOCGIFADDR, 0xbffff4ec) = 0
ioctl(6, SIOCGIFDSTADDR, 0xbffff4ec) = 0
ioctl(6, SIOCGIFBRDADDR, 0xbffff4ec) = 0
ioctl(6, SIOCGIFNETMASK, 0xbffff4ec) = 0
And I thought that this would be easy enough to do in Perl:
$ perl -le'
use Socket qw/PF_INET SOCK_DGRAM/;
require "linux/ioctl.ph";
my $proto = getprotobyname "ip";
socket SOCKET, PF_INET, SOCK_DGRAM, $proto or die "socket: $!";
defined( ioctl SOCKET, SIOCGIFADDR, my $address ) or die "ioctl: $!";
'
ioctl: No such device at -e line 6.
Is this just broken on 5.6.0 or does it work anywhere?
John
This is perl, v5.6.0 built for i586-linux
Copyright 1987-2000, Larry Wall
(Yes I know. [My current machine is in the shop so I am stuck with this
old thing.])
I did an strace of ifconfig:
strace /sbin/ifconfig eth0
[ SNIP ]
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 6
[ SNIP ]
ioctl(6, SIOCGIFADDR, 0xbffff4ec) = 0
ioctl(6, SIOCGIFDSTADDR, 0xbffff4ec) = 0
ioctl(6, SIOCGIFBRDADDR, 0xbffff4ec) = 0
ioctl(6, SIOCGIFNETMASK, 0xbffff4ec) = 0
And I thought that this would be easy enough to do in Perl:
$ perl -le'
use Socket qw/PF_INET SOCK_DGRAM/;
require "linux/ioctl.ph";
my $proto = getprotobyname "ip";
socket SOCKET, PF_INET, SOCK_DGRAM, $proto or die "socket: $!";
defined( ioctl SOCKET, SIOCGIFADDR, my $address ) or die "ioctl: $!";
'
ioctl: No such device at -e line 6.
Is this just broken on 5.6.0 or does it work anywhere?
John