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