summaryrefslogtreecommitdiff
path: root/apps/builtin
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-01-14 19:22:32 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-01-14 19:22:32 +0000
commit84cd4c9f496ed927cac9c8d1cfab0c9747bbf85a (patch)
tree45a3ce8d73b15e96d13ef6a48171a61a1a8449b8 /apps/builtin
parentf3c15e2b0508635898c2c0fcf1564394d8aa8cfc (diff)
downloadnuttx-84cd4c9f496ed927cac9c8d1cfab0c9747bbf85a.tar.gz
nuttx-84cd4c9f496ed927cac9c8d1cfab0c9747bbf85a.tar.bz2
nuttx-84cd4c9f496ed927cac9c8d1cfab0c9747bbf85a.zip
Finish dup logic for open files; fix bug in sigtimedwait(), would return wrong signo value if the signal was already pending
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5517 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/builtin')
-rw-r--r--apps/builtin/Kconfig15
-rw-r--r--apps/builtin/binfs.c37
2 files changed, 51 insertions, 1 deletions
diff --git a/apps/builtin/Kconfig b/apps/builtin/Kconfig
index 8310e6df9..5b262734d 100644
--- a/apps/builtin/Kconfig
+++ b/apps/builtin/Kconfig
@@ -12,4 +12,19 @@ config BUILTIN
to support built-in applications in the NuttShell (NSH).
if BUILTIN
+
+ config APPS_BINDIR
+ bool "BINFS File System"
+ default n
+ ---help---
+ The BINFS file system is current just a toy. The BINFS may, for example,
+ be mount at /bin. Then all of the built-in applications will appear as
+ executable file in /bin if you list them from NSH like:
+
+ nsh> ls -l /bin
+
+ At present, the BINFS supports nothing more than that. It is planned,
+ however, to support execution of the builtin applications from BINFS as
+ well (via a binfmt/ loader). However, that is down the road.
+
endif
diff --git a/apps/builtin/binfs.c b/apps/builtin/binfs.c
index 4159c9663..365021c7f 100644
--- a/apps/builtin/binfs.c
+++ b/apps/builtin/binfs.c
@@ -85,6 +85,8 @@ static int binfs_close(FAR struct file *filep);
static ssize_t binfs_read(FAR struct file *filep, char *buffer, size_t buflen);
static int binfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
+static int binfs_dup(FAR const struct file *oldp, FAR struct file *newp);
+
static int binfs_opendir(struct inode *mountpt, const char *relpath,
struct fs_dirent_s *dir);
static int binfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir);
@@ -120,7 +122,7 @@ const struct mountpt_operations binfs_operations =
binfs_ioctl, /* ioctl */
NULL, /* sync */
- NULL, /* dup */
+ binfs_dup, /* dup */
binfs_opendir, /* opendir */
NULL, /* closedir */
@@ -297,6 +299,39 @@ static int binfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
}
/****************************************************************************
+ * Name: binfs_dup
+ *
+ * Description:
+ * Duplicate open file data in the new file structure.
+ *
+ ****************************************************************************/
+
+static int binfs_dup(FAR const struct file *oldp, FAR struct file *newp)
+{
+ struct binfs_state_s *bm;
+ int ret = -ENOSYS;
+
+ fvdbg("Dup %p->%p\n", oldp, newp);
+
+ /* Sanity checks */
+
+ DEBUGASSERT(oldp->f_priv == NULL && oldp->f_inode != NULL);
+
+ /* mountpoint private data from the inode reference from the file
+ * structure
+ */
+
+ bm = (struct binfs_state_s*)oldp->f_inode->i_private;
+ DEBUGASSERT(bm != NULL);
+
+ /* Opening of elements within the pseudo-file system is not yet supported
+ * and, hence, neither is dup'ing the opened file.
+ */
+
+ return ret;
+}
+
+/****************************************************************************
* Name: binfs_opendir
*
* Description: