2000-08-22 11:58:47 +08:00
|
|
|
/* cygerrno.h: main Cygwin header file.
|
|
|
|
|
|
|
|
Copyright 2000 Red Hat, Inc.
|
|
|
|
|
|
|
|
This file is part of Cygwin.
|
|
|
|
|
|
|
|
This software is a copyrighted work licensed under the terms of the
|
|
|
|
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
|
|
|
details. */
|
|
|
|
|
2000-10-17 07:55:58 +08:00
|
|
|
void __stdcall seterrno_from_win_error (const char *file, int line, DWORD code) __attribute__ ((regparm(3)));
|
|
|
|
void __stdcall seterrno (const char *, int line) __attribute__ ((regparm(2)));
|
2001-02-22 22:51:16 +08:00
|
|
|
int __stdcall geterrno_from_win_error (DWORD code, int deferrno) __attribute__ ((regparm(2)));
|
2000-08-22 11:58:47 +08:00
|
|
|
|
|
|
|
#define __seterrno() seterrno (__FILE__, __LINE__)
|
|
|
|
#define __seterrno_from_win_error(val) seterrno_from_win_error (__FILE__, __LINE__, val)
|
|
|
|
|
2001-10-16 11:31:50 +08:00
|
|
|
#ifndef DEBUGGING
|
2000-08-22 11:58:47 +08:00
|
|
|
#define set_errno(val) (_impure_ptr->_errno = (val))
|
2001-10-16 11:31:50 +08:00
|
|
|
#else
|
2001-10-23 05:09:41 +08:00
|
|
|
int __stdcall __set_errno (const char *ln, int ln, int val) __attribute ((regparm(3)));
|
2001-10-16 11:31:50 +08:00
|
|
|
#define set_errno(val) __set_errno (__PRETTY_FUNCTION__, __LINE__, (val))
|
|
|
|
#endif
|
2000-08-22 11:58:47 +08:00
|
|
|
#define get_errno() (_impure_ptr->_errno)
|
|
|
|
extern "C" void __stdcall set_sig_errno (int e);
|
|
|
|
|
|
|
|
class save_errno
|
|
|
|
{
|
|
|
|
int saved;
|
|
|
|
public:
|
|
|
|
save_errno () {saved = get_errno ();}
|
|
|
|
save_errno (int what) {saved = get_errno (); set_errno (what); }
|
|
|
|
void set (int what) {set_errno (what); saved = what;}
|
|
|
|
void reset () {saved = get_errno ();}
|
|
|
|
~save_errno () {set_errno (saved);}
|
|
|
|
};
|
|
|
|
|
|
|
|
extern const char *__sp_fn;
|
|
|
|
extern int __sp_ln;
|