posix: net: move static inline gethostname() to lib definition
static inline gethostname() in unistd.h can cause declaration collisions. we should just move it to a normal function definition like the rest of the network functions. Signed-off-by: Nicholas Lowell <Nicholas.Lowell@lexmark.com>
This commit is contained in:
parent
d6edc75699
commit
e60070d91b
2 changed files with 7 additions and 9 deletions
|
@ -11,11 +11,6 @@
|
|||
#ifdef CONFIG_POSIX_API
|
||||
#include <zephyr/fs/fs.h>
|
||||
#endif
|
||||
#ifdef CONFIG_NETWORKING
|
||||
/* For zsock_gethostname() */
|
||||
#include <zephyr/net/socket.h>
|
||||
#include <zephyr/net/hostname.h>
|
||||
#endif
|
||||
#include <zephyr/posix/sys/confstr.h>
|
||||
#include <zephyr/posix/sys/stat.h>
|
||||
#include <zephyr/posix/sys/sysconf.h>
|
||||
|
@ -49,10 +44,7 @@ int rmdir(const char *path);
|
|||
FUNC_NORETURN void _exit(int status);
|
||||
|
||||
#ifdef CONFIG_NETWORKING
|
||||
static inline int gethostname(char *buf, size_t len)
|
||||
{
|
||||
return zsock_gethostname(buf, len);
|
||||
}
|
||||
int gethostname(char *buf, size_t len);
|
||||
#endif /* CONFIG_NETWORKING */
|
||||
|
||||
#endif /* CONFIG_POSIX_API */
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include <zephyr/net/net_if.h>
|
||||
#include <zephyr/net/socket.h>
|
||||
#include <zephyr/posix/arpa/inet.h>
|
||||
#include <zephyr/posix/netinet/in.h>
|
||||
#include <zephyr/posix/net/if.h>
|
||||
|
@ -216,6 +217,11 @@ struct hostent *gethostent(void)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int gethostname(char *buf, size_t len)
|
||||
{
|
||||
return zsock_gethostname(buf, len);
|
||||
}
|
||||
|
||||
int getnameinfo(const struct sockaddr *addr, socklen_t addrlen, char *host, socklen_t hostlen,
|
||||
char *serv, socklen_t servlen, int flags)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue