* cygerrno.h (seterrno_from_nt_status): Declare.
(__seterrno_from_nt_status): Call seterrno_from_nt_status. * errno.cc (seterrno_from_win_error): Set errno without calling set_errno to avoid packing strace output with errno messages. (seterrno_from_nt_status): New function to print NT status as well as resulting Windows error.
This commit is contained in:
		| @@ -1,3 +1,12 @@ | ||||
| 2010-04-16  Corinna Vinschen  <corinna@vinschen.de> | ||||
|  | ||||
| 	* cygerrno.h (seterrno_from_nt_status): Declare. | ||||
| 	(__seterrno_from_nt_status): Call seterrno_from_nt_status. | ||||
| 	* errno.cc (seterrno_from_win_error): Set errno without calling | ||||
| 	set_errno to avoid packing strace output with errno messages. | ||||
| 	(seterrno_from_nt_status): New function to print NT status as well as | ||||
| 	resulting Windows error. | ||||
|  | ||||
| 2010-04-15  Corinna Vinschen  <corinna@vinschen.de> | ||||
|  | ||||
| 	* kernel32.cc (CreateEventW): Create event object with EVENT_ALL_ACCESS | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| /* cygerrno.h: main Cygwin header file. | ||||
|  | ||||
|    Copyright 2000, 2001, 2002, 2003, 2004 Red Hat, Inc. | ||||
|    Copyright 2000, 2001, 2002, 2003, 2004, 2010 Red Hat, Inc. | ||||
|  | ||||
| This file is part of Cygwin. | ||||
|  | ||||
| @@ -13,17 +13,13 @@ details. */ | ||||
| #include <errno.h> | ||||
|  | ||||
| void __stdcall seterrno_from_win_error (const char *file, int line, DWORD code) __attribute__ ((regparm(3))); | ||||
| void __stdcall seterrno_from_nt_status (const char *file, int line, NTSTATUS status) __attribute__ ((regparm(3))); | ||||
| void __stdcall seterrno (const char *, int line) __attribute__ ((regparm(2))); | ||||
| int __stdcall geterrno_from_win_error (DWORD code = GetLastError (), int deferrno = 13 /*EACCESS*/) __attribute__ ((regparm(2))); | ||||
|  | ||||
| #define __seterrno() seterrno (__FILE__, __LINE__) | ||||
| #define __seterrno_from_win_error(val) seterrno_from_win_error (__FILE__, __LINE__, val) | ||||
| #define __seterrno_from_nt_status(status) \ | ||||
| 	({ \ | ||||
| 	  DWORD winerr = RtlNtStatusToDosError (status); \ | ||||
| 	  SetLastError (winerr); \ | ||||
| 	  __seterrno_from_win_error (winerr); \ | ||||
| 	}) | ||||
| #define __seterrno_from_nt_status(status) seterrno_from_nt_status (__FILE__, __LINE__, status) | ||||
|  | ||||
| inline int | ||||
| __set_errno (const char *fn, int ln, int val) | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| /* errno.cc: errno-related functions | ||||
|  | ||||
|    Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, | ||||
|    2006, 2008, 2009 Red Hat, Inc. | ||||
|    2006, 2008, 2009, 2010 Red Hat, Inc. | ||||
|  | ||||
| This file is part of Cygwin. | ||||
|  | ||||
| @@ -14,6 +14,7 @@ details. */ | ||||
| #define _sys_errlist FOO_sys_errlist | ||||
| #include "winsup.h" | ||||
| #include "cygtls.h" | ||||
| #include "ntdll.h" | ||||
| #undef _sys_nerr | ||||
| #undef sys_nerr | ||||
| #undef _sys_errlist | ||||
| @@ -316,7 +317,19 @@ 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)); | ||||
|   errno = _impure_ptr->_errno =  geterrno_from_win_error (code, EACCES); | ||||
| } | ||||
|  | ||||
| /* seterrno_from_nt_status: Given a NT status code, set errno | ||||
|    as appropriate. */ | ||||
| void __stdcall | ||||
| seterrno_from_nt_status (const char *file, int line, NTSTATUS status) | ||||
| { | ||||
|   DWORD code = RtlNtStatusToDosError (status); | ||||
|   SetLastError (code); | ||||
|   syscall_printf ("%s:%d status %p -> windows error %d", | ||||
| 		  file, line, status, code); | ||||
|   errno = _impure_ptr->_errno =  geterrno_from_win_error (code, EACCES); | ||||
| } | ||||
|  | ||||
| /* seterrno: Set `errno' based on GetLastError (). */ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user