/* * Copyright (c) 1989 The Regents of the University of California. * All rights reserved. * * %sccs.include.redist.c% */ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)gethostid.c 5.2 (Berkeley) 05/24/93"; #endif /* LIBC_SCCS and not lint */ #include #include #if __STDC__ long gethostid(void) #else long gethostid() #endif { int mib[2]; size_t size; long value; mib[0] = CTL_KERN; mib[1] = KERN_HOSTID; size = sizeof value; if (sysctl(mib, 2, &value, &size, NULL, 0) == -1) return (-1); return (value); }