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
This commit is contained in:
patacongo 2013-01-14 19:22:32 +00:00
parent 9fdccfccfa
commit 284e90df29
2 changed files with 51 additions and 1 deletions

View File

@ -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

View File

@ -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 */
@ -296,6 +298,39 @@ static int binfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
return -ENOTTY;
}
/****************************************************************************
* 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
*