diff --git a/Documentation/NuttxUserGuide.html b/Documentation/NuttxUserGuide.html
index e8cd444ce7..da5473da8e 100644
--- a/Documentation/NuttxUserGuide.html
+++ b/Documentation/NuttxUserGuide.html
@@ -8590,7 +8590,6 @@ interface of the same name.
CONFIG_NET
Defined for general network support
CONFIG_NET_TCP
Defined for TCP/IP support
- CONFIG_NSOCKET_DESCRIPTORS
Defined to be greater than 0
CONFIG_NET_TCP_READAHEAD
Define to enable read-ahead buffering
CONFIG_NET_NTCP_READAHEAD_BUFFERS
Defined to be greater than zero
diff --git a/fs/aio/aio.h b/fs/aio/aio.h
index 3ec406f3b8..5e80d192a5 100644
--- a/fs/aio/aio.h
+++ b/fs/aio/aio.h
@@ -65,7 +65,7 @@
#undef AIO_HAVE_PSOCK
-#if defined(CONFIG_NET_TCP) && CONFIG_NSOCKET_DESCRIPTORS > 0
+#ifdef CONFIG_NET_TCP
# define AIO_HAVE_PSOCK
#endif
diff --git a/fs/procfs/fs_procfsproc.c b/fs/procfs/fs_procfsproc.c
index 78e64bce7f..642466f52f 100644
--- a/fs/procfs/fs_procfsproc.c
+++ b/fs/procfs/fs_procfsproc.c
@@ -1050,7 +1050,7 @@ static ssize_t proc_groupfd(FAR struct proc_file_s *procfile,
{
FAR struct task_group_s *group = tcb->group;
FAR struct file *file;
-#if CONFIG_NSOCKET_DESCRIPTORS > 0
+#ifdef CONFIG_NET
FAR struct socket *socket;
#endif
size_t remaining;
@@ -1102,7 +1102,7 @@ static ssize_t proc_groupfd(FAR struct proc_file_s *procfile,
}
}
-#if CONFIG_NSOCKET_DESCRIPTORS > 0
+#ifdef CONFIG_NET
linesize = snprintf(procfile->line, STATUS_LINELEN, "\n%-3s %-2s %-3s %s\n",
"SD", "RF", "TYP", "FLAGS");
copysize = procfs_memcpy(procfile->line, linesize, buffer, remaining, &offset);
@@ -1118,7 +1118,9 @@ static ssize_t proc_groupfd(FAR struct proc_file_s *procfile,
/* Examine each open socket descriptor */
- for (i = 0, socket = group->tg_socketlist.sl_sockets; i < CONFIG_NSOCKET_DESCRIPTORS; i++, socket++)
+ for (i = 0, socket = group->tg_socketlist.sl_sockets;
+ i < CONFIG_NSOCKET_DESCRIPTORS;
+ i++, socket++)
{
/* Is there an connection associated with the socket descriptor? */
diff --git a/fs/vfs/fs_close.c b/fs/vfs/fs_close.c
index f029c08add..9a5b59dd38 100644
--- a/fs/vfs/fs_close.c
+++ b/fs/vfs/fs_close.c
@@ -46,7 +46,7 @@
#include
#include
-#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
+#ifdef CONFIG_NET
# include
#endif
@@ -94,7 +94,7 @@ int close(int fd)
{
/* Close a socket descriptor */
-#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
+#ifdef CONFIG_NET
if ((unsigned int)fd < (CONFIG_NFILE_DESCRIPTORS + CONFIG_NSOCKET_DESCRIPTORS))
{
ret = net_close(fd);
diff --git a/fs/vfs/fs_dup.c b/fs/vfs/fs_dup.c
index db63e830ed..7bdbec390d 100644
--- a/fs/vfs/fs_dup.c
+++ b/fs/vfs/fs_dup.c
@@ -78,7 +78,7 @@ int dup(int fd)
{
/* Not a valid file descriptor. Did we get a valid socket descriptor? */
-#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
+#ifdef CONFIG_NET
if ((unsigned int)fd < (CONFIG_NFILE_DESCRIPTORS + CONFIG_NSOCKET_DESCRIPTORS))
{
/* Yes.. dup the socket descriptor. The errno value is not set. */
diff --git a/fs/vfs/fs_dup2.c b/fs/vfs/fs_dup2.c
index 5225da9630..3a55ac9e94 100644
--- a/fs/vfs/fs_dup2.c
+++ b/fs/vfs/fs_dup2.c
@@ -51,7 +51,7 @@
* performed.
*/
-#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
+#ifdef CONFIG_NET
/****************************************************************************
* Public Functions
@@ -111,5 +111,5 @@ int dup2(int fd1, int fd2)
}
}
-#endif /* CONFIG_NET && CONFIG_NSOCKET_DESCRIPTORS > 0 */
+#endif /* CONFIG_NET */
diff --git a/fs/vfs/fs_dupfd2.c b/fs/vfs/fs_dupfd2.c
index bba880b689..93f044b884 100644
--- a/fs/vfs/fs_dupfd2.c
+++ b/fs/vfs/fs_dupfd2.c
@@ -76,7 +76,7 @@
*
****************************************************************************/
-#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
+#ifdef CONFIG_NET
int fs_dupfd2(int fd1, int fd2)
#else
int dup2(int fd1, int fd2)
diff --git a/fs/vfs/fs_fcntl.c b/fs/vfs/fs_fcntl.c
index 37838cb914..308b32c74a 100644
--- a/fs/vfs/fs_fcntl.c
+++ b/fs/vfs/fs_fcntl.c
@@ -305,7 +305,7 @@ int fcntl(int fd, int cmd, ...)
{
/* No... check for operations on a socket descriptor */
-#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
+#ifdef CONFIG_NET
if ((unsigned int)fd < (CONFIG_NFILE_DESCRIPTORS + CONFIG_NSOCKET_DESCRIPTORS))
{
/* Yes.. defer socket descriptor operations to net_vfcntl(). The
diff --git a/fs/vfs/fs_fdopen.c b/fs/vfs/fs_fdopen.c
index 2382c75592..c660570af4 100644
--- a/fs/vfs/fs_fdopen.c
+++ b/fs/vfs/fs_fdopen.c
@@ -163,7 +163,7 @@ FAR struct file_struct *fs_fdopen(int fd, int oflags, FAR struct tcb_s *tcb)
* descriptor.
*/
-#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
+#ifdef CONFIG_NET
ret = net_checksd(fd, oflags);
#else
/* No networking... it is just a bad descriptor */
diff --git a/fs/vfs/fs_fstat.c b/fs/vfs/fs_fstat.c
index 8af38a1cdd..132ea18f25 100644
--- a/fs/vfs/fs_fstat.c
+++ b/fs/vfs/fs_fstat.c
@@ -147,7 +147,7 @@ int fstat(int fd, FAR struct stat *buf)
if ((unsigned int)fd >= CONFIG_NFILE_DESCRIPTORS)
{
-#if CONFIG_NSOCKET_DESCRIPTORS > 0
+#ifdef CONFIG_NET
/* Let the networking logic handle the fstat() */
ret = net_fstat(fd, buf);
diff --git a/fs/vfs/fs_ioctl.c b/fs/vfs/fs_ioctl.c
index 887cd268b0..28d006d6e7 100644
--- a/fs/vfs/fs_ioctl.c
+++ b/fs/vfs/fs_ioctl.c
@@ -47,7 +47,7 @@
#include
-#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
+#ifdef CONFIG_NET
# include
#endif
@@ -146,7 +146,7 @@ int ioctl(int fd, int req, unsigned long arg)
{
/* Perform the socket ioctl */
-#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
+#ifdef CONFIG_NET
if ((unsigned int)fd < (CONFIG_NFILE_DESCRIPTORS + CONFIG_NSOCKET_DESCRIPTORS))
{
ret = netdev_ioctl(fd, req, arg);
diff --git a/fs/vfs/fs_poll.c b/fs/vfs/fs_poll.c
index d546958421..0fda254e15 100644
--- a/fs/vfs/fs_poll.c
+++ b/fs/vfs/fs_poll.c
@@ -106,7 +106,7 @@ static int poll_fdsetup(int fd, FAR struct pollfd *fds, bool setup)
{
/* Perform the socket ioctl */
-#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
+#ifdef CONFIG_NET
if ((unsigned int)fd < (CONFIG_NFILE_DESCRIPTORS + CONFIG_NSOCKET_DESCRIPTORS))
{
return net_poll(fd, fds, setup);
diff --git a/fs/vfs/fs_read.c b/fs/vfs/fs_read.c
index 2dcff0f3af..c1c3bbab8c 100644
--- a/fs/vfs/fs_read.c
+++ b/fs/vfs/fs_read.c
@@ -142,7 +142,7 @@ ssize_t nx_read(int fd, FAR void *buf, size_t nbytes)
if ((unsigned int)fd >= CONFIG_NFILE_DESCRIPTORS)
{
-#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
+#ifdef CONFIG_NET
/* No.. If networking is enabled, read() is the same as recv() with
* the flags parameter set to zero.
*/
diff --git a/fs/vfs/fs_sendfile.c b/fs/vfs/fs_sendfile.c
index 87bd64da64..643bccea93 100644
--- a/fs/vfs/fs_sendfile.c
+++ b/fs/vfs/fs_sendfile.c
@@ -103,7 +103,7 @@
ssize_t sendfile(int outfd, int infd, off_t *offset, size_t count)
{
-#if defined(CONFIG_NET_SENDFILE) && CONFIG_NSOCKET_DESCRIPTORS > 0
+#ifdef CONFIG_NET_SENDFILE
/* Check the destination file descriptor: Is it a (probable) file
* descriptor? Check the source file: Is it a normal file?
*/
diff --git a/fs/vfs/fs_write.c b/fs/vfs/fs_write.c
index 724e691465..9085244904 100644
--- a/fs/vfs/fs_write.c
+++ b/fs/vfs/fs_write.c
@@ -47,7 +47,7 @@
#include
#include
-#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
+#ifdef CONFIG_NET_TCP
# include
#endif
@@ -149,7 +149,7 @@ ssize_t nx_write(int fd, FAR const void *buf, size_t nbytes)
if ((unsigned int)fd >= CONFIG_NFILE_DESCRIPTORS)
{
-#if defined(CONFIG_NET_TCP) && CONFIG_NSOCKET_DESCRIPTORS > 0
+#ifdef CONFIG_NET_TCP
/* Write to a socket descriptor is equivalent to send with flags == 0. */
ret = nx_send(fd, buf, nbytes, 0);
diff --git a/include/nuttx/fs/fs.h b/include/nuttx/fs/fs.h
index 48a8eedf8d..fcfc27ca32 100644
--- a/include/nuttx/fs/fs.h
+++ b/include/nuttx/fs/fs.h
@@ -789,7 +789,7 @@ int file_dup(FAR struct file *filep, int minfd);
*
****************************************************************************/
-#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
+#ifdef CONFIG_NET
int fs_dupfd2(int fd1, int fd2);
#else
# define fs_dupfd2(fd1, fd2) dup2(fd1, fd2)
diff --git a/include/nuttx/net/net.h b/include/nuttx/net/net.h
index 8da91fbbf8..59a8163ca9 100644
--- a/include/nuttx/net/net.h
+++ b/include/nuttx/net/net.h
@@ -227,7 +227,7 @@ struct socket
/* This defines a list of sockets indexed by the socket descriptor */
-#if CONFIG_NSOCKET_DESCRIPTORS > 0
+#ifdef CONFIG_NET
struct socketlist
{
sem_t sl_sem; /* Manage access to the socket list */
diff --git a/include/nuttx/net/netdev.h b/include/nuttx/net/netdev.h
index 9af9151c36..93235dc432 100644
--- a/include/nuttx/net/netdev.h
+++ b/include/nuttx/net/netdev.h
@@ -230,7 +230,7 @@ struct net_driver_s
* Must be the first field in the structure due to blink type casting.
*/
-#if CONFIG_NSOCKET_DESCRIPTORS > 0
+#ifdef CONFIG_NET
FAR struct net_driver_s *flink;
/* This is the name of network device assigned when netdev_register was called.
diff --git a/include/nuttx/sched.h b/include/nuttx/sched.h
index fddd931826..330903ae0a 100644
--- a/include/nuttx/sched.h
+++ b/include/nuttx/sched.h
@@ -544,7 +544,7 @@ struct task_group_s
#endif
#endif
-#if CONFIG_NSOCKET_DESCRIPTORS > 0
+#ifdef CONFIG_NET
/* Sockets ********************************************************************/
struct socketlist tg_socketlist; /* Maps socket descriptor to socket */
@@ -826,9 +826,9 @@ FAR struct filelist *sched_getfiles(void);
FAR struct streamlist *sched_getstreams(void);
#endif /* CONFIG_NFILE_STREAMS */
-#if CONFIG_NSOCKET_DESCRIPTORS > 0
+#ifdef CONFIG_NET
FAR struct socketlist *sched_getsockets(void);
-#endif /* CONFIG_NSOCKET_DESCRIPTORS */
+#endif
/********************************************************************************
* Name: nxtask_starthook
diff --git a/include/sys/ioctl.h b/include/sys/ioctl.h
index 9a12b6c9bf..6672abe8ba 100644
--- a/include/sys/ioctl.h
+++ b/include/sys/ioctl.h
@@ -45,7 +45,6 @@
#include
#include
-#if CONFIG_NSOCKET_DESCRIPTORS > 0
#ifdef CONFIG_NET
/* Include network IOCTL definitions */
@@ -77,7 +76,6 @@
# include
#endif /* CONFIG_WIRELESS_IEEE802154 */
-#endif /* CONFIG_NSOCKET_DESCRIPTORS > 0 */
/****************************************************************************
* Pre-processor Definitions
diff --git a/include/sys/syscall.h b/include/sys/syscall.h
index b9d0a9c452..3a7a16b27d 100644
--- a/include/sys/syscall.h
+++ b/include/sys/syscall.h
@@ -270,11 +270,6 @@
* enabled.
*/
-#ifndef CONFIG_NET
-# undef CONFIG_NSOCKET_DESCRIPTORS
-# define CONFIG_NSOCKET_DESCRIPTORS 0
-#endif
-
#define SYS_close (__SYS_descriptors + 0)
#ifdef CONFIG_LIBC_IOCTL_VARIADIC
@@ -524,7 +519,7 @@
/* The following are defined only if networking AND sockets are supported */
-#if CONFIG_NSOCKET_DESCRIPTORS > 0
+#ifdef CONFIG_NET
# define SYS_accept (__SYS_network + 0)
# define SYS_bind (__SYS_network + 1)
# define SYS_connect (__SYS_network + 2)
diff --git a/libs/libc/netdb/lib_dnsbind.c b/libs/libc/netdb/lib_dnsbind.c
index d430b2b683..3a873021de 100644
--- a/libs/libc/netdb/lib_dnsbind.c
+++ b/libs/libc/netdb/lib_dnsbind.c
@@ -52,10 +52,6 @@
* Pre-processor Definitions
****************************************************************************/
-#if CONFIG_NSOCKET_DESCRIPTORS < 1
-# error CONFIG_NSOCKET_DESCRIPTORS must be greater than zero
-#endif
-
#if CONFIG_NET_SOCKOPTS < 1
# error CONFIG_NET_SOCKOPTS required by this logic
#endif
diff --git a/net/netdev/netdev.h b/net/netdev/netdev.h
index 386c058434..b1cf257295 100644
--- a/net/netdev/netdev.h
+++ b/net/netdev/netdev.h
@@ -74,7 +74,6 @@ extern "C"
#define EXTERN extern
#endif
-#if CONFIG_NSOCKET_DESCRIPTORS > 0
/* List of registered Ethernet device drivers. You must have the network
* locked in order to access this list.
*
@@ -82,7 +81,6 @@ extern "C"
*/
EXTERN struct net_driver_s *g_netdevices;
-#endif
#ifdef CONFIG_NETDEV_IFINDEX
/* The set of network devices that have been registered. This is used to
@@ -155,9 +153,7 @@ bool netdev_verify(FAR struct net_driver_s *dev);
*
****************************************************************************/
-#if CONFIG_NSOCKET_DESCRIPTORS > 0
FAR struct net_driver_s *netdev_findbyname(FAR const char *ifname);
-#endif
/****************************************************************************
* Name: netdev_foreach
@@ -178,8 +174,6 @@ FAR struct net_driver_s *netdev_findbyname(FAR const char *ifname);
int netdev_foreach(netdev_callback_t callback, FAR void *arg);
-#if CONFIG_NSOCKET_DESCRIPTORS > 0
-
/****************************************************************************
* Name: netdev_findby_lipv4addr
*
@@ -265,7 +259,6 @@ FAR struct net_driver_s *netdev_findby_ripv4addr(in_addr_t lipaddr,
FAR struct net_driver_s *netdev_findby_ripv6addr(const net_ipv6addr_t lipaddr,
const net_ipv6addr_t ripaddr);
#endif
-#endif /* CONFIG_NSOCKET_DESCRIPTORS > 0 */
/****************************************************************************
* Name: netdev_findbyindex
@@ -368,9 +361,7 @@ unsigned int netdev_nametoindex(FAR const char *ifname);
*
****************************************************************************/
-#if CONFIG_NSOCKET_DESCRIPTORS > 0
FAR struct net_driver_s *netdev_default(void);
-#endif
/****************************************************************************
* Name: netdev_ipv4_txnotify
@@ -388,7 +379,6 @@ FAR struct net_driver_s *netdev_default(void);
*
****************************************************************************/
-#if CONFIG_NSOCKET_DESCRIPTORS > 0
#ifdef CONFIG_NET_IPv4
void netdev_ipv4_txnotify(in_addr_t lipaddr, in_addr_t ripaddr);
#endif /* CONFIG_NET_IPv4 */
@@ -413,7 +403,6 @@ void netdev_ipv4_txnotify(in_addr_t lipaddr, in_addr_t ripaddr);
void netdev_ipv6_txnotify(FAR const net_ipv6addr_t lipaddr,
FAR const net_ipv6addr_t ripaddr);
#endif /* CONFIG_NET_IPv6 */
-#endif /* CONFIG_NSOCKET_DESCRIPTORS > 0 */
/****************************************************************************
* Name: netdev_txnotify_dev
@@ -447,9 +436,7 @@ void netdev_txnotify_dev(FAR struct net_driver_s *dev);
*
****************************************************************************/
-#if CONFIG_NSOCKET_DESCRIPTORS > 0
int netdev_count(void);
-#endif
/****************************************************************************
* Name: netdev_ipv4_ifconf
diff --git a/net/netdev/netdev_carrier.c b/net/netdev/netdev_carrier.c
index 52da9c5bc3..4cded08491 100644
--- a/net/netdev/netdev_carrier.c
+++ b/net/netdev/netdev_carrier.c
@@ -38,7 +38,6 @@
****************************************************************************/
#include
-#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
#include
#include
@@ -110,4 +109,3 @@ int netdev_carrier_off(FAR struct net_driver_s *dev)
return -EINVAL;
}
-#endif /* CONFIG_NET && CONFIG_NSOCKET_DESCRIPTORS */
diff --git a/net/netdev/netdev_count.c b/net/netdev/netdev_count.c
index 6635cfc425..3659e30c9e 100644
--- a/net/netdev/netdev_count.c
+++ b/net/netdev/netdev_count.c
@@ -38,7 +38,6 @@
****************************************************************************/
#include
-#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
#include
#include
@@ -77,4 +76,3 @@ int netdev_count(void)
return ndev;
}
-#endif /* CONFIG_NET && CONFIG_NSOCKET_DESCRIPTORS */
diff --git a/net/netdev/netdev_default.c b/net/netdev/netdev_default.c
index 55d8a2bf1e..e570892641 100644
--- a/net/netdev/netdev_default.c
+++ b/net/netdev/netdev_default.c
@@ -38,7 +38,6 @@
****************************************************************************/
#include
-#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
#include
@@ -101,4 +100,3 @@ FAR struct net_driver_s *netdev_default(void)
return ret;
}
-#endif /* CONFIG_NET */
diff --git a/net/netdev/netdev_findbyaddr.c b/net/netdev/netdev_findbyaddr.c
index 2fa99c68b6..448d5647e5 100644
--- a/net/netdev/netdev_findbyaddr.c
+++ b/net/netdev/netdev_findbyaddr.c
@@ -39,7 +39,6 @@
****************************************************************************/
#include
-#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
#include
#include
@@ -345,4 +344,3 @@ FAR struct net_driver_s *netdev_findby_ripv6addr(const net_ipv6addr_t lipaddr,
}
#endif /* CONFIG_NET_IPv6 */
-#endif /* CONFIG_NET && CONFIG_NSOCKET_DESCRIPTORS */
diff --git a/net/netdev/netdev_findbyindex.c b/net/netdev/netdev_findbyindex.c
index 293d8c36a4..9b2e398558 100644
--- a/net/netdev/netdev_findbyindex.c
+++ b/net/netdev/netdev_findbyindex.c
@@ -48,8 +48,6 @@
#include "utils/utils.h"
#include "netdev/netdev.h"
-#if CONFIG_NSOCKET_DESCRIPTORS > 0
-
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -177,4 +175,3 @@ int netdev_nextindex(int ifindex)
}
#endif
-#endif /* CONFIG_NSOCKET_DESCRIPTORS */
diff --git a/net/netdev/netdev_findbyname.c b/net/netdev/netdev_findbyname.c
index 2ab2a1a97f..41883d9ab1 100644
--- a/net/netdev/netdev_findbyname.c
+++ b/net/netdev/netdev_findbyname.c
@@ -38,7 +38,6 @@
****************************************************************************/
#include
-#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
#include
#include
@@ -89,4 +88,3 @@ FAR struct net_driver_s *netdev_findbyname(FAR const char *ifname)
return NULL;
}
-#endif /* CONFIG_NET && CONFIG_NSOCKET_DESCRIPTORS */
diff --git a/net/netdev/netdev_foreach.c b/net/netdev/netdev_foreach.c
index d0891b3c7e..2309645328 100644
--- a/net/netdev/netdev_foreach.c
+++ b/net/netdev/netdev_foreach.c
@@ -38,7 +38,6 @@
****************************************************************************/
#include
-#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
#include
@@ -90,4 +89,3 @@ int netdev_foreach(netdev_callback_t callback, FAR void *arg)
return ret;
}
-#endif /* CONFIG_NET && CONFIG_NSOCKET_DESCRIPTORS */
diff --git a/net/netdev/netdev_ioctl.c b/net/netdev/netdev_ioctl.c
index 639e0e1fb2..12fa1ba030 100644
--- a/net/netdev/netdev_ioctl.c
+++ b/net/netdev/netdev_ioctl.c
@@ -90,8 +90,6 @@
#include "icmpv6/icmpv6.h"
#include "route/route.h"
-#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
-
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@@ -1810,4 +1808,3 @@ void netdev_ifdown(FAR struct net_driver_s *dev)
}
}
-#endif /* CONFIG_NET && CONFIG_NSOCKET_DESCRIPTORS */
diff --git a/net/netdev/netdev_register.c b/net/netdev/netdev_register.c
index e07b40aa5f..54321cb5a5 100644
--- a/net/netdev/netdev_register.c
+++ b/net/netdev/netdev_register.c
@@ -60,8 +60,6 @@
#include "mld/mld.h"
#include "netdev/netdev.h"
-#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
-
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@@ -440,4 +438,3 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
return -EINVAL;
}
-#endif /* CONFIG_NET && CONFIG_NSOCKET_DESCRIPTORS */
diff --git a/net/netdev/netdev_txnotify.c b/net/netdev/netdev_txnotify.c
index bcb5cab644..51881f9e06 100644
--- a/net/netdev/netdev_txnotify.c
+++ b/net/netdev/netdev_txnotify.c
@@ -38,7 +38,6 @@
****************************************************************************/
#include
-#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
#include
#include
@@ -147,4 +146,3 @@ void netdev_txnotify_dev(FAR struct net_driver_s *dev)
}
}
-#endif /* CONFIG_NET && CONFIG_NSOCKET_DESCRIPTORS */
diff --git a/net/netdev/netdev_unregister.c b/net/netdev/netdev_unregister.c
index bd7dcac671..47e9daa117 100644
--- a/net/netdev/netdev_unregister.c
+++ b/net/netdev/netdev_unregister.c
@@ -38,7 +38,6 @@
****************************************************************************/
#include
-#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
#include
#include
@@ -184,4 +183,3 @@ int netdev_unregister(FAR struct net_driver_s *dev)
return -EINVAL;
}
-#endif /* CONFIG_NET && CONFIG_NSOCKET_DESCRIPTORS */
diff --git a/net/socket/Kconfig b/net/socket/Kconfig
index 3de2428dee..64a27cbb39 100644
--- a/net/socket/Kconfig
+++ b/net/socket/Kconfig
@@ -6,8 +6,9 @@
menu "Socket Support"
config NSOCKET_DESCRIPTORS
- int "Number of socket descriptor"
+ int "Number of socket descriptors"
default 8
+ range 1 99999
---help---
Maximum number of socket descriptors per task/thread.
diff --git a/net/socket/accept.c b/net/socket/accept.c
index a5decbe7d6..bcfc368e92 100644
--- a/net/socket/accept.c
+++ b/net/socket/accept.c
@@ -51,8 +51,6 @@
#include "socket/socket.h"
-#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
-
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -308,4 +306,3 @@ errout:
return ERROR;
}
-#endif /* CONFIG_NET && CONFIG_NSOCKET_DESCRIPTORS */
diff --git a/net/socket/listen.c b/net/socket/listen.c
index 2b41d599b8..0b3f117690 100644
--- a/net/socket/listen.c
+++ b/net/socket/listen.c
@@ -46,8 +46,6 @@
#include "socket/socket.h"
-#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
-
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -184,4 +182,3 @@ int listen(int sockfd, int backlog)
return OK;
}
-#endif /* CONFIG_NET && CONFIG_NSOCKET_DESCRIPTORS */
diff --git a/net/socket/net_dupsd.c b/net/socket/net_dupsd.c
index 07c96d6660..6944b48e60 100644
--- a/net/socket/net_dupsd.c
+++ b/net/socket/net_dupsd.c
@@ -46,8 +46,6 @@
#include "socket/socket.h"
-#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
-
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -156,4 +154,3 @@ int net_dupsd(int sockfd, int minsd)
return psock_dupsd(sockfd_socket(sockfd), minsd);
}
-#endif /* defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0 */
diff --git a/net/socket/net_dupsd2.c b/net/socket/net_dupsd2.c
index d89524feee..4d1cda4718 100644
--- a/net/socket/net_dupsd2.c
+++ b/net/socket/net_dupsd2.c
@@ -48,8 +48,6 @@
#include "socket/socket.h"
-#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
-
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -112,5 +110,3 @@ errout:
return ret;
}
-#endif /* CONFIG_NET && CONFIG_NSOCKET_DESCRIPTORS > 0 */
-
diff --git a/net/socket/net_sockets.c b/net/socket/net_sockets.c
index 4c3247e72a..4fc92e2907 100644
--- a/net/socket/net_sockets.c
+++ b/net/socket/net_sockets.c
@@ -51,8 +51,6 @@
#include "socket/socket.h"
-#if CONFIG_NSOCKET_DESCRIPTORS > 0
-
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -295,4 +293,3 @@ FAR struct socket *sockfd_socket(int sockfd)
return NULL;
}
-#endif /* CONFIG_NSOCKET_DESCRIPTORS > 0 */
diff --git a/net/socket/net_vfcntl.c b/net/socket/net_vfcntl.c
index 51faaca58d..341bee2522 100644
--- a/net/socket/net_vfcntl.c
+++ b/net/socket/net_vfcntl.c
@@ -52,8 +52,6 @@
#include "socket/socket.h"
#include "usrsock/usrsock.h"
-#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
-
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -318,4 +316,3 @@ int net_vfcntl(int sockfd, int cmd, va_list ap)
return psock_vfcntl(sockfd_socket(sockfd), cmd, ap);
}
-#endif /* CONFIG_NET && CONFIG_NSOCKET_DESCRIPTORS > 0 */
diff --git a/net/tcp/tcp.h b/net/tcp/tcp.h
index 8265e2205d..8db4e9c6e0 100644
--- a/net/tcp/tcp.h
+++ b/net/tcp/tcp.h
@@ -63,8 +63,7 @@
/* Conditions for support TCP poll/select operations */
-#if !defined(CONFIG_DISABLE_POLL) && CONFIG_NSOCKET_DESCRIPTORS > 0 && \
- defined(CONFIG_NET_TCP_READAHEAD)
+#if !defined(CONFIG_DISABLE_POLL) 0 && defined(CONFIG_NET_TCP_READAHEAD)
# define HAVE_TCP_POLL
#endif
@@ -312,7 +311,6 @@ extern "C"
# define EXTERN extern
#endif
-#if CONFIG_NSOCKET_DESCRIPTORS > 0
/* List of registered Ethernet device drivers. You must have the network
* locked in order to access this list.
*
@@ -320,7 +318,6 @@ extern "C"
*/
EXTERN struct net_driver_s *g_netdevices;
-#endif
/****************************************************************************
* Public Function Prototypes
diff --git a/net/tcp/tcp_accept.c b/net/tcp/tcp_accept.c
index 614efff777..9f4630ac95 100644
--- a/net/tcp/tcp_accept.c
+++ b/net/tcp/tcp_accept.c
@@ -38,7 +38,7 @@
****************************************************************************/
#include
-#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET_TCP)
+#ifdef CONFIG_NET_TCP
#include
#include
@@ -335,4 +335,4 @@ int psock_tcp_accept(FAR struct socket *psock, FAR struct sockaddr *addr,
return OK;
}
-#endif /* CONFIG_NET && CONFIG_NSOCKET_DESCRIPTORS && CONFIG_NET_TCP */
+#endif /* CONFIG_NET_TCP */
diff --git a/net/udp/udp.h b/net/udp/udp.h
index 8b5bbf14ca..963d5322b0 100644
--- a/net/udp/udp.h
+++ b/net/udp/udp.h
@@ -67,8 +67,7 @@
/* Conditions for support UDP poll/select operations */
-#if !defined(CONFIG_DISABLE_POLL) && CONFIG_NSOCKET_DESCRIPTORS > 0 && \
- defined(CONFIG_NET_UDP_READAHEAD)
+#if !defined(CONFIG_DISABLE_POLL) && defined(CONFIG_NET_UDP_READAHEAD)
# define HAVE_UDP_POLL
#endif
diff --git a/sched/group/group_leave.c b/sched/group/group_leave.c
index aef9799a4f..8cb699ee31 100644
--- a/sched/group/group_leave.c
+++ b/sched/group/group_leave.c
@@ -175,11 +175,11 @@ static inline void group_release(FAR struct task_group_s *group)
#endif /* CONFIG_NFILE_STREAMS */
-#if CONFIG_NSOCKET_DESCRIPTORS > 0
+#ifdef CONFIG_NET
/* Free resource held by the socket list */
net_releaselist(&group->tg_socketlist);
-#endif /* CONFIG_NSOCKET_DESCRIPTORS */
+#endif
#ifndef CONFIG_DISABLE_ENVIRON
/* Release all shared environment variables */
diff --git a/sched/group/group_setupidlefiles.c b/sched/group/group_setupidlefiles.c
index 3f418e27ef..943de93a42 100644
--- a/sched/group/group_setupidlefiles.c
+++ b/sched/group/group_setupidlefiles.c
@@ -85,7 +85,7 @@ int group_setupidlefiles(FAR struct task_tcb_s *tcb)
files_initlist(&group->tg_filelist);
-#if CONFIG_NSOCKET_DESCRIPTORS > 0
+#ifdef CONFIG_NET
/* Allocate socket descriptors for the TCB */
net_initlist(&group->tg_socketlist);
diff --git a/sched/group/group_setuptaskfiles.c b/sched/group/group_setuptaskfiles.c
index 2f63c3296b..6f5079ebc7 100644
--- a/sched/group/group_setuptaskfiles.c
+++ b/sched/group/group_setuptaskfiles.c
@@ -140,7 +140,7 @@ static inline void sched_dupfiles(FAR struct task_tcb_s *tcb)
*
****************************************************************************/
-#if CONFIG_NSOCKET_DESCRIPTORS > 0 && !defined(CONFIG_SDCLONE_DISABLE)
+#if defined(CONFIG_NET) && !defined(CONFIG_SDCLONE_DISABLE)
static inline void sched_dupsockets(FAR struct task_tcb_s *tcb)
{
/* The parent task is the one at the head of the ready-to-run list */
@@ -178,9 +178,9 @@ static inline void sched_dupsockets(FAR struct task_tcb_s *tcb)
}
}
}
-#else /* CONFIG_NSOCKET_DESCRIPTORS && !CONFIG_SDCLONE_DISABLE */
+#else /* CONFIG_NET && !CONFIG_SDCLONE_DISABLE */
# define sched_dupsockets(tcb)
-#endif /* CONFIG_NSOCKET_DESCRIPTORS && !CONFIG_SDCLONE_DISABLE */
+#endif /* CONFIG_NET && !CONFIG_SDCLONE_DISABLE */
/****************************************************************************
* Public Functions
@@ -217,7 +217,7 @@ int group_setuptaskfiles(FAR struct task_tcb_s *tcb)
files_initlist(&group->tg_filelist);
-#if CONFIG_NSOCKET_DESCRIPTORS > 0
+#ifdef CONFIG_NET
/* Allocate socket descriptors for the TCB */
net_initlist(&group->tg_socketlist);
diff --git a/sched/sched/sched_getsockets.c b/sched/sched/sched_getsockets.c
index 0031c9e09d..4ea7907415 100644
--- a/sched/sched/sched_getsockets.c
+++ b/sched/sched/sched_getsockets.c
@@ -42,8 +42,6 @@
#include
#include "sched/sched.h"
-#if CONFIG_NSOCKET_DESCRIPTORS > 0
-
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -64,6 +62,7 @@
*
****************************************************************************/
+#ifdef CONFIG_NET
FAR struct socketlist *sched_getsockets(void)
{
FAR struct tcb_s *rtcb = this_task();
@@ -72,5 +71,6 @@ FAR struct socketlist *sched_getsockets(void)
DEBUGASSERT(group);
return &group->tg_socketlist;
}
+#endif
+
-#endif /* CONFIG_NSOCKET_DESCRIPTORS */
diff --git a/syscall/syscall.csv b/syscall/syscall.csv
index 7129bfb1ec..3d9bbbf5b4 100644
--- a/syscall/syscall.csv
+++ b/syscall/syscall.csv
@@ -4,9 +4,9 @@
"aio_fsync","aio.h","defined(CONFIG_FS_AIO)","int","int","FAR struct aiocb *"
"aio_read","aio.h","defined(CONFIG_FS_AIO)","int","FAR struct aiocb *"
"aio_write","aio.h","defined(CONFIG_FS_AIO)","int","FAR struct aiocb *"
-"accept","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","struct sockaddr*","socklen_t*"
+"accept","sys/socket.h","defined(CONFIG_NET)","int","int","struct sockaddr*","socklen_t*"
"atexit","stdlib.h","defined(CONFIG_SCHED_ATEXIT)","int","void (*)(void)"
-"bind","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","FAR const struct sockaddr*","socklen_t"
+"bind","sys/socket.h","defined(CONFIG_NET)","int","int","FAR const struct sockaddr*","socklen_t"
"boardctl","sys/boardctl.h","defined(CONFIG_LIB_BOARDCTL)","int","unsigned int","uintptr_t"
"clearenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","int"
"clock","time.h","","clock_t"
@@ -16,7 +16,7 @@
"clock_settime","time.h","","int","clockid_t","const struct timespec*"
"close","unistd.h","","int","int"
"closedir","dirent.h","","int","FAR DIR*"
-"connect","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","FAR const struct sockaddr*","socklen_t"
+"connect","sys/socket.h","defined(CONFIG_NET)","int","int","FAR const struct sockaddr*","socklen_t"
"dup","unistd.h","","int","int"
"dup2","unistd.h","","int","int","int"
"exec","nuttx/binfmt/binfmt.h","!defined(CONFIG_BINFMT_DISABLE) && !defined(CONFIG_BUILD_KERNEL)","int","FAR const char *","FAR char * const *","FAR const struct symtab_s *","int"
@@ -32,18 +32,18 @@
"get_errno","errno.h","!defined(__DIRECT_ERRNO_ACCESS)","int"
"get_errno_ptr","errno.h","defined(__DIRECT_ERRNO_ACCESS)","FAR int*"
"getenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","FAR char*","FAR const char*"
-"getpeername","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","FAR struct sockaddr *","FAR socklen_t *"
+"getpeername","sys/socket.h","defined(CONFIG_NET)","int","int","FAR struct sockaddr *","FAR socklen_t *"
"getpid","unistd.h","","pid_t"
"getrandom","sys/random.h","defined(CONFIG_CRYPTO_RANDOM_POOL)","void","FAR void*","size_t"
-"getsockname","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","FAR struct sockaddr *","FAR socklen_t *"
-"getsockopt","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","int","int","FAR void*","FAR socklen_t*"
+"getsockname","sys/socket.h","defined(CONFIG_NET)","int","int","FAR struct sockaddr *","FAR socklen_t *"
+"getsockopt","sys/socket.h","defined(CONFIG_NET)","int","int","int","int","FAR void*","FAR socklen_t*"
"if_indextoname","net/if.h","defined(CONFIG_NETDEV_IFINDEX)","FAR char *","unsigned int","FAR char *"
"if_nametoindex","net/if.h","defined(CONFIG_NETDEV_IFINDEX)","unsigned int","FAR const char *"
"insmod","nuttx/module.h","defined(CONFIG_MODULE)","FAR void *","FAR const char *","FAR const char *"
"ioctl","sys/ioctl.h","!defined(CONFIG_LIBC_IOCTL_VARIADIC)","int","int","int","unsigned long"
"kill","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","pid_t","int"
"link","unistd.h","defined(CONFIG_PSEUDOFS_SOFTLINKS)","int","FAR const char *","FAR const char *"
-"listen","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","int"
+"listen","sys/socket.h","defined(CONFIG_NET)","int","int","int"
"lseek","unistd.h","","off_t","int","off_t","int"
"mkdir","sys/stat.h","!defined(CONFIG_DISABLE_MOUNTPOINT)","int","FAR const char*","mode_t"
"mkfifo2","nuttx/drivers/drivers.h","defined(CONFIG_PIPES) && CONFIG_DEV_FIFO_SIZE > 0","int","FAR const char*","mode_t","size_t"
@@ -106,8 +106,8 @@
"read","unistd.h","","ssize_t","int","FAR void*","size_t"
"readdir","dirent.h","","FAR struct dirent*","FAR DIR*"
"readlink","unistd.h","defined(CONFIG_PSEUDOFS_SOFTLINKS)","ssize_t","FAR const char *","FAR char *","size_t"
-"recv","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","ssize_t","int","FAR void*","size_t","int"
-"recvfrom","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","ssize_t","int","FAR void*","size_t","int","FAR struct sockaddr*","FAR socklen_t*"
+"recv","sys/socket.h","defined(CONFIG_NET)","ssize_t","int","FAR void*","size_t","int"
+"recvfrom","sys/socket.h","defined(CONFIG_NET)","ssize_t","int","FAR void*","size_t","int","FAR struct sockaddr*","FAR socklen_t*"
"rename","stdio.h","!defined(CONFIG_DISABLE_MOUNTPOINT)","int","FAR const char*","FAR const char*"
"rewinddir","dirent.h","","void","FAR DIR*"
"rmdir","unistd.h","!defined(CONFIG_DISABLE_MOUNTPOINT)","int","FAR const char*"
@@ -133,13 +133,13 @@
"sem_trywait","semaphore.h","","int","FAR sem_t*"
"sem_unlink","semaphore.h","defined(CONFIG_FS_NAMED_SEMAPHORES)","int","FAR const char*"
"sem_wait","semaphore.h","","int","FAR sem_t*"
-"send","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","ssize_t","int","FAR const void*","size_t","int"
+"send","sys/socket.h","defined(CONFIG_NET)","ssize_t","int","FAR const void*","size_t","int"
"sendfile","sys/sendfile.h","defined(CONFIG_NET_SENDFILE)","ssize_t","int","int","FAR off_t*","size_t"
-"sendto","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","ssize_t","int","FAR const void*","size_t","int","FAR const struct sockaddr*","socklen_t"
+"sendto","sys/socket.h","defined(CONFIG_NET)","ssize_t","int","FAR const void*","size_t","int","FAR const struct sockaddr*","socklen_t"
"set_errno","errno.h","!defined(__DIRECT_ERRNO_ACCESS)","void","int"
"setenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","int","FAR const char*","FAR const char*","int"
"sethostname","unistd.h","defined(CONFIG_LIBC_NETDB)","int","FAR const char*","size_t"
-"setsockopt","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","int","int","FAR const void*","socklen_t"
+"setsockopt","sys/socket.h","defined(CONFIG_NET)","int","int","int","int","FAR const void*","socklen_t"
"shmat", "sys/shm.h", "defined(CONFIG_MM_SHM)", "FAR void *", "int", "FAR const void *", "int"
"shmctl", "sys/shm.h", "defined(CONFIG_MM_SHM)", "int", "int", "int", "FAR struct shmid_ds *"
"shmdt", "sys/shm.h", "defined(CONFIG_MM_SHM)", "int", "FAR const void *"
@@ -151,7 +151,7 @@
"sigsuspend","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","FAR const sigset_t*"
"sigtimedwait","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","FAR const sigset_t*","FAR struct siginfo*","FAR const struct timespec*"
"sigwaitinfo","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","FAR const sigset_t*","FAR struct siginfo*"
-"socket","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","int","int"
+"socket","sys/socket.h","defined(CONFIG_NET)","int","int","int","int"
"stat","sys/stat.h","","int","const char*","FAR struct stat*"
"statfs","sys/statfs.h","","int","FAR const char*","FAR struct statfs*"
"task_create","sched.h","!defined(CONFIG_BUILD_KERNEL)", "int","FAR const char*","int","int","main_t","FAR char * const []|FAR char * const *"
diff --git a/tools/mkconfig.c b/tools/mkconfig.c
index c880e7429c..974ead7d18 100644
--- a/tools/mkconfig.c
+++ b/tools/mkconfig.c
@@ -193,26 +193,6 @@ int main(int argc, char **argv, char **envp)
printf("# define CONFIG_DISABLE_MQUEUE 1\n");
printf("#endif\n\n");
- printf("/* The correct way to disable socket support is to set the number of\n");
- printf(" * socket descriptors to zero.\n");
- printf(" */\n\n");
- printf("#ifndef CONFIG_NSOCKET_DESCRIPTORS\n");
- printf("# define CONFIG_NSOCKET_DESCRIPTORS 0\n");
- printf("#endif\n\n");
-
- printf("/* There can be no network support with no socket descriptors */\n\n");
- printf("#if CONFIG_NSOCKET_DESCRIPTORS <= 0\n");
- printf("# undef CONFIG_NET\n");
- printf("#endif\n\n");
-
- printf("/* Conversely, if there is no network support, there is no need for\n");
- printf(" * socket descriptors\n");
- printf(" */\n\n");
- printf("#ifndef CONFIG_NET\n");
- printf("# undef CONFIG_NSOCKET_DESCRIPTORS\n");
- printf("# define CONFIG_NSOCKET_DESCRIPTORS 0\n");
- printf("#endif\n\n");
-
printf("#endif /* __INCLUDE_NUTTX_CONFIG_H */\n");
fclose(stream);