summaryrefslogtreecommitdiff
path: root/mit-pthreads/net/gethostname.c
diff options
context:
space:
mode:
Diffstat (limited to 'mit-pthreads/net/gethostname.c')
-rw-r--r--mit-pthreads/net/gethostname.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/mit-pthreads/net/gethostname.c b/mit-pthreads/net/gethostname.c
new file mode 100644
index 00000000000..8bec0793296
--- /dev/null
+++ b/mit-pthreads/net/gethostname.c
@@ -0,0 +1,22 @@
+/* Copyright Abandoned 2000 TCX DataKonsult AB & Monty Program KB & Detron HB
+ This file is public domain and comes with NO WARRANTY of any kind */
+
+#include "config.h"
+#include <pthread.h>
+#include <sys/utsname.h>
+
+#ifdef HAVE_SYSCALL_UNAME
+int gethostname(char *name, int len)
+{
+ int ret;
+ struct utsname buf;
+
+ if ((ret = machdep_sys_chroot(&buf)) < OK)
+ {
+ SET_ERRNO(-ret);
+ }
+ else
+ strncpy(name,uname->sysname, len);
+ return(ret);
+}
+#endif