1 /* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 */ 7 8 #if defined(LIBC_SCCS) && !defined(lint) 9 static char sccsid[] = "@(#)sethostid.c 8.1 (Berkeley) 06/02/93"; 10 #endif /* LIBC_SCCS and not lint */ 11 12 #include <sys/param.h> 13 #include <sys/sysctl.h> 14 15 #if __STDC__ 16 long 17 sethostid(long hostid) 18 #else 19 long 20 sethostid(hostid) 21 long hostid; 22 #endif 23 { 24 int mib[2]; 25 26 mib[0] = CTL_KERN; 27 mib[1] = KERN_HOSTID; 28 if (sysctl(mib, 2, NULL, NULL, &hostid, sizeof hostid) == -1) 29 return (-1); 30 return (0); 31 } 32