summaryrefslogtreecommitdiff
path: root/nuttx
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-07-27 19:26:57 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-07-27 19:26:57 +0000
commite3ff949fecaf5d7a66082b3c394c217368076078 (patch)
treeb72568b397144b7f72b7e00c8fb4067596a17e03 /nuttx
parente836de52ab6423fe83da3a3b937308c5dd743990 (diff)
downloadnuttx-e3ff949fecaf5d7a66082b3c394c217368076078.tar.gz
nuttx-e3ff949fecaf5d7a66082b3c394c217368076078.tar.bz2
nuttx-e3ff949fecaf5d7a66082b3c394c217368076078.zip
Fix detection of final close
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@787 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx')
-rw-r--r--nuttx/TODO17
-rw-r--r--nuttx/drivers/pipe.c8
2 files changed, 16 insertions, 9 deletions
diff --git a/nuttx/TODO b/nuttx/TODO
index 915c74310..bc9187550 100644
--- a/nuttx/TODO
+++ b/nuttx/TODO
@@ -10,7 +10,7 @@ NuttX TODO List (Last updated February 13, 2008)
(11) Network (net/, netutils/)
(2) USB (drivers/usbdev)
(3) Libraries (lib/)
- (4) File system/Generic drivers (fs/, drivers/)
+ (5) File system/Generic drivers (fs/, drivers/)
(1) Pascal add-on (pcode/)
(2) Documentation (Documentation/)
(3) Build system
@@ -221,7 +221,7 @@ o Libraries (lib/)
o File system / Generic drivers (fs/, drivers/)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Description: Add chmod(), truncate().
+ Description: Implement chmod(), truncate().
Status: Open
Priority: Low
@@ -235,10 +235,19 @@ o File system / Generic drivers (fs/, drivers/)
Description: There is no way to remove a FIFO or PIPE created in the
psuedo filesystem. Once created, they persist indefinitely
- and cannot be unlinked.
- Status: Open
+ and cannot be unlinked. This is actually a more generic
+ issue: unlink does not work for anything in the psuedo-
+ filesystem.
+ Status: Open, but partially resolved: pipe buffer is at least freed
+ when there are not open references to the pipe/FIFO.
Priority: Medium
+ Desccripton: dup and dup2 need to call into driver. Most drivers
+ will maintain internal open counts. dup and dup2 logically
+ increase the open count but do not interact with the driver
+ Status: Open
+ Priority: Medium
+
o Pascal Add-On (pcode/)
^^^^^^^^^^^^^^^^^^^^^^
diff --git a/nuttx/drivers/pipe.c b/nuttx/drivers/pipe.c
index 8c06974b1..5e0b2f6e5 100644
--- a/nuttx/drivers/pipe.c
+++ b/nuttx/drivers/pipe.c
@@ -133,7 +133,6 @@ static int pipe_close(FAR struct file *filep)
{
struct inode *inode = filep->f_inode;
struct pipe_dev_s *dev = inode->i_private;
- ubyte pipeno;
int ret;
/* Some sanity checking */
@@ -143,16 +142,15 @@ static int pipe_close(FAR struct file *filep)
return -EBADF;
}
#endif
- pipeno = dev->d_pipeno;
/* Perform common close operations */
ret = pipecommon_close(filep);
- if (ret == 0 && !inode->i_private)
+ if (ret == 0 && dev->d_refs == 0)
{
- /* Release the pipe */
+ /* Release the pipe when there are no further open references to it. */
- pipe_free(pipeno);
+ pipe_free(dev->d_pipeno);
}
return ret;
}