* dir.cc (readdir_workdir): Only fill out d_ino when linked into older app.

* include/cygwin/version.h: Bump api minor number to 147, reflecting
obsolescence of d_ino.
(CYGWIN_VERSION_USER_API_VERSION_COMBINED): New convenience macro.
(CYGWIN_VERSION_CHECK_FOR_NEEDS_D_INO): New convenience macro.
This commit is contained in:
Christopher Faylor 2005-12-05 21:02:53 +00:00
parent 4535b5961f
commit c34aee9b23
4 changed files with 69 additions and 56 deletions

View File

@ -1,3 +1,12 @@
2005-12-05 Christopher Faylor <cgf@timesys.com>
* dir.cc (readdir_workdir): Only fill out d_ino when linked into older
app.
* include/cygwin/version.h: Bump api minor number to 147, reflecting
obsolescence of d_ino.
(CYGWIN_VERSION_USER_API_VERSION_COMBINED): New convenience macro.
(CYGWIN_VERSION_CHECK_FOR_NEEDS_D_INO): New convenience macro.
2005-12-05 Christopher Faylor <cgf@timesys.com> 2005-12-05 Christopher Faylor <cgf@timesys.com>
Remove unneeded whitespace. Remove unneeded whitespace.

View File

@ -24,6 +24,8 @@ details. */
#include "dtable.h" #include "dtable.h"
#include "cygheap.h" #include "cygheap.h"
#include "cygtls.h" #include "cygtls.h"
#include "perprocess.h"
#include "cygwin/version.h"
extern "C" int extern "C" int
dirfd (DIR *dir) dirfd (DIR *dir)
@ -99,43 +101,49 @@ readdir_worker (DIR *dir, dirent *de)
} }
if (!res) if (!res)
{ if (!CYGWIN_VERSION_CHECK_FOR_NEEDS_D_INO)
/* Compute d_ino by combining filename hash with the directory hash {
(which was stored in dir->__d_dirhash when opendir was called). */ de->__deprecated_d_ino = 0;
if (de->d_name[0] == '.') de->__ino32 = 0;
{ }
if (de->d_name[1] == '\0') else
{ {
de->d_ino = dir->__d_dirhash; /* Compute __deprecated_d_ino by combining filename hash with the directory hash
dir->__flags |= dirent_saw_dot; (which was stored in dir->__d_dirhash when opendir was called). */
} if (de->d_name[0] == '.')
else if (de->d_name[1] != '.' || de->d_name[2] != '\0') {
goto hashit; if (de->d_name[1] == '\0')
else {
{ de->__deprecated_d_ino = dir->__d_dirhash;
dir->__flags |= dirent_saw_dot_dot; dir->__flags |= dirent_saw_dot;
char *p, up[strlen (dir->__d_dirname) + 1]; }
strcpy (up, dir->__d_dirname); else if (de->d_name[1] != '.' || de->d_name[2] != '\0')
if (!(p = strrchr (up, '\\'))) goto hashit;
goto hashit; else
*p = '\0'; {
if (!(p = strrchr (up, '\\'))) dir->__flags |= dirent_saw_dot_dot;
de->d_ino = hash_path_name (0, "."); char *p, up[strlen (dir->__d_dirname) + 1];
else strcpy (up, dir->__d_dirname);
{ if (!(p = strrchr (up, '\\')))
*p = '\0'; goto hashit;
de->d_ino = hash_path_name (0, up); *p = '\0';
} if (!(p = strrchr (up, '\\')))
} de->__deprecated_d_ino = hash_path_name (0, ".");
} else
else {
{ *p = '\0';
hashit: de->__deprecated_d_ino = hash_path_name (0, up);
__ino64_t dino = hash_path_name (dir->__d_dirhash, "\\"); }
de->d_ino = hash_path_name (dino, de->d_name); }
} }
de->__ino32 = de->d_ino; // for legacy applications else
} {
hashit:
__ino64_t dino = hash_path_name (dir->__d_dirhash, "\\");
de->__deprecated_d_ino = hash_path_name (dino, de->d_name);
}
de->__ino32 = de->__deprecated_d_ino; // for legacy applications
}
return res; return res;
} }

View File

