Fix detection of final close

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@787 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2008-07-27 19:26:57 +00:00
parent 3aaad0504c
commit 4c89703789
2 changed files with 16 additions and 9 deletions

15
TODO
View File

@ -10,7 +10,7 @@ NuttX TODO List (Last updated February 13, 2008)
(11) Network (net/, netutils/) (11) Network (net/, netutils/)
(2) USB (drivers/usbdev) (2) USB (drivers/usbdev)
(3) Libraries (lib/) (3) Libraries (lib/)
(4) File system/Generic drivers (fs/, drivers/) (5) File system/Generic drivers (fs/, drivers/)
(1) Pascal add-on (pcode/) (1) Pascal add-on (pcode/)
(2) Documentation (Documentation/) (2) Documentation (Documentation/)
(3) Build system (3) Build system
@ -221,7 +221,7 @@ o Libraries (lib/)
o File system / Generic drivers (fs/, drivers/) o File system / Generic drivers (fs/, drivers/)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Description: Add chmod(), truncate(). Description: Implement chmod(), truncate().
Status: Open Status: Open
Priority: Low Priority: Low
@ -235,7 +235,16 @@ o File system / Generic drivers (fs/, drivers/)
Description: There is no way to remove a FIFO or PIPE created in the Description: There is no way to remove a FIFO or PIPE created in the
psuedo filesystem. Once created, they persist indefinitely psuedo filesystem. Once created, they persist indefinitely
and cannot be unlinked. 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 Status: Open
Priority: Medium Priority: Medium

View File

@ -133,7 +133,6 @@ static int pipe_close(FAR struct file *filep)
{ {
struct inode *inode = filep->f_inode; struct inode *inode = filep->f_inode;
struct pipe_dev_s *dev = inode->i_private; struct pipe_dev_s *dev = inode->i_private;
ubyte pipeno;
int ret; int ret;
/* Some sanity checking */ /* Some sanity checking */
@ -143,16 +142,15 @@ static int pipe_close(FAR struct file *filep)
return -EBADF; return -EBADF;
} }
#endif #endif
pipeno = dev->d_pipeno;
/* Perform common close operations */ /* Perform common close operations */
ret = pipecommon_close(filep); 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; return ret;
} }