Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions include/posix/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ extern "C" {

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

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

#ifdef CONFIG_NETWORKING
static inline int gethostname(char *buf, size_t len)
{
return zsock_gethostname(buf, len);
}
#endif

#ifdef __cplusplus
}
#endif
Expand Down