diff --git a/TODO b/TODO index 915c74310b9d689645979bf1f24dd4f5e6837d78..bc91875500e5f73baf88466bd1cd9e6bfaf738e3 100644 --- a/TODO +++ b/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/drivers/pipe.c b/drivers/pipe.c index 8c06974b16a11b27961d068d3c53bced42b810d1..5e0b2f6e5a299d7c0e3da52cef41244c9e156c12 100644 --- a/drivers/pipe.c +++ b/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; }