summaryrefslogtreecommitdiffstats
path: root/c/src/exec/libnetworking/libc/gethostname.c
diff options
context:
space:
mode:
Diffstat (limited to 'c/src/exec/libnetworking/libc/gethostname.c')
-rw-r--r--c/src/exec/libnetworking/libc/gethostname.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/c/src/exec/libnetworking/libc/gethostname.c b/c/src/exec/libnetworking/libc/gethostname.c
new file mode 100644
index 0000000000..5b8e85acf9
--- /dev/null
+++ b/c/src/exec/libnetworking/libc/gethostname.c
@@ -0,0 +1,22 @@
+#include "config.h"
+
+/*
+ * Solaris doesn't include the gethostname call by default.
+ */
+#include <sys/utsname.h>
+#include <sys/systeminfo.h>
+
+#include <netdb.h>
+
+/*
+ * PUBLIC: #ifndef HAVE_GETHOSTNAME
+ * PUBLIC: int gethostname __P((char *, int));
+ * PUBLIC: #endif
+ */
+int
+gethostname(host, len)
+ char *host;
+ int len;
+{
+ return (sysinfo(SI_HOSTNAME, host, len) == -1 ? -1 : 0);
+}