Cygwin: clean error mapping

- Move definition of windows to POSIX error mapping struct into
  cygerrno.h
- Move declaration of winsock errno functions to cygerrno.h
- Input to error mapping functions is DWORD

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen
2018-02-20 17:59:45 +01:00
parent 0a3f4e6087
commit 044ab77dcc
4 changed files with 18 additions and 23 deletions

View File

@@ -11,6 +11,13 @@ details. */
#include <errno.h>
#include "regparm.h"
struct errmap_t
{
DWORD w; /* windows version of error */
const char *s; /* text of windows version */
int e; /* errno version of error */
};
void __reg3 seterrno_from_win_error (const char *file, int line, DWORD code);
void __reg3 seterrno_from_nt_status (const char *file, int line, NTSTATUS status);
int __reg2 geterrno_from_win_error (DWORD code = GetLastError (), int deferrno = 13 /*EACCESS*/);
@@ -34,6 +41,9 @@ __set_errno (const char *fn, int ln, int val)
}
#define set_errno(val) __set_errno (__PRETTY_FUNCTION__, __LINE__, (val))
void __reg2 __set_winsock_errno (const char *fn, int ln);
#define set_winsock_errno() __set_winsock_errno (__FUNCTION__, __LINE__)
#define get_errno() (errno)
extern "C" void __stdcall set_sig_errno (int e);