1 /*-------------------------------------------------------------------------
4 * gethostname using uname
6 * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
12 *-------------------------------------------------------------------------
17 #include <sys/utsname.h>
20 gethostname(char *name
, int namelen
)
22 static struct utsname mname
;
23 static int called
= 0;
30 strncpy(name
, mname
.nodename
, (SYS_NMLN
< namelen
? SYS_NMLN
: namelen
));