Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2007-06-29 19:13:01 +0400
committerCorinna Vinschen <corinna@vinschen.de>2007-06-29 19:13:01 +0400
commit40570a828e0ed00cf570a2d7fa41ddae887c1367 (patch)
tree86f1a9e5322b57c1b2567a1e85b308e0ff932816 /winsup/cygwin/fhandler.h
parent8931495a1417c7dc1b6c56d0120efb40a1fa030b (diff)
* cygwin.din: Export fdopendir.
* dir.cc (opendir): Call fhandler's opendir with fd set to -1. (fdopendir): New function. (seekdir64): Use dirent_info_mask. (rewinddir): Ditto. (closedir): Only release underlying file descriptor if it has been reserved by opendir itself. * fhandler.cc (fhandler_base::opendir): Accommodate new parameter. * fhandler.h (dirent_states): Add dirent_valid_fd and dirent_info_mask. (fhander_XXX::opendir): Add file descriptor parameter. Use regparms. (fhandler_procnet::opendir): Drop declaration. * fhandler_disk_file.cc (fhandler_disk_file::opendir): Ditto. If called from fdopendir, use existing handle to re-open directory with valid flags. Rename fd to cfd. Use only if no valid incoming fd. (fhandler_cygdrive::opendir): Accommodate new parameter. * fhandler_process.cc (fhandler_process::opendir): Ditto. * fhandler_procnet.cc (fhandler_procnet::opendir): Drop definition. * fhandler_virtual.cc (fhandler_virtual::opendir): Accommodate new parameter. Only create new file descriptor entry if called from opendir. Remove duplicated setting of dir->__flags. * posix.sgml: Add fdopendir to list of implemented Solaris functions. * include/cygwin/version.h: Bump API minor number. * include/sys/dirent.h: Declare fdopendir.
Diffstat (limited to 'winsup/cygwin/fhandler.h')
-rw-r--r--winsup/cygwin/fhandler.h17
1 files changed, 10 insertions, 7 deletions
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index 814054399..b41838c5a 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -51,7 +51,11 @@ enum dirent_states
dirent_saw_eof = 0x0004,
dirent_isroot = 0x0008,
dirent_set_d_ino = 0x0010,
- dirent_get_d_ino = 0x0020
+ dirent_get_d_ino = 0x0020,
+ dirent_valid_fd = 0x0040,
+
+ /* Global flags which must not be deleted on rewinddir or seekdir. */
+ dirent_info_mask = 0x0078
};
enum conn_state
@@ -356,7 +360,7 @@ class fhandler_base
virtual void set_eof () {}
virtual int mkdir (mode_t mode);
virtual int rmdir ();
- virtual DIR *opendir ();
+ virtual DIR *opendir (int fd) __attribute__ ((regparm (2)));
virtual int readdir (DIR *, dirent *) __attribute__ ((regparm (3)));
virtual _off64_t telldir (DIR *);
virtual void seekdir (DIR *, _off64_t);
@@ -705,7 +709,7 @@ class fhandler_disk_file: public fhandler_base
_off64_t offset, DWORD size, void *address);
int mkdir (mode_t mode);
int rmdir ();
- DIR *opendir ();
+ DIR *opendir (int fd) __attribute__ ((regparm (2)));
int readdir (DIR *, dirent *) __attribute__ ((regparm (3)));
_off64_t telldir (DIR *);
void seekdir (DIR *, _off64_t);
@@ -725,7 +729,7 @@ class fhandler_cygdrive: public fhandler_disk_file
fhandler_cygdrive ();
int open (int flags, mode_t mode);
int close ();
- DIR *opendir ();
+ DIR *opendir (int fd) __attribute__ ((regparm (2)));
int readdir (DIR *, dirent *) __attribute__ ((regparm (3)));
void rewinddir (DIR *);
int closedir (DIR *);
@@ -1221,7 +1225,7 @@ class fhandler_virtual : public fhandler_base
virtual ~fhandler_virtual();
virtual int exists();
- virtual DIR *opendir ();
+ DIR *opendir (int fd) __attribute__ ((regparm (2)));
_off64_t telldir (DIR *);
void seekdir (DIR *, _off64_t);
void rewinddir (DIR *);
@@ -1297,7 +1301,7 @@ class fhandler_process: public fhandler_proc
public:
fhandler_process ();
int exists();
- DIR *opendir ();
+ DIR *opendir (int fd) __attribute__ ((regparm (2)));
int readdir (DIR *, dirent *) __attribute__ ((regparm (3)));
int open (int flags, mode_t mode = 0);
int __stdcall fstat (struct __stat64 *buf) __attribute__ ((regparm (2)));
@@ -1310,7 +1314,6 @@ class fhandler_procnet: public fhandler_proc
public:
fhandler_procnet ();
int exists();
- DIR *opendir ();
int readdir (DIR *, dirent *) __attribute__ ((regparm (3)));
int open (int flags, mode_t mode = 0);
int __stdcall fstat (struct __stat64 *buf) __attribute__ ((regparm (2)));