Skip to content
Browse files

posix: unistd.h: Add gethostname()

Per POSIX, gethostname() is declared in unistd.h.

Signed-off-by: Paul Sokolovsky <>
  • Loading branch information...
pfalcon authored and galak committed Feb 21, 2019
1 parent a614a02 commit 6631e7c6a976727c38b4e23607fb8062887b2fd9
Showing with 11 additions and 0 deletions.
  1. +11 −0 include/posix/unistd.h
@@ -12,6 +12,10 @@ extern "C" {

#include "posix_types.h"
#include "sys/stat.h"
/* For zsock_gethostname() */
#include "net/socket.h"

#include <fs.h>
@@ -33,6 +37,13 @@ extern int mkdir(const char *path, mode_t mode);
unsigned sleep(unsigned int seconds);
int usleep(useconds_t useconds);

static inline int gethostname(char *buf, size_t len)
return zsock_gethostname(buf, len);

#ifdef __cplusplus

0 comments on commit 6631e7c

Please sign in to comment.
You can’t perform that action at this time.