* dir.cc (readdir): Fill out new old_d_ino field.
* fhandler.h (fhandler_base::namehash): Define as ino_t. (fhandler_base::get_namehash): Ditto. * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Accommodate new 64 bit st_ino. * fhandler_socket.cc (fhandler_socket::fstat): Ditto. * path.cc (hash_path_name): Return ino_t. * syscalls.cc (stat64_to_stat32): Convert 64 bit inode to 32 bit. * winsup.h (hash_path_name): Declare as returning ino_t. * include/cygwin/stat.h (__stat32): Use 32 bit st_ino. (__stat64): Use 64 bit st_ino. * include/cygwin/types.h (__ino64_t): Define. (__ino32_t): Ditto. (ino_t): Define appropriately.
This commit is contained in:
@@ -10,6 +10,7 @@ details. */
|
||||
|
||||
#define _sys_nerr FOO_sys_nerr
|
||||
#define sys_nerr FOOsys_nerr
|
||||
#define _sys_errlist FOO_sys_errlist
|
||||
#include "winsup.h"
|
||||
#define _REENT_ONLY
|
||||
#include <stdio.h>
|
||||
@@ -18,6 +19,7 @@ details. */
|
||||
#include "thread.h"
|
||||
#undef _sys_nerr
|
||||
#undef sys_nerr
|
||||
#undef _sys_errlist
|
||||
|
||||
/* Table to map Windows error codes to Errno values. */
|
||||
/* FIXME: Doing things this way is a little slow. It's trivial to change
|
||||
@@ -25,13 +27,12 @@ details. */
|
||||
|
||||
#define X(w, e) {ERROR_##w, #w, e}
|
||||
|
||||
static const NO_COPY struct
|
||||
{
|
||||
DWORD w; /* windows version of error */
|
||||
const char *s; /* text of windows version */
|
||||
int e; /* errno version of error */
|
||||
}
|
||||
errmap[] =
|
||||
static NO_COPY struct
|
||||
{
|
||||
DWORD w; /* windows version of error */
|
||||
const char *s; /* text of windows version */
|
||||
int e; /* errno version of error */
|
||||
} errmap[] =
|
||||
{
|
||||
/* FIXME: Some of these choices are arbitrary! */
|
||||
X (INVALID_FUNCTION, EBADRQC),
|
||||
@@ -116,42 +117,8 @@ errmap[] =
|
||||
{ 0, NULL, 0}
|
||||
};
|
||||
|
||||
int __stdcall
|
||||
geterrno_from_win_error (DWORD code, int deferrno)
|
||||
{
|
||||
for (int i = 0; errmap[i].w != 0; ++i)
|
||||
if (code == errmap[i].w)
|
||||
{
|
||||
syscall_printf ("windows error %u == errno %d", code, errmap[i].e);
|
||||
return errmap[i].e;
|
||||
}
|
||||
|
||||
syscall_printf ("unknown windows error %u, setting errno to %d", code,
|
||||
deferrno);
|
||||
return deferrno; /* FIXME: what's so special about EACCESS? */
|
||||
}
|
||||
|
||||
/* seterrno_from_win_error: Given a Windows error code, set errno
|
||||
as appropriate. */
|
||||
void __stdcall
|
||||
seterrno_from_win_error (const char *file, int line, DWORD code)
|
||||
{
|
||||
syscall_printf ("%s:%d windows error %d", file, line, code);
|
||||
set_errno (geterrno_from_win_error (code, EACCES));
|
||||
return;
|
||||
}
|
||||
|
||||
/* seterrno: Set `errno' based on GetLastError (). */
|
||||
void __stdcall
|
||||
seterrno (const char *file, int line)
|
||||
{
|
||||
seterrno_from_win_error (file, line, GetLastError ());
|
||||
}
|
||||
|
||||
extern char *_user_strerror _PARAMS ((int));
|
||||
|
||||
extern "C" {
|
||||
const NO_COPY char __declspec(dllexport) * const _sys_errlist[]=
|
||||
const char __declspec(dllexport) * _sys_errlist[] NO_COPY_INIT =
|
||||
{
|
||||
/* NOERROR 0 */ "No error",
|
||||
/* EPERM 1 */ "Operation not permitted",
|
||||
@@ -295,9 +262,43 @@ const NO_COPY char __declspec(dllexport) * const _sys_errlist[]=
|
||||
/* EOVERFLOW 139 */ "Value too large for defined data type"
|
||||
};
|
||||
|
||||
extern const int NO_COPY __declspec(dllexport) _sys_nerr = sizeof (_sys_errlist) / sizeof (_sys_errlist[0]);
|
||||
int NO_COPY_INIT _sys_nerr = sizeof (_sys_errlist) / sizeof (_sys_errlist[0]);
|
||||
};
|
||||
|
||||
int __stdcall
|
||||
geterrno_from_win_error (DWORD code, int deferrno)
|
||||
{
|
||||
for (int i = 0; errmap[i].w != 0; ++i)
|
||||
if (code == errmap[i].w)
|
||||
{
|
||||
syscall_printf ("windows error %u == errno %d", code, errmap[i].e);
|
||||
return errmap[i].e;
|
||||
}
|
||||
|
||||
syscall_printf ("unknown windows error %u, setting errno to %d", code,
|
||||
deferrno);
|
||||
return deferrno; /* FIXME: what's so special about EACCESS? */
|
||||
}
|
||||
|
||||
/* seterrno_from_win_error: Given a Windows error code, set errno
|
||||
as appropriate. */
|
||||
void __stdcall
|
||||
seterrno_from_win_error (const char *file, int line, DWORD code)
|
||||
{
|
||||
syscall_printf ("%s:%d windows error %d", file, line, code);
|
||||
set_errno (geterrno_from_win_error (code, EACCES));
|
||||
return;
|
||||
}
|
||||
|
||||
/* seterrno: Set `errno' based on GetLastError (). */
|
||||
void __stdcall
|
||||
seterrno (const char *file, int line)
|
||||
{
|
||||
seterrno_from_win_error (file, line, GetLastError ());
|
||||
}
|
||||
|
||||
extern char *_user_strerror _PARAMS ((int));
|
||||
|
||||
/* FIXME: Why is strerror() a long switch and not just:
|
||||
return sys_errlist[errnum];
|
||||
(or moral equivalent).
|
||||
|
Reference in New Issue
Block a user