OpenSolaris

Printable Version Enter a New Search
Bug ID 6614468
Synopsis libc should provide a dirfd()
State 10-Fix Delivered (Fix available in build)
Category:Subcategory library:libc
Keywords modern_times | opensolaris
Responsible Engineer Roger Faulkner
Reported Against snv_59 , snv_73
Duplicate Of
Introduced In
Commit to Fix snv_77
Fixed In snv_77
Release Fixed solaris_nevada(snv_77)
Related Bugs 6535623 , 6620722
Submit Date 9-October-2007
Last Update Date 8-November-2007
Description
Category
   library
Sub-Category
   libc
Description
   Many other Unix like OSes (Linux, OpenBSD, and I believe OSX) provide a dirfd() to return the file descriptor underlying a directory handle:
foo = opendir(".");
fd = dirfd(foo);
We should join the party.
Frequency
   Always
Regression
   No
Steps to Reproduce
   N/A
Expected Result
   N/A
Actual Result
   N/A
Error Message(s)
   
Test Case
   
Workaround
   It's mostly possible to work around this while porting 3rd party software, by open()ing the directory, and fdopendir()ing the returned fd, but that may not be possible on other systems as fdopendir() appears to be non-standard.
A not particularly tasteful workaround, which depends on the internals of DIR, would be:
#if defined(__sun) && defined(__SVR4)
#define dirfd(dirp) (dirp->dd_fd)
#endif
Submitter wants to work on bug
   No
Additional configuration information
Work Around
N/A
Comments
N/A