diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2010-07-05 16:59:56 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2010-07-05 16:59:56 +0000 |
commit | c492992f13f8a270e535fb49a50315c247e3848b (patch) | |
tree | de1653f49b1940cee039b3fdbb9e8d66020026ce | |
parent | c8fe6dc446e6e106514dcc8755c682e6d8455268 (diff) | |
download | newlib-c492992f13f8a270e535fb49a50315c247e3848b.zip newlib-c492992f13f8a270e535fb49a50315c247e3848b.tar.gz newlib-c492992f13f8a270e535fb49a50315c247e3848b.tar.bz2 |
Align seekdir and telldir API to POSIX definition.
* Makefile.in (NEW_FUNCTIONS): Remove seekdir and telldir mappings.
* dir.cc (telldir): Move functionality from telldir64 here. Use
long, rather than _off_t.
(telldir64): Just call telldir. Only keep for backward compatibility.
(seekdir): Move functionality from seekdir64 here. Use long, rather
than _off_t.
(seekdir64): Just call seekdir. Only keep for backward compatibility.
* fhandler.h: Throughout, change prototypes of seekdir and telldir
methods to use long, rather than _off64_t.
* fhandler_disk_file.cc: Change aforementioned methods accordingly.
* fhandler_netdrive.cc: Ditto.
* fhandler_registry.cc: Ditto.
* fhandler_virtual.cc: Ditto.
* include/sys/dirent.h (struct __DIR): Change __d_position from
_off_t to long to reflect API change.
(telldir): Change prototype to use long, rather than off_t.
(seekdir): Ditto.
-rw-r--r-- | winsup/cygwin/ChangeLog | 21 | ||||
-rw-r--r-- | winsup/cygwin/Makefile.in | 2 | ||||
-rw-r--r-- | winsup/cygwin/dir.cc | 26 | ||||
-rw-r--r-- | winsup/cygwin/fhandler.cc | 4 | ||||
-rw-r--r-- | winsup/cygwin/fhandler.h | 18 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_disk_file.cc | 4 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_netdrive.cc | 2 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_registry.cc | 4 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_virtual.cc | 5 | ||||
-rw-r--r-- | winsup/cygwin/include/sys/dirent.h | 6 |
10 files changed, 59 insertions, 33 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 4b697be..2d9a77c 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,24 @@ +2010-07-05 Corinna Vinschen <corinna@vinschen.de> + + Align seekdir and telldir API to POSIX definition. + * Makefile.in (NEW_FUNCTIONS): Remove seekdir and telldir mappings. + * dir.cc (telldir): Move functionality from telldir64 here. Use + long, rather than _off_t. + (telldir64): Just call telldir. Only keep for backward compatibility. + (seekdir): Move functionality from seekdir64 here. Use long, rather + than _off_t. + (seekdir64): Just call seekdir. Only keep for backward compatibility. + * fhandler.h: Throughout, change prototypes of seekdir and telldir + methods to use long, rather than _off64_t. + * fhandler_disk_file.cc: Change aforementioned methods accordingly. + * fhandler_netdrive.cc: Ditto. + * fhandler_registry.cc: Ditto. + * fhandler_virtual.cc: Ditto. + * include/sys/dirent.h (struct __DIR): Change __d_position from + _off_t to long to reflect API change. + (telldir): Change prototype to use long, rather than off_t. + (seekdir): Ditto. + 2010-07-04 Christopher Faylor <me+cygwin@cgf.cx> * path.cc (path_conv::check): Move fs-specific settings to a point diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in index 3f4c004..e4e5be6 100644 --- a/winsup/cygwin/Makefile.in +++ b/winsup/cygwin/Makefile.in @@ -210,7 +210,6 @@ NEW_FUNCTIONS:=$(addprefix --replace=,\ mknod=_mknod32 \ mmap=_mmap64 \ open=_open64 \ - seekdir=_seekdir64 \ setegid=_setegid32 \ seteuid=_seteuid32 \ setgid=_setgid32 \ @@ -219,7 +218,6 @@ NEW_FUNCTIONS:=$(addprefix --replace=,\ setreuid=_setreuid32 \ setuid=_setuid32 \ stat=_stat64 \ - telldir=_telldir64 \ timezone= \ tmpfile=_tmpfile64 \ truncate=_truncate64 \ diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc index 641aabe..c51cff7 100644 --- a/winsup/cygwin/dir.cc +++ b/winsup/cygwin/dir.cc @@ -187,8 +187,9 @@ readdir_r (DIR *dir, dirent *de, dirent **ode) return res; } -extern "C" _off64_t -telldir64 (DIR *dir) +/* telldir */ +extern "C" long +telldir (DIR *dir) { myfault efault; if (efault.faulted (EFAULT)) @@ -199,15 +200,18 @@ telldir64 (DIR *dir) return ((fhandler_base *) dir->__fh)->telldir (dir); } -/* telldir */ -extern "C" _off_t -telldir (DIR *dir) +/* telldir was never defined using off_t in POSIX, only in early versions + of glibc. We have to keep the function in as entry point for backward + compatibility. */ +extern "C" _off64_t +telldir64 (DIR *dir) { - return telldir64 (dir); + return (_off64_t) telldir (dir); } +/* seekdir */ extern "C" void -seekdir64 (DIR *dir, _off64_t loc) +seekdir (DIR *dir, long loc) { myfault efault; if (efault.faulted (EFAULT)) @@ -219,11 +223,13 @@ seekdir64 (DIR *dir, _off64_t loc) return ((fhandler_base *) dir->__fh)->seekdir (dir, loc); } -/* seekdir */ +/* seekdir was never defined using off_t in POSIX, only in early versions + of glibc. We have to keep the function in as entry point for backward + compatibility. */ extern "C" void -seekdir (DIR *dir, _off_t loc) +seekdir64 (DIR *dir, _off64_t loc) { - seekdir64 (dir, (_off64_t)loc); + seekdir (dir, (long) loc); } /* rewinddir: POSIX 5.1.2.1 */ diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index bd4422a..a8264e4 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -1441,7 +1441,7 @@ fhandler_base::readdir (DIR *, dirent *) return ENOTDIR; } -_off64_t +long fhandler_base::telldir (DIR *) { set_errno (ENOTDIR); @@ -1449,7 +1449,7 @@ fhandler_base::telldir (DIR *) } void -fhandler_base::seekdir (DIR *, _off64_t) +fhandler_base::seekdir (DIR *, long) { set_errno (ENOTDIR); } diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 561ada1..54e9d06 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -378,8 +378,8 @@ class fhandler_base virtual int rmdir (); 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); + virtual long telldir (DIR *); + virtual void seekdir (DIR *, long); virtual void rewinddir (DIR *); virtual int closedir (DIR *); virtual bool is_slow () {return false;} @@ -774,8 +774,8 @@ class fhandler_disk_file: public fhandler_base int rmdir (); DIR *opendir (int fd) __attribute__ ((regparm (2))); int readdir (DIR *, dirent *) __attribute__ ((regparm (3))); - _off64_t telldir (DIR *); - void seekdir (DIR *, _off64_t); + long telldir (DIR *); + void seekdir (DIR *, long); void rewinddir (DIR *); int closedir (DIR *); @@ -1333,8 +1333,8 @@ class fhandler_virtual : public fhandler_base virtual int exists(); DIR *opendir (int fd) __attribute__ ((regparm (2))); - _off64_t telldir (DIR *); - void seekdir (DIR *, _off64_t); + long telldir (DIR *); + void seekdir (DIR *, long); void rewinddir (DIR *); int closedir (DIR *); ssize_t __stdcall write (const void *ptr, size_t len); @@ -1372,7 +1372,7 @@ class fhandler_netdrive: public fhandler_virtual fhandler_netdrive (); int exists(); int readdir (DIR *, dirent *) __attribute__ ((regparm (3))); - void seekdir (DIR *, _off64_t); + void seekdir (DIR *, long); void rewinddir (DIR *); int closedir (DIR *); int open (int flags, mode_t mode = 0); @@ -1390,8 +1390,8 @@ class fhandler_registry: public fhandler_proc void set_name (path_conv &pc); int exists(); int readdir (DIR *, dirent *) __attribute__ ((regparm (3))); - _off64_t telldir (DIR *); - void seekdir (DIR *, _off64_t); + long telldir (DIR *); + void seekdir (DIR *, long); void rewinddir (DIR *); int closedir (DIR *); diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 00d4d4a..a284b81 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -2128,14 +2128,14 @@ go_ahead: return res; } -_off64_t +long fhandler_disk_file::telldir (DIR *dir) { return dir->__d_position; } void -fhandler_disk_file::seekdir (DIR *dir, _off64_t loc) +fhandler_disk_file::seekdir (DIR *dir, long loc) { rewinddir (dir); while (loc > dir->__d_position) diff --git a/winsup/cygwin/fhandler_netdrive.cc b/winsup/cygwin/fhandler_netdrive.cc index 4cce697..f3339a6 100644 --- a/winsup/cygwin/fhandler_netdrive.cc +++ b/winsup/cygwin/fhandler_netdrive.cc @@ -259,7 +259,7 @@ out: } void -fhandler_netdrive::seekdir (DIR *dir, _off64_t pos) +fhandler_netdrive::seekdir (DIR *dir, long pos) { rewinddir (dir); if (pos < 0) diff --git a/winsup/cygwin/fhandler_registry.cc b/winsup/cygwin/fhandler_registry.cc index 9c68b2c..e414efb 100644 --- a/winsup/cygwin/fhandler_registry.cc +++ b/winsup/cygwin/fhandler_registry.cc @@ -643,14 +643,14 @@ out: return res; } -_off64_t +long fhandler_registry::telldir (DIR * dir) { return dir->__d_position & REG_POSITION_MASK; } void -fhandler_registry::seekdir (DIR * dir, _off64_t loc) +fhandler_registry::seekdir (DIR * dir, long loc) { /* Unfortunately cannot simply set __d_position due to transition from sub-keys to * values. diff --git a/winsup/cygwin/fhandler_virtual.cc b/winsup/cygwin/fhandler_virtual.cc index c47d2cc..3becf03 100644 --- a/winsup/cygwin/fhandler_virtual.cc +++ b/winsup/cygwin/fhandler_virtual.cc @@ -97,13 +97,14 @@ fhandler_virtual::opendir (int fd) return res; } -_off64_t fhandler_virtual::telldir (DIR * dir) +long +fhandler_virtual::telldir (DIR * dir) { return dir->__d_position; } void -fhandler_virtual::seekdir (DIR * dir, _off64_t loc) +fhandler_virtual::seekdir (DIR * dir, long loc) { dir->__flags |= dirent_saw_dot | dirent_saw_dot_dot; dir->__d_position = loc; diff --git a/winsup/cygwin/include/sys/dirent.h b/winsup/cygwin/include/sys/dirent.h index fa059ec..3d441a2 100644 --- a/winsup/cygwin/include/sys/dirent.h +++ b/winsup/cygwin/include/sys/dirent.h @@ -38,7 +38,7 @@ typedef struct __DIR unsigned long __d_cookie; struct dirent *__d_dirent; char *__d_dirname; /* directory name with trailing '*' */ - _off_t __d_position; /* used by telldir/seekdir */ + long __d_position; /* used by telldir/seekdir */ int __d_fd; unsigned __d_internal; void *__handle; @@ -58,8 +58,8 @@ int dirfd (DIR *); #ifndef _POSIX_SOURCE #ifndef __INSIDE_CYGWIN__ -off_t telldir (DIR *); -void seekdir (DIR *, off_t loc); +long telldir (DIR *); +void seekdir (DIR *, long loc); #endif int scandir (const char *__dir, |