From c492992f13f8a270e535fb49a50315c247e3848b Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 5 Jul 2010 16:59:56 +0000 Subject: 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. --- winsup/cygwin/dir.cc | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'winsup/cygwin/dir.cc') diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc index 641aabe4b..c51cff701 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 */ -- cgit v1.2.3