From 7fcd32b00519437c0b4343ea21b66f67a6bb0915 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Tue, 3 Dec 2019 14:33:38 +0100 Subject: [PATCH] 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 --- include/posix/unistd.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/posix/unistd.h b/include/posix/unistd.h index b5957c8b0aa..d130ea6228a 100644 --- a/include/posix/unistd.h +++ b/include/posix/unistd.h @@ -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