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>
diff --git a/include/posix/unistd.h b/include/posix/unistd.h
index b5957c8..d130ea6 100644
--- a/include/posix/unistd.h
+++ b/include/posix/unistd.h
@@ -31,10 +31,6 @@
 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 @@
 }
 #endif
 
+#endif
+
+unsigned sleep(unsigned int seconds);
+int usleep(useconds_t useconds);
+
 #ifdef __cplusplus
 }
 #endif