1 /*-------------------------------------------------------------------------
4 * gethostname using uname
6 * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
10 * $PostgreSQL: pgsql/src/port/gethostname.c,v 1.12 2010/01/02 16:58:13 momjian Exp $
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));