summaryrefslogtreecommitdiff
path: root/mit-pthreads/net/gethostname.c
blob: 8bec0793296e1b61a8c050a2d9867ba50bb423e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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