From 6259826eb42c86df34de98158c424060f98e3fa9 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 4 Jul 2010 17:12:27 +0000 Subject: [PATCH] * path.cc (path_conv::check): Move fs-specific settings to a point where we know that we have filled out the filesystem information. * path.h (path_conv::path_conv): Use consistent initialization for constructors. * include/sys/cygwin.h: Define CW_STRERROR. * include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR to 228. * include/external.h: Implement CW_STRERROR. --- winsup/cygwin/ChangeLog | 11 +++++++++++ winsup/cygwin/external.cc | 8 +++++++- winsup/cygwin/include/cygwin/version.h | 5 +++-- winsup/cygwin/include/sys/cygwin.h | 3 ++- winsup/cygwin/path.cc | 20 ++++++++++---------- winsup/cygwin/path.h | 9 ++++++--- 6 files changed, 39 insertions(+), 17 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index cc7e9b3ee..4b697be2c 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,14 @@ +2010-07-04 Christopher Faylor + + * path.cc (path_conv::check): Move fs-specific settings to a point + where we know that we have filled out the filesystem information. + * path.h (path_conv::path_conv): Use consistent initialization for + constructors. + + * include/sys/cygwin.h: Define CW_STRERROR. + * include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR to 228. + * include/external.h: Implement CW_STRERROR. + 2010-07-02 Corinna Vinschen * net.cc (cygwin_getsockopt): Make sure SO_PEERCRED is only handled diff --git a/winsup/cygwin/external.cc b/winsup/cygwin/external.cc index d76000916..e01c9fea6 100644 --- a/winsup/cygwin/external.cc +++ b/winsup/cygwin/external.cc @@ -197,7 +197,7 @@ extern "C" unsigned long cygwin_internal (cygwin_getinfo_types t, ...) { va_list arg; - unsigned long res = -1; + uintptr_t res = (uintptr_t) -1; va_start (arg, t); switch (t) @@ -508,6 +508,12 @@ cygwin_internal (cygwin_getinfo_types t, ...) } } break; + case CW_STRERROR: + { + int err = va_arg (arg, int); + res = (uintptr_t) strerror (err); + } + break; default: set_errno (ENOSYS); diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h index 08ffebcf2..3a95e51e5 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -386,13 +386,14 @@ details. */ 224: Export xdr* functions. 225: Export __xdr* functions. 226: Export __locale_mb_cur_max. - 227: Add pseudo_reloc_start, pseudo_reloc_end, image_base to per_process + 227: Add pseudo_reloc_start, pseudo_reloc_end, image_base to per_process. + 228: CW_STRERROR added. */ /* Note that we forgot to bump the api for ualarm, strtoll, strtoull */ #define CYGWIN_VERSION_API_MAJOR 0 -#define CYGWIN_VERSION_API_MINOR 227 +#define CYGWIN_VERSION_API_MINOR 228 /* There is also a compatibity version number associated with the shared memory regions. It is incremented when incompatible diff --git a/winsup/cygwin/include/sys/cygwin.h b/winsup/cygwin/include/sys/cygwin.h index dcf61b081..d6df27df9 100644 --- a/winsup/cygwin/include/sys/cygwin.h +++ b/winsup/cygwin/include/sys/cygwin.h @@ -148,7 +148,8 @@ typedef enum CW_GET_INSTKEY, CW_INT_SETLOCALE, CW_CVT_MNT_OPTS, - CW_LST_MNT_OPTS + CW_LST_MNT_OPTS, + CW_STRERROR } cygwin_getinfo_types; /* Token type for CW_SET_EXTERNAL_TOKEN */ diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index dadbeca4d..dbdd8c423 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -861,16 +861,6 @@ is_virtual_symlink: { fileattr = sym.fileattr; path_flags = sym.pflags; - /* If the FS has been found to have unrelibale inodes, note - that in path_flags. */ - if (!fs.hasgood_inode ()) - path_flags |= PATH_IHASH; - /* If the OS is caseinsensitive or the FS is caseinsensitive, - don't handle path casesensitive. */ - if (cygwin_shared->obcaseinsensitive || fs.caseinsensitive ()) - path_flags |= PATH_NOPOSIX; - caseinsensitive = (path_flags & PATH_NOPOSIX) - ? OBJ_CASE_INSENSITIVE : 0; } /* If symlink.check found an existing non-symlink file, then @@ -1057,6 +1047,16 @@ out: but set it to not executable since it will be figured out later by anything which cares about this. */ } + /* If the FS has been found to have unrelibale inodes, note + that in path_flags. */ + if (!fs.hasgood_inode ()) + path_flags |= PATH_IHASH; + /* If the OS is caseinsensitive or the FS is caseinsensitive, + don't handle path casesensitive. */ + if (cygwin_shared->obcaseinsensitive || fs.caseinsensitive ()) + path_flags |= PATH_NOPOSIX; + caseinsensitive = (path_flags & PATH_NOPOSIX) + ? OBJ_CASE_INSENSITIVE : 0; if (exec_state () != dont_know_if_executable) /* ok */; else if (isdir ()) diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h index a2396f1f7..947e83530 100644 --- a/winsup/cygwin/path.h +++ b/winsup/cygwin/path.h @@ -207,21 +207,24 @@ class path_conv path_conv (int, const char *src, unsigned opt = PC_SYM_FOLLOW, const suffix_info *suffixes = NULL) - : wide_path (NULL), path (NULL), normalized_path (NULL) + : fileattr (INVALID_FILE_ATTRIBUTES), wide_path (NULL), path (NULL), + path_flags (0), known_suffix (NULL), normalized_path (NULL), error (0) { check (src, opt, suffixes); } path_conv (const UNICODE_STRING *src, unsigned opt = PC_SYM_FOLLOW, const suffix_info *suffixes = NULL) - : wide_path (NULL), path (NULL), normalized_path (NULL) + : fileattr (INVALID_FILE_ATTRIBUTES), wide_path (NULL), path (NULL), + path_flags (0), known_suffix (NULL), normalized_path (NULL), error (0) { check (src, opt | PC_NULLEMPTY, suffixes); } path_conv (const char *src, unsigned opt = PC_SYM_FOLLOW, const suffix_info *suffixes = NULL) - : wide_path (NULL), path (NULL), normalized_path (NULL) + : fileattr (INVALID_FILE_ATTRIBUTES), wide_path (NULL), path (NULL), + path_flags (0), known_suffix (NULL), normalized_path (NULL), error (0) { check (src, opt | PC_NULLEMPTY, suffixes); }