Date: Mon, 21 Jun 1999 11:10:02 -0700 (PDT) From: Sheldon Hearn <sheldonh@uunet.co.za> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/12311: Sys::Hostname.pm hangs forever Message-ID: <199906211810.LAA91323@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/12311; it has been noted by GNATS. From: Sheldon Hearn <sheldonh@uunet.co.za> To: Garrett Wollman <wollman@khavrinen.lcs.mit.edu> Cc: freebsd-gnats-submit@FreeBSD.ORG Subject: Re: bin/12311: Sys::Hostname.pm hangs forever Date: Mon, 21 Jun 1999 20:05:14 +0200 Hi Garrett, I'm not sure how that "require FreeBSD" is supposed to work, but I came up with the diff below. The only problem is that unistd.ph isn't declaring SYS_gethostname as expected. Any idea what's wrong? Ciao, Sheldon. Index: Hostname.pm =================================================================== RCS file: /home/ncvs/src/contrib/perl5/lib/Sys/Hostname.pm,v retrieving revision 1.1.1.1 diff -u -d -r1.1.1.1 Hostname.pm --- Hostname.pm 1998/09/09 06:59:55 1.1.1.1 +++ Hostname.pm 1999/06/21 18:02:54 @@ -60,6 +60,14 @@ Carp::croak "Cannot get host name of local machine"; } + elsif ($^O eq 'freebsd') { + require "unistd.ph"; + require "sys/param.ph"; + require "sys/syscall.ph"; + $host = "\0" x MAXHOSTNAMELEN; + syscall(&main::SYS_gethostname, $host, length($host)); + $host; + } elsif ($^O eq 'MSWin32') { ($host) = gethostbyname('localhost'); chomp($host = `hostname 2> NUL`) unless defined $host; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199906211810.LAA91323>