Hi all,
I’ve just released the latest version of Sys/Host, now available on the
RAA.
Synopsis
require "sys/host"
include Sys
puts Host.hostname
puts Host.ip_addr # single nic system
Host.ip_addr{ |ip| puts ip } # multi nic system
Changelog
-
Reentrant (thread-safe) support added for ip_addr() method (for
Linux,
FreeBSD and Solaris currently). -
The file layout changed so that each platform has its own source file.
This was done because different platforms have different
implementations
of gethostbyname_r(), if they have them at all. Some platforms (e.g.
FreeBSD) use a different function altogether. -
The file generic.c is used to create the source if the platform is not
specifically supported (for thread safety), or if gethostbyname_r()
isn’t found. -
The FreeBSD implementation uses getipnodebyname() instead of
gethostbyname(), if possible. According to the man page, it’s thread
safe. -
Modifications to the extconf.rb file based on the above changes.
-
Added a default value of 16 for INET_ADDRSTRLEN.
-
Added a host.txt file (a text version of the docs).
Regards,
Dan