task_create now dup's all open descriptors

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@789 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2008-07-30 00:28:43 +00:00
parent 3043b0d5a1
commit 1c9cadf1c3
4 changed files with 33 additions and 22 deletions
+3
View File
@@ -378,4 +378,7 @@
* Add pipe() and test for both pipes and fifos
* Attempts to open a FIFO will now block until there is at least one writer
* Add test/Fixed errors in FIFO reader/writer interlocks
* Removed limitation: task_create() was only dup'ing 3 file descriptors (now
dups all open file descriptors).
* Added a test for redirection of stdio through pipes
+4 -1
View File
@@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4">
<td>
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
<p>Last Updated: July 26, 2008</p>
<p>Last Updated: July 29, 2008</p>
</td>
</tr>
</table>
@@ -1027,6 +1027,9 @@ nuttx-0.3.12 2008-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
* Add pipe() and test for both pipes and fifos
* Attempts to open a FIFO will now block until there is at least one writer
* Add test/Fixed errors in FIFO reader/writer interlocks
* Removed limitation: task_create() was only dup'ing 3 file descriptors (now
dups all open file descriptors).
* Added a test for redirection of stdio through pipes
pascal-0.1.3 2008-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
+13 -13
View File
@@ -1,7 +1,7 @@
/************************************************************
* sched_setupidlefiles.c
/****************************************************************************
* sched/sched_setupidlefiles.c
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
* 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
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Included Files
************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@@ -52,15 +52,15 @@
#if CONFIG_NFILE_DESCRIPTORS > 0 || CONFIG_NSOCKET_DESCRIPTORS > 0
/************************************************************
/****************************************************************************
* Private Functions
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Public Functions
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Function: sched_setupidlefiles
*
* Description:
@@ -74,7 +74,7 @@
*
* Assumptions:
*
************************************************************/
****************************************************************************/
int sched_setupidlefiles(FAR _TCB *tcb)
{
+13 -8
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* sched_setuptaskfiles.c
* sched/sched_setuptaskfiles.c
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
@@ -76,10 +76,10 @@
int sched_setuptaskfiles(FAR _TCB *tcb)
{
#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_DEV_CONSOLE)
#if CONFIG_NFILE_DESCRIPTORS > 0
FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head;
int i;
#endif /* CONFIG_DEV_CONSOLE */
#endif /* CONFIG_NFILE_DESCRIPTORS > 0 */
int ret = OK;
#if CONFIG_NFILE_DESCRIPTORS > 0
@@ -104,15 +104,20 @@ int sched_setuptaskfiles(FAR _TCB *tcb)
}
#endif /* CONFIG_NSOCKET_DESCRIPTORS */
#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_DEV_CONSOLE)
#if CONFIG_NFILE_DESCRIPTORS > 0
/* Duplicate the first three file descriptors */
if (rtcb->filelist)
{
for (i = 0; i < 3; i++)
for (i = 0; i < CONFIG_NFILE_DESCRIPTORS; i++)
{
(void)files_dup(&rtcb->filelist->fl_files[i],
&tcb->filelist->fl_files[i]);
/* Check if this file is opened */
if (rtcb->filelist->fl_files[i].f_inode)
{
(void)files_dup(&rtcb->filelist->fl_files[i],
&tcb->filelist->fl_files[i]);
}
}
}
@@ -121,7 +126,7 @@ int sched_setuptaskfiles(FAR _TCB *tcb)
ret = sched_setupstreams(tcb);
#endif /* CONFIG_NFILE_STREAMS */
#endif /* CONFIG_NFILE_DESCRIPTORS && CONFIG_DEV_CONSOLE */
#endif /* CONFIG_NFILE_DESCRIPTORS */
return ret;
}