summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/examples/posix_spawn/Makefile27
-rw-r--r--apps/examples/posix_spawn/filesystem/Makefile16
-rw-r--r--apps/examples/posix_spawn/spawn_main.c16
-rw-r--r--nuttx/ChangeLog5
-rw-r--r--nuttx/TODO14
-rw-r--r--nuttx/libc/misc/lib_filesem.c16
-rw-r--r--nuttx/libc/misc/lib_streamsem.c2
-rw-r--r--nuttx/libc/stdio/lib_libfread.c3
8 files changed, 70 insertions, 29 deletions
diff --git a/apps/examples/posix_spawn/Makefile b/apps/examples/posix_spawn/Makefile
index bda3376d2..0bfa36e55 100644
--- a/apps/examples/posix_spawn/Makefile
+++ b/apps/examples/posix_spawn/Makefile
@@ -105,7 +105,26 @@ distclean: clean
$(call DELFILE, Make.dep)
$(call DELFILE, .depend)
-# There are no dependencies in this directory. We should are code some of
-# more important dependencies here:
-
--include Make.dep
+# There are no dependencies in this directory. Some of more important
+# and more obvious dependencies are hard-coded here:
+
+spawn_main.o: spawn_main.c \
+ $(TOPDIR)/include/nuttx/config.h \
+ $(TOPDIR)/include/nuttx/compiler.h \
+ $(TOPDIR)/include/sys/mount.h \
+ $(TOPDIR)/include/stdio.h \
+ $(TOPDIR)/include/stdlib.h \
+ $(TOPDIR)/include/unistd.h \
+ $(TOPDIR)/include/string.h \
+ $(TOPDIR)/include/fcntl.h \
+ $(TOPDIR)/include/spawn.h \
+ $(TOPDIR)/include/debug.h \
+ $(TOPDIR)/include/errno.h \
+ $(TOPDIR)/include/nuttx/ramdisk.h \
+ $(TOPDIR)/include/nuttx/binfmt/elf.h \
+ $(TOPDIR)/include/nuttx/binfmt/symtab.h \
+ filesystem/romfs.h
+
+symtab.o: filesystem/symtab.c \
+ $(TOPDIR)/include/nuttx/compiler.h \
+ $(TOPDIR)/include/nuttx/binfmt/symtab.h
diff --git a/apps/examples/posix_spawn/filesystem/Makefile b/apps/examples/posix_spawn/filesystem/Makefile
index 2005d060f..26897426c 100644
--- a/apps/examples/posix_spawn/filesystem/Makefile
+++ b/apps/examples/posix_spawn/filesystem/Makefile
@@ -44,7 +44,7 @@ ROMFS_HDR = $(FILESYSTEM_DIR)$(DELIM)romfs.h
SYMTAB_SRC = $(FILESYSTEM_DIR)$(DELIM)symtab.c
all: $(ROMFS_HDR) $(SYMTAB_SRC)
-.PHONY: all hello redirect clean install populate
+.PHONY: all hello/hello redirect/redirect clean populate
# Create the romfs directory
@@ -53,24 +53,20 @@ $(ROMFS_DIR):
# Build the hello test program
-hello: $(ROMFS_DIR)
+hello/hello:
$(Q) $(MAKE) -C hello hello TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" ROMFS_DIR="$(ROMFS_DIR)"
# Build the redirection test program
-redirect: $(ROMFS_DIR)
+redirect/redirect:
$(Q) $(MAKE) -C redirect redirect TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" ROMFS_DIR="$(ROMFS_DIR)"
-# Install the test programs in the romfs directory
+# Create the romfs.img file from the romfs directory
-install: hello redirect testdata.txt
+$(ROMFS_IMG): hello/hello redirect/redirect testdata.txt $(ROMFS_DIR)
$(Q) $(MAKE) -C hello install TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" ROMFS_DIR="$(ROMFS_DIR)"
$(Q) $(MAKE) -C redirect install TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" ROMFS_DIR="$(ROMFS_DIR)"
$(Q) install --mode=0644 testdata.txt $(ROMFS_DIR)/testdata.txt
-
-# Create the romfs.img file from the romfs directory
-
-$(ROMFS_IMG): install
$(Q) genromfs -f $@ -d $(ROMFS_DIR) -V "POSIXSPAWN"
# Create the romfs.h header file from the romfs.img file
@@ -80,7 +76,7 @@ $(ROMFS_HDR) : $(ROMFS_IMG)
# Create the exported symbol table
-$(SYMTAB_SRC): hello/hello redirect/redirect testdata.txt
+$(SYMTAB_SRC): $(ROMFS_DIR)/hello $(ROMFS_DIR)/redirect $(ROMFS_DIR)/testdata.txt
$(Q) $(FILESYSTEM_DIR)$(DELIM)mksymtab.sh $(ROMFS_DIR) >$@
# Clean each subdirectory
diff --git a/apps/examples/posix_spawn/spawn_main.c b/apps/examples/posix_spawn/spawn_main.c
index 6f8859516..1506fe499 100644
--- a/apps/examples/posix_spawn/spawn_main.c
+++ b/apps/examples/posix_spawn/spawn_main.c
@@ -89,6 +89,15 @@
# error "You must not disable loadable modules via CONFIG_BINFMT_DISABLE in your configuration file"
#endif
+/* The redirection test does not work. This is because it tries to redirect
+ * file as stdin. That won't work now because (1) the file descriptors must
+ * be dup'ed when the new task is created, and (2) there is no support in
+ * place for dup'ing file descriptors for anything other than sockets and
+ * character drivers. This is a bug!
+ */
+
+#define FILE_DUP_BUG 1
+
/* Describe the ROMFS file system */
#define SECTORSIZE 512
@@ -138,7 +147,9 @@ static unsigned int g_mmstep; /* Memory Usage at beginning of test step */
static const char delimiter[] =
"****************************************************************************";
+#ifndef FILE_DUP_BUG
static const char g_redirect[] = "redirect";
+#endif
static const char g_hello[] = "hello";
static const char g_data[] = "testdata.txt";
@@ -361,9 +372,11 @@ int spawn_main(int argc, char *argv[])
mm_update(&g_mmstep, "after file_action/attr destruction");
/*************************************************************************
- * Case 2: Simple program with redirection of stdin
+ * Case 2: Simple program with redirection of stdin to a file input
*************************************************************************/
+#ifndef FILE_DUP_BUG
+
/* Output a seperated so that we can clearly discriminate the output of
* this program from the others.
*/
@@ -450,6 +463,7 @@ int spawn_main(int argc, char *argv[])
posix_spawnattr_dump(&attr);
mm_update(&g_mmstep, "after file_action/attr destruction");
+#endif
/* Clean-up */
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index 63aac89f5..40a24d8f1 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -3907,4 +3907,7 @@
that can be used for testing posix_spawn().
* arch/arm/src/stm32: Bring F1 support for general DMA and serial
DMA in paricular up to parity with F2/F4 (from Mike Smith).
-
+ * libc/stdio/lib_libfread.c: Correct some error handling when
+ lib_fread() was passed a bad stream. Needed to move the
+ releasing of a semaphore inside of some conditional logic
+ (cosmetic).
diff --git a/nuttx/TODO b/nuttx/TODO
index 9295f6206..e257cef79 100644
--- a/nuttx/TODO
+++ b/nuttx/TODO
@@ -1,4 +1,4 @@
-NuttX TODO List (Last updated January 10, 2013)
+NuttX TODO List (Last updated January 11, 2013)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This file summarizes known NuttX bugs, limitations, inconsistencies with
@@ -15,7 +15,7 @@ nuttx/
(17) Network (net/, drivers/net)
(4) USB (drivers/usbdev, drivers/usbhost)
(12) Libraries (libc/, )
- (9) File system/Generic drivers (fs/, drivers/)
+ (10) File system/Generic drivers (fs/, drivers/)
(5) Graphics subystem (graphics/)
(1) Pascal add-on (pcode/)
(1) Documentation (Documentation/)
@@ -863,6 +863,16 @@ o File system / Generic drivers (fs/, drivers/)
Status: Open
Priority: Medium
+ Title: dup AND dup2 WILL NOT WORK ON FILES IN A MOUNTED VOLUME
+ Description: The current implementation of dup() and dup2() will only
+ work with open device drivers and sockets. It will not
+ work with open files in a file system.
+
+ A limitation that results from this is that you cannot
+ redirect I/O to an from and file.
+ Status: Open
+ Priority: High
+
o Graphics subystem (graphics/)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/nuttx/libc/misc/lib_filesem.c b/nuttx/libc/misc/lib_filesem.c
index 5cc4624ec..f38ff5f23 100644
--- a/nuttx/libc/misc/lib_filesem.c
+++ b/nuttx/libc/misc/lib_filesem.c
@@ -67,8 +67,8 @@
void lib_sem_initialize(FAR struct file_struct *stream)
{
- /* Initialize the LIB semaphore to one (to support one-at-
- * a-time access to private data sets.
+ /* Initialize the LIB semaphore to one (to support one-at-a-time access
+ * to private data sets.
*/
(void)sem_init(&stream->fs_sem, 0, 1);
@@ -98,13 +98,13 @@ void lib_take_semaphore(FAR struct file_struct *stream)
/* Take the semaphore (perhaps waiting) */
while (sem_wait(&stream->fs_sem) != 0)
- {
- /* The only case that an error should occr here is if
- * the wait was awakened by a signal.
- */
+ {
+ /* The only case that an error should occr here is if the wait
+ * was awakened by a signal.
+ */
- ASSERT(get_errno() == EINTR);
- }
+ ASSERT(get_errno() == EINTR);
+ }
/* We have it. Claim the stak and return */
diff --git a/nuttx/libc/misc/lib_streamsem.c b/nuttx/libc/misc/lib_streamsem.c
index e38298bdb..3397f9907 100644
--- a/nuttx/libc/misc/lib_streamsem.c
+++ b/nuttx/libc/misc/lib_streamsem.c
@@ -86,5 +86,3 @@ void stream_semgive(FAR struct streamlist *list)
{
sem_post(&list->sl_sem);
}
-
-
diff --git a/nuttx/libc/stdio/lib_libfread.c b/nuttx/libc/stdio/lib_libfread.c
index bc6479037..3e851bf17 100644
--- a/nuttx/libc/stdio/lib_libfread.c
+++ b/nuttx/libc/stdio/lib_libfread.c
@@ -301,9 +301,10 @@ ssize_t lib_fread(FAR void *ptr, size_t count, FAR FILE *stream)
{
stream->fs_flags |= __FS_FLAG_EOF;
}
+
+ lib_give_semaphore(stream);
}
- lib_give_semaphore(stream);
return bytes_read;
/* Error exits */