diff options
Diffstat (limited to 'cpukit/libnetworking/libc/gethostname.c')
-rw-r--r-- | cpukit/libnetworking/libc/gethostname.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/cpukit/libnetworking/libc/gethostname.c b/cpukit/libnetworking/libc/gethostname.c new file mode 100644 index 0000000000..39efa2c0fc --- /dev/null +++ b/cpukit/libnetworking/libc/gethostname.c @@ -0,0 +1,28 @@ +/* + * $Id$ + */ + +#if HAVE_CONFIG_H +#include "config.h" +#endif + +/* + * 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); +} |