diff --git a/lib/des/gethostid.c b/lib/des/gethostid.c new file mode 100644 index 000000000..c6c68979b --- /dev/null +++ b/lib/des/gethostid.c @@ -0,0 +1,31 @@ +/* + * + * Some systems doesn't have gethostid(2) (e.g Solaris if you don't + * link with libucb - and we don't want that... + * + * $Id$ + * + */ + + +#include "config.h" + +#ifndef HAVE_GETHOSTID + +#include +#include + +long gethostid(void) +{ + static int flag=0; + static long hostid; + if(!flag){ + char s[32]; + sysinfo(SI_HW_SERIAL, s, 32); + sscanf(s, "%u", &hostid); + flag=1; + } + return hostid; +} + +#endif