aboutsummaryrefslogtreecommitdiff
path: root/nuttx/sched/sched_setupstreams.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-01-26 22:25:21 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-01-26 22:25:21 +0000
commitb82c36961aa730fc39a9fc8eac17e2518128cb67 (patch)
tree7b706cce24489ea8e025a9802d3daf3078428e19 /nuttx/sched/sched_setupstreams.c
parent3bec164b3ae1cd7f9b5dcec532e7d073be96d45d (diff)
downloadpx4-firmware-b82c36961aa730fc39a9fc8eac17e2518128cb67.tar.gz
px4-firmware-b82c36961aa730fc39a9fc8eac17e2518128cb67.tar.bz2
px4-firmware-b82c36961aa730fc39a9fc8eac17e2518128cb67.zip
Move stream data from TCB to task group structure.
git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5569 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/sched/sched_setupstreams.c')
-rw-r--r--nuttx/sched/sched_setupstreams.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/nuttx/sched/sched_setupstreams.c b/nuttx/sched/sched_setupstreams.c
index 22895b047..fb2e4d0be 100644
--- a/nuttx/sched/sched_setupstreams.c
+++ b/nuttx/sched/sched_setupstreams.c
@@ -72,24 +72,23 @@
int sched_setupstreams(FAR _TCB *tcb)
{
- /* Allocate file streams for the TCB */
-
- tcb->streams = lib_alloclist();
- if (tcb->streams)
- {
- /* fdopen to get the stdin, stdout and stderr streams.
- * The following logic depends on the fact that the library
- * layer will allocate FILEs in order.
- *
- * fd = 0 is stdin (read-only)
- * fd = 1 is stdout (write-only, append)
- * fd = 2 is stderr (write-only, append)
- */
-
- (void)fs_fdopen(0, O_RDONLY, tcb);
- (void)fs_fdopen(1, O_WROK|O_CREAT, tcb);
- (void)fs_fdopen(2, O_WROK|O_CREAT, tcb);
- }
+ DEBUGASSERT(tcb && tcb->group);
+
+ /* Initialize file streams for the task group */
+
+ lib_streaminit(&tcb->group->tg_streamlist);
+
+ /* fdopen to get the stdin, stdout and stderr streams. The following logic
+ * depends on the fact that the library layer will allocate FILEs in order.
+ *
+ * fd = 0 is stdin (read-only)
+ * fd = 1 is stdout (write-only, append)
+ * fd = 2 is stderr (write-only, append)
+ */
+
+ (void)fs_fdopen(0, O_RDONLY, tcb);
+ (void)fs_fdopen(1, O_WROK|O_CREAT, tcb);
+ (void)fs_fdopen(2, O_WROK|O_CREAT, tcb);
return OK;
}