summaryrefslogtreecommitdiff
path: root/nuttx/net/net-sockets.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-09-16 17:46:25 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-09-16 17:46:25 +0000
commit4077a70fc256a7dd65febe986f176b8ac62091fc (patch)
tree6f0e34d559c8fa2f07c686043df3494cd7fdcff2 /nuttx/net/net-sockets.c
parent42027d080b72b8198072e7dc3933d8b70b6b40a5 (diff)
downloadpx4-nuttx-4077a70fc256a7dd65febe986f176b8ac62091fc.tar.gz
px4-nuttx-4077a70fc256a7dd65febe986f176b8ac62091fc.tar.bz2
px4-nuttx-4077a70fc256a7dd65febe986f176b8ac62091fc.zip
Add basic structure to support netdevice ioctls
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@344 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/net/net-sockets.c')
-rw-r--r--nuttx/net/net-sockets.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/nuttx/net/net-sockets.c b/nuttx/net/net-sockets.c
index 3a6821051..db5c48ac8 100644
--- a/nuttx/net/net-sockets.c
+++ b/nuttx/net/net-sockets.c
@@ -38,6 +38,7 @@
****************************************************************************/
#include <nuttx/config.h>
+#ifdef CONFIG_NET
#include <string.h>
#include <semaphore.h>
@@ -71,6 +72,7 @@
* Private Functions
****************************************************************************/
+#if CONFIG_NSOCKET_DESCRIPTORS > 0
static void _net_semtake(FAR struct socketlist *list)
{
/* Take the semaphore (perhaps waiting) */
@@ -85,10 +87,11 @@ static void _net_semtake(FAR struct socketlist *list)
}
}
-#define _net_semgive(list) sem_post(&list->sl_sem)
+# define _net_semgive(list) sem_post(&list->sl_sem)
+#endif
/****************************************************************************
- * Pulblic Functions
+ * Public Functions
****************************************************************************/
/* This is called from the initialization logic to configure the socket layer */
@@ -99,9 +102,15 @@ void net_initialize(void)
uip_init();
- /* Initialize the socket lay -- nothing to do */
+ /* Initialize the socket layer */
+
+#if CONFIG_NSOCKET_DESCRIPTORS > 0
+ sem_init(&g_netdev_sem, 0, 1);
+#endif
}
+#if CONFIG_NSOCKET_DESCRIPTORS > 0
+
/* Allocate a list of files for a new task */
FAR struct socketlist *net_alloclist(void)
@@ -261,3 +270,6 @@ FAR struct socket *sockfd_socket(int sockfd)
}
return NULL;
}
+
+#endif /* CONFIG_NSOCKET_DESCRIPTORS */
+#endif /* CONFIG_NET */ \ No newline at end of file