diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-09-01 18:06:15 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-09-01 18:06:15 +0000 |
commit | 5d303ec17efc511d8cfe0919a790b44e24a8aad9 (patch) | |
tree | 76c519b5903e6d1e2880f7fb0d403838f7acddac /nuttx/sched/sched_getsockets.c | |
parent | 0cab5d84f146c0f6105192db5593aa4019edcdcf (diff) | |
download | px4-nuttx-5d303ec17efc511d8cfe0919a790b44e24a8aad9.tar.gz px4-nuttx-5d303ec17efc511d8cfe0919a790b44e24a8aad9.tar.bz2 px4-nuttx-5d303ec17efc511d8cfe0919a790b44e24a8aad9.zip |
Added support for socket descriptors
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@318 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/sched/sched_getsockets.c')
-rw-r--r-- | nuttx/sched/sched_getsockets.c | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/nuttx/sched/sched_getsockets.c b/nuttx/sched/sched_getsockets.c new file mode 100644 index 000000000..c54c5f236 --- /dev/null +++ b/nuttx/sched/sched_getsockets.c @@ -0,0 +1,76 @@ +/************************************************************ + * sched_getsockets.c + * + * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt <spudmonkey@racsa.co.cr> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ************************************************************/ + +/************************************************************ + * Included Files + ************************************************************/ + +#include <nuttx/config.h> +#if CONFIG_NSOCKET_DESCRIPTORS > 0 + +#include <sched.h> +#include "os_internal.h" + +/************************************************************ + * Private Functions + ************************************************************/ + +/************************************************************ + * Public Functions + ************************************************************/ + +/************************************************************ + * Function: sched_getsockets + * + * Description: + * Return a pointer to the socket list for this thread + * + * Parameters: + * None + * + * Return Value: + * A pointer to the errno. + * + * Assumptions: + * + ************************************************************/ + +FAR struct socketlist *sched_getsockets(void) +{ + FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head; + return rtcb->sockets; +} + +#endif /* CONFIG_NSOCKET_DESCRIPTORS */ |