net: sockets: Fix gethostname socket.h/unistd.h clash

This commit fixes an issue observed with SimpleLink sockets with
multiple definitions of `gethostname` function. So far, the definition
within `socket.h` was not visible when offloading was enabled.

As this is no longer the case, and SimpleLink partially uses POSIX
subsystem, builds for this platform resulted in compilation error.

The issue was fixed by moving `gethostname` declaration in unistd.h
inside the `#ifdef CONFIG_POSIX_API` block.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2019-12-03 14:33:38 +01:00 committed by Anas Nashif
commit 7fcd32b005

View file

@ -31,10 +31,6 @@ extern int rename(const char *old, const char *newp);
extern int unlink(const char *path);
extern int stat(const char *path, struct stat *buf);
extern int mkdir(const char *path, mode_t mode);
#endif
unsigned sleep(unsigned int seconds);
int usleep(useconds_t useconds);
#ifdef CONFIG_NETWORKING
static inline int gethostname(char *buf, size_t len)
@ -43,6 +39,11 @@ static inline int gethostname(char *buf, size_t len)
}
#endif
#endif
unsigned sleep(unsigned int seconds);
int usleep(useconds_t useconds);
#ifdef __cplusplus
}
#endif