1 /*-------------------------------------------------------------------------
4 * gethostname using uname
6 * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
10 * $PostgreSQL: pgsql/src/port/gethostname.c,v 1.8 2006/03/05 15:59:10 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));