@ -63,43 +63,38 @@ details. */
#define CYGWIN_VERSION_DLL_BAD_SIGNAL_MASK 19005 #define CYGWIN_VERSION_DLL_BAD_SIGNAL_MASK 19005
#define CYGWIN_VERSION_USER_API_VERSION_COMBINED \
CYGWIN_VERSION_DLL_MAKE_COMBINED (user_data->api_major, user_data->api_minor)
/* API versions <= this had a termios structure whose members were /* API versions <= this had a termios structure whose members were
too small to accomodate modern settings. */ too small to accomodate modern settings. */
#define CYGWIN_VERSION_DLL_OLD_TERMIOS 5 #define CYGWIN_VERSION_DLL_OLD_TERMIOS 5
#define CYGWIN_VERSION_DLL_IS_OLD_TERMIOS \ #define CYGWIN_VERSION_DLL_IS_OLD_TERMIOS \
(CYGWIN_VERSION_DLL_MAKE_COMBINED (user_data->api_major, user_data->api_minor) <= \ (CYGWIN_VERSION_USER_API_VERSION_COMBINED <= CYGWIN_VERSION_DLL_OLD_TERMIOS)
CYGWIN_VERSION_DLL_OLD_TERMIOS)
#define CYGWIN_VERSION_DLL_MALLOC_ENV 28 #define CYGWIN_VERSION_DLL_MALLOC_ENV 28
/* Old APIs had getc/putc macros that conflict with new CR/LF /* Old APIs had getc/putc macros that conflict with new CR/LF
handling in the stdio buffers */ handling in the stdio buffers */
#define CYGWIN_VERSION_OLD_STDIO_CRLF_HANDLING \ #define CYGWIN_VERSION_OLD_STDIO_CRLF_HANDLING \
(CYGWIN_VERSION_DLL_MAKE_COMBINED (user_data->api_major, user_data->api_minor) <= \ (CYGWIN_VERSION_USER_API_VERSION_COMBINED <= 20)
20)
#define CYGWIN_VERSION_CHECK_FOR_S_IEXEC \ #define CYGWIN_VERSION_CHECK_FOR_S_IEXEC \
(CYGWIN_VERSION_DLL_MAKE_COMBINED (user_data->api_major, user_data->api_minor) >= \ (CYGWIN_VERSION_USER_API_VERSION_COMBINED >= 36)
36)
#define CYGWIN_VERSION_CHECK_FOR_OLD_O_NONBLOCK \ #define CYGWIN_VERSION_CHECK_FOR_OLD_O_NONBLOCK \
(CYGWIN_VERSION_DLL_MAKE_COMBINED (user_data->api_major, user_data->api_minor) <= \ (CYGWIN_VERSION_USER_API_VERSION_COMBINED <= 28)
28)
#define CYGWIN_VERSION_CHECK_FOR_USING_BIG_TYPES \ #define CYGWIN_VERSION_CHECK_FOR_USING_BIG_TYPES \
(CYGWIN_VERSION_DLL_MAKE_COMBINED (user_data->api_major, user_data->api_minor) >= \ (CYGWIN_VERSION_USER_API_VERSION_COMBINED >= 79)
79)
#define CYGWIN_VERSION_CHECK_FOR_USING_ANCIENT_MSGHDR \ #define CYGWIN_VERSION_CHECK_FOR_USING_ANCIENT_MSGHDR \
(CYGWIN_VERSION_DLL_MAKE_COMBINED (user_data->api_major, user_data->api_minor) <= \ (CYGWIN_VERSION_USER_API_VERSION_COMBINED <= 138)
138)
#define CYGWIN_VERSION_CHECK_FOR_USING_WINSOCK1_VALUES \ #define CYGWIN_VERSION_CHECK_FOR_USING_WINSOCK1_VALUES \
(CYGWIN_VERSION_DLL_MAKE_COMBINED (user_data->api_major, user_data->api_minor) <= \ (CYGWIN_VERSION_USER_API_VERSION_COMBINED <= 138)
138)
/* We used to use the DLL major/minor to track #define CYGWIN_VERSION_CHECK_FOR_NEEDS_D_INO \
non-backward-compatible interface changes to the API. Now we (CYGWIN_VERSION_USER_API_VERSION_COMBINED < 147)
use an API major/minor number for this purpose. */
/* API_MAJOR 0.0: Initial version. API_MINOR changes: /* API_MAJOR 0.0: Initial version. API_MINOR changes:
1: Export cygwin32_ calls as cygwin_ as well. 1: Export cygwin32_ calls as cygwin_ as well.
@ -285,12 +280,13 @@ details. */
145: Add MAP_NORESERVE flag to mmap. 145: Add MAP_NORESERVE flag to mmap.
146: Change SI_USER definition. FIXME: Need to develop compatibility macro 146: Change SI_USER definition. FIXME: Need to develop compatibility macro
for this? for this?
147: Eliminate problematic d_ino from dirent structure.
*/ */
/* Note that we forgot to bump the api for ualarm, strtoll, strtoull */ /* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
#define CYGWIN_VERSION_API_MAJOR 0 #define CYGWIN_VERSION_API_MAJOR 0
#define CYGWIN_VERSION_API_MINOR 146 #define CYGWIN_VERSION_API_MINOR 147
/* There is also a compatibity version number associated with the /* There is also a compatibity version number associated with the
shared memory regions. It is incremented when incompatible shared memory regions. It is incremented when incompatible

View File

@ -20,7 +20,7 @@
struct dirent struct dirent
{ {
long d_version; /* Used since Cygwin 1.3.3. */ long d_version; /* Used since Cygwin 1.3.3. */
__ino64_t d_ino; /* still junk but with more bits */ __ino64_t __deprecated_d_ino; /* still junk but with more bits */
long d_fd; /* File descriptor of open directory. long d_fd; /* File descriptor of open directory.
Used since Cygwin 1.3.3. */ Used since Cygwin 1.3.3. */
unsigned __ino32; unsigned __ino32;