[sf-perl] hostid in mac os x?

David Alban extasia at extasia.org
Fri Dec 29 15:17:25 PST 2006


Is there the concept of a host ID in mac os x?  For example, linux'
hostid(1) command returns an eight digit hex number for a host ID.

I see the gethostid system call in mac os x, whose man page says:

     This function has been deprecated.  The hostid should be set or retrieved
     by use of sysctl(3).

I couldn't find a sysctl on the perlfunc page.

I don't want to write a C wrapper for sysctl(3), 'cause I want to do
this with "core perl", or failing that, with a perl system()
invocation to some command that is "core os x".  This is for use in
something I'd like to be "portable" and I'd rather not require other
users install anything.


P.S.  I found Sys::Sysctl::FreeBSD also, but I'd rather find a way to
do this with "core perl" or "core mac os x".

P.S.  I also found sysctl(8), but it seems to indicate kern.hostid =
0, and no other values listed (with -A) seem to be a host ID.
Live in a world of your own, but always welcome visitors.

More information about the SanFrancisco-pm mailing list