xref: /csrg-svn/lib/libc/compat-43/sethostid.c (revision 60986)
158947Smckusick /*
2*60986Sbostic  * Copyright (c) 1989, 1993
3*60986Sbostic  *	The Regents of the University of California.  All rights reserved.
458947Smckusick  *
558947Smckusick  * %sccs.include.redist.c%
658947Smckusick  */
758947Smckusick 
858947Smckusick #if defined(LIBC_SCCS) && !defined(lint)
9*60986Sbostic static char sccsid[] = "@(#)sethostid.c	8.1 (Berkeley) 06/02/93";
1058947Smckusick #endif /* LIBC_SCCS and not lint */
1158947Smckusick 
1258947Smckusick #include <sys/param.h>
1358947Smckusick #include <sys/sysctl.h>
1458947Smckusick 
1558947Smckusick #if __STDC__
1658947Smckusick long
sethostid(long hostid)1758947Smckusick sethostid(long hostid)
1858947Smckusick #else
1958947Smckusick long
2058947Smckusick sethostid(hostid)
2158947Smckusick 	long hostid;
2258947Smckusick #endif
2358947Smckusick {
2458947Smckusick 	int mib[2];
2558947Smckusick 
2658947Smckusick 	mib[0] = CTL_KERN;
2758947Smckusick 	mib[1] = KERN_HOSTID;
2858947Smckusick 	if (sysctl(mib, 2, NULL, NULL, &hostid, sizeof hostid) == -1)
2958947Smckusick 		return (-1);
3058947Smckusick 	return (0);
3158947Smckusick }
32