Skip to content

Commit 0a6e579

Browse files
committed
Revert "posix: net: move static inline gethostname() to lib definition"
This reverts commit e60070d. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
1 parent a649b31 commit 0a6e579

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

include/zephyr/posix/unistd.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
#ifdef CONFIG_POSIX_API
1212
#include <zephyr/fs/fs.h>
1313
#endif
14+
#ifdef CONFIG_NETWORKING
15+
/* For zsock_gethostname() */
16+
#include <zephyr/net/socket.h>
17+
#include <zephyr/net/hostname.h>
18+
#endif
1419
#include <zephyr/posix/sys/confstr.h>
1520
#include <zephyr/posix/sys/stat.h>
1621
#include <zephyr/posix/sys/sysconf.h>
@@ -44,7 +49,10 @@ int rmdir(const char *path);
4449
FUNC_NORETURN void _exit(int status);
4550

4651
#ifdef CONFIG_NETWORKING
47-
int gethostname(char *buf, size_t len);
52+
static inline int gethostname(char *buf, size_t len)
53+
{
54+
return zsock_gethostname(buf, len);
55+
}
4856
#endif /* CONFIG_NETWORKING */
4957

5058
#endif /* CONFIG_POSIX_API */

lib/posix/options/net.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include <stdlib.h>
1111

1212
#include <zephyr/net/net_if.h>
13-
#include <zephyr/net/socket.h>
1413
#include <zephyr/posix/arpa/inet.h>
1514
#include <zephyr/posix/netinet/in.h>
1615
#include <zephyr/posix/net/if.h>
@@ -217,11 +216,6 @@ struct hostent *gethostent(void)
217216
return NULL;
218217
}
219218

220-
int gethostname(char *buf, size_t len)
221-
{
222-
return zsock_gethostname(buf, len);
223-
}
224-
225219
int getnameinfo(const struct sockaddr *addr, socklen_t addrlen, char *host, socklen_t hostlen,
226220
char *serv, socklen_t servlen, int flags)
227221
{

0 commit comments

Comments
 (0)