mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
Merge 61fe6aee44 into d76c2a3efe
This commit is contained in:
commit
ca687cdbe4
5 changed files with 35 additions and 9 deletions
|
|
@ -28,9 +28,15 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
|
||||
#if !defined(CONFIG_BUILD_FLAT) && defined(__KERNEL__)
|
||||
# include <nuttx/kmalloc.h>
|
||||
#else
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
#ifdef CONFIG_FILE_STREAM
|
||||
# include <nuttx/fs/fs.h>
|
||||
#endif
|
||||
#include <stdbool.h>
|
||||
#include <limits.h>
|
||||
#include <alloca.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -211,6 +211,7 @@ struct lib_rawoutstream_s
|
|||
int fd;
|
||||
};
|
||||
|
||||
#ifndef CONFIG_DISABLE_MOUNTPOINT
|
||||
struct lib_fileinstream_s
|
||||
{
|
||||
struct lib_instream_s common;
|
||||
|
|
@ -222,6 +223,7 @@ struct lib_fileoutstream_s
|
|||
struct lib_outstream_s common;
|
||||
struct file file;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct lib_rawsistream_s
|
||||
{
|
||||
|
|
@ -428,12 +430,14 @@ void lib_stdsostream(FAR struct lib_stdsostream_s *stream,
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_DISABLE_MOUNTPOINT
|
||||
int lib_fileinstream_open(FAR struct lib_fileinstream_s *stream,
|
||||
FAR const char *path, int oflag, mode_t mode);
|
||||
void lib_fileinstream_close(FAR struct lib_fileinstream_s *stream);
|
||||
int lib_fileoutstream_open(FAR struct lib_fileoutstream_s *stream,
|
||||
FAR const char *path, int oflag, mode_t mode);
|
||||
void lib_fileoutstream_close(FAR struct lib_fileoutstream_s *stream);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lib_rawinstream, lib_rawoutstream, lib_rawsistream, and
|
||||
|
|
|
|||
|
|
@ -30,9 +30,15 @@
|
|||
#include <string.h>
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <nuttx/net/loopback.h>
|
||||
#include <netpacket/rpmsg.h>
|
||||
#include <netpacket/vm_sockets.h>
|
||||
#ifdef CONFIG_NET_LOOPBACK
|
||||
# include <nuttx/net/loopback.h>
|
||||
#endif
|
||||
#ifdef CONFIG_NET_RPMSG
|
||||
# include <netpacket/rpmsg.h>
|
||||
#endif
|
||||
#ifdef CONFIG_NET_VSOCK
|
||||
# include <netpacket/vm_sockets.h>
|
||||
#endif
|
||||
#include <netdb.h>
|
||||
#include <sys/un.h>
|
||||
|
||||
|
|
@ -51,8 +57,12 @@ struct ai_s
|
|||
struct sockaddr_un sun;
|
||||
struct sockaddr_in sin;
|
||||
struct sockaddr_in6 sin6;
|
||||
#ifdef CONFIG_NET_RPMSG
|
||||
struct sockaddr_rpmsg srp;
|
||||
#endif
|
||||
#ifdef CONFIG_NET_VSOCK
|
||||
struct sockaddr_vm svm;
|
||||
#endif
|
||||
} sa;
|
||||
};
|
||||
|
||||
|
|
@ -65,12 +75,13 @@ FAR static struct ai_s *alloc_ai(int family, int socktype, int protocol,
|
|||
{
|
||||
FAR struct ai_s *ai;
|
||||
|
||||
ai = lib_zalloc(sizeof(struct ai_s));
|
||||
ai = lib_malloc(sizeof(struct ai_s));
|
||||
if (ai == NULL)
|
||||
{
|
||||
return ai;
|
||||
}
|
||||
|
||||
memset(ai, 0, sizeof(*ai));
|
||||
ai->ai.ai_addr = (FAR struct sockaddr *)&ai->sa;
|
||||
ai->ai.ai_family = family;
|
||||
ai->ai.ai_socktype = socktype;
|
||||
|
|
@ -187,12 +198,13 @@ int getaddrinfo(FAR const char *hostname, FAR const char *servname,
|
|||
{
|
||||
/* Force network byte order */
|
||||
|
||||
port = HTONS(port);
|
||||
port = htons(port);
|
||||
}
|
||||
else if ((flags & AI_NUMERICSERV) != 0)
|
||||
{
|
||||
return EAI_NONAME;
|
||||
}
|
||||
#if defined(CONFIG_NET_IPv4) || defined(CONFIG_NET_IPv6)
|
||||
else if (getservbyname_r(servname, NULL, &ent, NULL, 0, &sp) == OK)
|
||||
{
|
||||
/* The s_port field of struct servent is required to
|
||||
|
|
@ -201,6 +213,7 @@ int getaddrinfo(FAR const char *hostname, FAR const char *servname,
|
|||
|
||||
port = sp->s_port;
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
return EAI_SERVICE;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,9 @@
|
|||
#include <arpa/inet.h>
|
||||
|
||||
#include <nuttx/net/dns.h>
|
||||
#include <nuttx/net/loopback.h>
|
||||
#ifdef CONFIG_NET_LOOPBACK
|
||||
# include <nuttx/net/loopback.h>
|
||||
#endif
|
||||
|
||||
#include "netdb/lib_dns.h"
|
||||
#include "netdb/lib_netdb.h"
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include <netdb.h>
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef CONFIG_LIBC_NETDB
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue