* cygerrno.h: New file. Use this throughout whenever errno manipulation is
required. * errno.cc: Use DWORD to hold Windows errors. (geterrno_from_win_error): New function. (seterrno_from_win_error): Use geterrno_from_win_error to convert supplied windows error (suggested by Corinna Vinschen). * path.cc (symlink_info): Add error element. * path.cc (path_conv::check): Remove errno setting. Use new symlink_info errno element to set path_conv error, where appropriate. (symlink_info::check): Set error element rather than attempting to manipulate errno. Add more checks for trailing / and /.. even though they are currently useless. Avoid setting EINVAL. * path.cc (normalize_posix_path): Correct check for trailing /.
This commit is contained in:
parent
6b85369f82
commit
9e2baf8dfa
|
@ -1,3 +1,22 @@
|
|||
Mon Aug 21 23:49:05 2000 Christopher Faylor <cgf@cygnus.com>
|
||||
|
||||
* cygerrno.h: New file. Use this throughout whenever errno
|
||||
manipulation is required.
|
||||
* errno.cc: Use DWORD to hold Windows errors.
|
||||
(geterrno_from_win_error): New function.
|
||||
(seterrno_from_win_error): Use geterrno_from_win_error to convert
|
||||
supplied windows error (suggested by Corinna Vinschen).
|
||||
* path.cc (symlink_info): Add error element.
|
||||
* path.cc (path_conv::check): Remove errno setting. Use new
|
||||
symlink_info errno element to set path_conv error, where appropriate.
|
||||
(symlink_info::check): Set error element rather than attempting to
|
||||
manipulate errno. Add more checks for trailing / and /.. even though
|
||||
they are currently useless. Avoid setting EINVAL.
|
||||
|
||||
Mon Aug 21 23:49:05 2000 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* path.cc (normalize_posix_path): Correct check for trailing /.
|
||||
|
||||
2000-08-21 DJ Delorie <dj@redhat.com>
|
||||
|
||||
* include/cygwin/cygwin_dll.h (DECLARE_CYGWIN_DLL): hinstance,
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
/* 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. */
|
||||
|
||||
void __stdcall seterrno_from_win_error (const char *file, int line, DWORD code);
|
||||
void __stdcall seterrno (const char *, int line);
|
||||
int __stdcall geterrno_from_win_error (DWORD code, int deferrno);
|
||||
|
||||
#define __seterrno() seterrno (__FILE__, __LINE__)
|
||||
#define __seterrno_from_win_error(val) seterrno_from_win_error (__FILE__, __LINE__, val)
|
||||
|
||||
#define set_errno(val) (_impure_ptr->_errno = (val))
|
||||
#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;
|
|
@ -18,6 +18,7 @@ details. */
|
|||
#include <ctype.h>
|
||||
#include "dtable.h"
|
||||
#include "pinfo.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
#define MAX_AT_FILE_LEVEL 10
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ details. */
|
|||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#include "pinfo.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
#define _COMPILING_NEWLIB
|
||||
#include "dirent.h"
|
||||
|
|
|
@ -10,6 +10,7 @@ details. */
|
|||
#include <stdlib.h>
|
||||
#include "exceptions.h"
|
||||
#include "dll_init.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
extern void __stdcall check_sanity_and_sync (per_process *);
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ details. */
|
|||
#include <winsock.h>
|
||||
#include "dtable.h"
|
||||
#include "pinfo.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
dtable fdtab;
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ details. */
|
|||
#include <ctype.h>
|
||||
#include <fcntl.h>
|
||||
#include "pinfo.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
extern BOOL allow_glob;
|
||||
extern BOOL allow_ntea;
|
||||
|
|
|
@ -12,6 +12,7 @@ details. */
|
|||
#define _REENT_ONLY
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include "cygerrno.h"
|
||||
|
||||
/* Table to map Windows error codes to Errno values. */
|
||||
/* FIXME: Doing things this way is a little slow. It's trivial to change
|
||||
|
@ -21,7 +22,7 @@ details. */
|
|||
|
||||
static const struct
|
||||
{
|
||||
int w; /* windows version of error */
|
||||
DWORD w; /* windows version of error */
|
||||
const char *s; /* text of windows version */
|
||||
int e; /* errno version of error */
|
||||
}
|
||||
|
@ -108,34 +109,33 @@ 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
|
||||
seterrno_from_win_error (const char *file, int line, int code)
|
||||
void __stdcall
|
||||
seterrno_from_win_error (const char *file, int line, DWORD code)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; errmap[i].w != 0; ++i)
|
||||
if (code == errmap[i].w)
|
||||
break;
|
||||
|
||||
if (errmap[i].w != 0)
|
||||
{
|
||||
if (strace.active)
|
||||
strace.prntf (_STRACE_SYSCALL, NULL, "%s:%d seterrno: %d (%s) -> %d",
|
||||
file, line, code, errmap[i].s, errmap[i].e);
|
||||
set_errno (errmap[i].e);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strace.active)
|
||||
strace.prntf (_STRACE_SYSCALL, NULL, "%s:%d seterrno: unknown error %d", file, line, code);
|
||||
set_errno (EACCES);
|
||||
}
|
||||
syscall_printf ("%s:%d \b");
|
||||
set_errno (geterrno_from_win_error (code, EACCES));
|
||||
return;
|
||||
}
|
||||
|
||||
/* seterrno: Set `errno' based on GetLastError (). */
|
||||
void
|
||||
void __stdcall
|
||||
seterrno (const char *file, int line)
|
||||
{
|
||||
seterrno_from_win_error (file, line, GetLastError ());
|
||||
|
@ -672,4 +672,3 @@ strerror (int errnum)
|
|||
include files. */
|
||||
return (char *) error;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ details. */
|
|||
#include "exceptions.h"
|
||||
#include <imagehlp.h>
|
||||
#include "pinfo.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
char debugger_command[2 * MAX_PATH + 20];
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ details. */
|
|||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include "dtable.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
extern "C"
|
||||
int
|
||||
|
|
|
@ -14,6 +14,7 @@ details. */
|
|||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "cygerrno.h"
|
||||
|
||||
static NO_COPY const int CHUNK_SIZE = 1024; /* Used for crlf conversions */
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ details. */
|
|||
#include <winuser.h>
|
||||
#include <ctype.h>
|
||||
#include "pinfo.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
/*
|
||||
* Scroll the screen context.
|
||||
|
|
|
@ -13,6 +13,7 @@ details. */
|
|||
#include "winsup.h"
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include "cygerrno.h"
|
||||
|
||||
#define RANDOM 8
|
||||
#define URANDOM 9
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include <cygwin/rdevio.h>
|
||||
#include <sys/mtio.h>
|
||||
#include "cygerrno.h"
|
||||
|
||||
/* static wrapper functions to hide the effect of media changes and
|
||||
bus resets which occurs after a new media is inserted. This is
|
||||
|
|
|
@ -14,6 +14,7 @@ details. */
|
|||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include "pinfo.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
/**********************************************************************/
|
||||
/* fhandler_serial */
|
||||
|
|
|
@ -16,6 +16,7 @@ details. */
|
|||
#include <unistd.h>
|
||||
|
||||
#include <sys/mtio.h>
|
||||
#include "cygerrno.h"
|
||||
|
||||
/**********************************************************************/
|
||||
/* fhandler_dev_tape */
|
||||
|
|
|
@ -15,6 +15,7 @@ details. */
|
|||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
#include "pinfo.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
/* Common functions shared by tty/console */
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ details. */
|
|||
#include <limits.h>
|
||||
#include "dtable.h"
|
||||
#include "pinfo.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
/* Tty master stuff */
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ details. */
|
|||
#include <errno.h>
|
||||
#include <wingdi.h>
|
||||
#include <winuser.h>
|
||||
#include "cygerrno.h"
|
||||
|
||||
/*
|
||||
The following unix-style calls are supported:
|
||||
|
|
|
@ -18,6 +18,7 @@ details. */
|
|||
#include "dll_init.h"
|
||||
#include "dtable.h"
|
||||
#include "pinfo.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
DWORD NO_COPY chunksize = 0;
|
||||
/* Timeout to wait for child to start, parent to init child, etc. */
|
||||
|
|
|
@ -11,6 +11,7 @@ details. */
|
|||
#include "winsup.h"
|
||||
#include <errno.h>
|
||||
#include "pinfo.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
#define brksize ((char *) user_data->heaptop - (char *) user_data->heapbase)
|
||||
#define brk (user_data->heapptr)
|
||||
|
|
|
@ -15,6 +15,7 @@ details. */
|
|||
#include <sys/ioctl.h>
|
||||
#include <errno.h>
|
||||
#include "dtable.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
extern "C"
|
||||
int
|
||||
|
|
|
@ -15,6 +15,7 @@ details. */
|
|||
#include <errno.h>
|
||||
#include "dtable.h"
|
||||
#include "pinfo.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
/*
|
||||
* Simple class used to keep a record of all current
|
||||
|
|
|
@ -25,6 +25,7 @@ details. */
|
|||
#include <winsock.h>
|
||||
#include "dtable.h"
|
||||
#include "pinfo.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
/* We only want to initialize WinSock in a child process if socket
|
||||
handles are inheritted. This global allows us to know whether this
|
||||
|
|
|
@ -15,6 +15,7 @@ details. */
|
|||
#include <errno.h>
|
||||
#include "dtable.h"
|
||||
#include "pinfo.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
/* Read /etc/passwd only once for better performance. This is done
|
||||
on the first call that needs information from it. */
|
||||
|
|
|
@ -82,6 +82,7 @@ details. */
|
|||
#include <ctype.h>
|
||||
#include <winioctl.h>
|
||||
#include "pinfo.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
static int normalize_win32_path (const char *cwd, const char *src, char *dst);
|
||||
static char *getcwd_inner (char *buf, size_t ulen, int posix_p, int with_chroot);
|
||||
|
@ -101,6 +102,7 @@ struct symlink_info
|
|||
unsigned pflags;
|
||||
DWORD fileattr;
|
||||
int is_symlink;
|
||||
int error;
|
||||
symlink_info (): known_suffix (NULL), contents (buf + MAX_PATH + 1) {}
|
||||
int check (const char *path, const suffix_info *suffixes);
|
||||
};
|
||||
|
@ -224,7 +226,7 @@ path_conv::check (const char *src, unsigned opt,
|
|||
full_path,
|
||||
devn, unit, &path_flags);
|
||||
MALLOC_CHECK;
|
||||
if (error != 0)
|
||||
if (error)
|
||||
return;
|
||||
if (devn != FH_BAD)
|
||||
{
|
||||
|
@ -265,7 +267,6 @@ path_conv::check (const char *src, unsigned opt,
|
|||
|
||||
for (;;)
|
||||
{
|
||||
save_errno s (0);
|
||||
const suffix_info *suff;
|
||||
|
||||
/* Don't allow symlink.check to set anything in the path_conv
|
||||
|
@ -287,10 +288,11 @@ path_conv::check (const char *src, unsigned opt,
|
|||
path_flags = sym.pflags;
|
||||
|
||||
/* If symlink.check found an existing non-symlink file, then
|
||||
it returns a length of 0 and sets errno to EINVAL. It also sets
|
||||
any suffix found into `ext_here'. */
|
||||
it sets the appropriate flag. It also sets any suffix found
|
||||
into `ext_here'. */
|
||||
if (!sym.is_symlink && sym.fileattr != (DWORD) -1)
|
||||
{
|
||||
error = sym.error;
|
||||
if (component == 0)
|
||||
{
|
||||
fileattr = sym.fileattr;
|
||||
|
@ -317,7 +319,6 @@ path_conv::check (const char *src, unsigned opt,
|
|||
}
|
||||
|
||||
/* No existing file found. */
|
||||
s.reset (); // remember errno from symlink.check
|
||||
|
||||
if (!(tail = strrchr (path_copy, '\\')) ||
|
||||
(tail > path_copy && tail[-1] == ':'))
|
||||
|
@ -630,7 +631,7 @@ normalize_posix_path (const char *cwd, const char *src, char *dst)
|
|||
sawdot:
|
||||
if (src[1] != '.')
|
||||
{
|
||||
if ((src[1] && !isslash (src[1])))
|
||||
if (!src[1] || !isslash (src[1]))
|
||||
break;
|
||||
}
|
||||
else
|
||||
|
@ -2236,6 +2237,7 @@ symlink_info::check (const char *in_path, const suffix_info *suffixes)
|
|||
char extbuf[MAX_PATH + 5];
|
||||
const char *path = in_path;
|
||||
|
||||
error = 0;
|
||||
if (!suffixes)
|
||||
ext_here = NULL;
|
||||
else if ((known_suffix = has_suffix (in_path, suffixes)) != NULL)
|
||||
|
@ -2262,19 +2264,23 @@ symlink_info::check (const char *in_path, const suffix_info *suffixes)
|
|||
matter, so we just return 0. For example, getting the
|
||||
attributes of \\HOST will typically fail. */
|
||||
debug_printf ("GetFileAttributesA (%s) failed", path);
|
||||
__seterrno ();
|
||||
error = geterrno_from_win_error (GetLastError (), EACCES);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Windows allows path\. even when `path' isn't a directory.
|
||||
Detect this scenario and disallow it, since it is non-UNIX like. */
|
||||
char *p = strchr (path, '\0');
|
||||
if (p > path + 1 && p[-1] == '.' && SLASH_P (p[-2]) &&
|
||||
!(fileattr & FILE_ATTRIBUTE_DIRECTORY))
|
||||
Detect this scenario and disallow it, since it is non-UNIX like.
|
||||
FIXME: This code actually checks for things like foo/ and foo/..
|
||||
even though those usages have already been (erroneously?) eaten
|
||||
by cygwin_shared->mount.conv_to_win32_path in path_conv::check. */
|
||||
|
||||
char *p = strrchr (path, '\\');
|
||||
if (p && !(fileattr & FILE_ATTRIBUTE_DIRECTORY) &&
|
||||
(*++p == '\0' || (*p == '.' && (*++p == '\0' || (*p == '.' && p[1] == '\0')))))
|
||||
{
|
||||
debug_printf ("\\. specified on non-directory");
|
||||
set_errno (ENOTDIR);
|
||||
return 0;
|
||||
debug_printf ("%s is a non-directory", path);
|
||||
error = ENOTDIR;
|
||||
goto file_not_symlink;
|
||||
}
|
||||
|
||||
/* A symlink will have the `system' file attribute. */
|
||||
|
@ -2295,7 +2301,7 @@ symlink_info::check (const char *in_path, const suffix_info *suffixes)
|
|||
DWORD got;
|
||||
|
||||
if (! ReadFile (h, cookie_buf, sizeof (cookie_buf), &got, 0))
|
||||
set_errno (EIO);
|
||||
error = EIO;
|
||||
else if (got == sizeof (cookie_buf)
|
||||
&& memcmp (cookie_buf, SYMLINK_COOKIE,
|
||||
sizeof (cookie_buf)) == 0)
|
||||
|
@ -2305,7 +2311,7 @@ symlink_info::check (const char *in_path, const suffix_info *suffixes)
|
|||
|
||||
res = ReadFile (h, contents, MAX_PATH + 1, &got, 0);
|
||||
if (!res)
|
||||
set_errno (EIO);
|
||||
error = EIO;
|
||||
else
|
||||
{
|
||||
/* Versions prior to b16 stored several trailing
|
||||
|
@ -2347,7 +2353,6 @@ symlink_info::check (const char *in_path, const suffix_info *suffixes)
|
|||
goto out;
|
||||
|
||||
file_not_symlink:
|
||||
set_errno (EINVAL);
|
||||
is_symlink = FALSE;
|
||||
syscall_printf ("not a symlink");
|
||||
res = 0;
|
||||
|
|
|
@ -15,6 +15,7 @@ details. */
|
|||
#include <limits.h>
|
||||
#include "dtable.h"
|
||||
#include "pinfo.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
static char NO_COPY pinfo_dummy[sizeof(pinfo)] = {0};
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ details. */
|
|||
#include <sys/fcntl.h>
|
||||
#include <errno.h>
|
||||
#include "dtable.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
static int
|
||||
make_pipe (int fildes[2], unsigned int psize, int mode)
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <sys/poll.h>
|
||||
#include <errno.h>
|
||||
#include "dtable.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
extern "C"
|
||||
int
|
||||
|
|
|
@ -15,6 +15,7 @@ details. */
|
|||
#include "winsup.h"
|
||||
#include <errno.h>
|
||||
#include "pinfo.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
/* add timeval values */
|
||||
static void
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <dirent.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include "cygerrno.h"
|
||||
|
||||
extern "C"
|
||||
int
|
||||
|
|
|
@ -24,6 +24,7 @@ details. */
|
|||
#include <ctype.h>
|
||||
#include "dtable.h"
|
||||
#include "pinfo.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
extern BOOL allow_ntea;
|
||||
BOOL allow_ntsec = FALSE;
|
||||
|
|
|
@ -34,6 +34,7 @@ details. */
|
|||
#include <winsock.h>
|
||||
#include "select.h"
|
||||
#include "dtable.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
/*
|
||||
* All these defines below should be in sys/types.h
|
||||
|
|
|
@ -14,6 +14,7 @@ details. */
|
|||
#include "winsup.h"
|
||||
#include <errno.h>
|
||||
#include "pinfo.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
extern "C"
|
||||
_sig_func_ptr
|
||||
|
|
|
@ -17,6 +17,7 @@ details. */
|
|||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include "pinfo.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
extern BOOL allow_ntsec;
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ details. */
|
|||
#include <paths.h>
|
||||
#include "dtable.h"
|
||||
#include "pinfo.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
extern BOOL allow_ntsec;
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ details. */
|
|||
#include <lmcons.h> /* for UNLEN */
|
||||
#include "dtable.h"
|
||||
#include "pinfo.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
extern BOOL allow_ntsec;
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ details. */
|
|||
#include <time.h>
|
||||
#include <limits.h>
|
||||
#include "dtable.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
/* sysconf: POSIX 4.8.1.1 */
|
||||
/* Allows a portable app to determine quantities of resources or
|
||||
|
|
|
@ -15,6 +15,7 @@ details. */
|
|||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
#include "dtable.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
/* FIXME: These should probably be in the registry. */
|
||||
/* FIXME: The Win95 path should be whatever slash is */
|
||||
|
|
|
@ -14,6 +14,7 @@ details. */
|
|||
#include "winsup.h"
|
||||
#include <errno.h>
|
||||
#include "dtable.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
/* tcsendbreak: POSIX 7.2.2.1 */
|
||||
extern "C"
|
||||
|
|
|
@ -17,6 +17,7 @@ details. */
|
|||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include "pinfo.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
#define FACTOR (0x19db1ded53ea710LL)
|
||||
#define NSPERSEC 10000000LL
|
||||
|
|
|
@ -16,6 +16,7 @@ details. */
|
|||
#include <winuser.h>
|
||||
#include "dtable.h"
|
||||
#include "pinfo.h"
|
||||
#include "cygerrno.h"
|
||||
|
||||
extern fhandler_tty_master *tty_master;
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ details. */
|
|||
#include <sys/wait.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include "cygerrno.h"
|
||||
|
||||
/* This is called _wait and not wait because the real wait is defined
|
||||
in libc/syscalls/syswait.c. It calls us. */
|
||||
|
|
|
@ -17,6 +17,7 @@ details. */
|
|||
#include <limits.h>
|
||||
#include <wingdi.h>
|
||||
#include <winuser.h>
|
||||
#include "cygerrno.h"
|
||||
|
||||
static NO_COPY UINT timer_active = 0;
|
||||
static NO_COPY struct itimerval itv;
|
||||
|
|
|
@ -466,31 +466,4 @@ extern "C" char __stdcall **cur_environ ();
|
|||
extern char *old_title;
|
||||
extern BOOL display_title;
|
||||
|
||||
|
||||
/*************************** errno manipulation ******************************/
|
||||
|
||||
void seterrno_from_win_error (const char *file, int line, int code);
|
||||
void seterrno (const char *, int line);
|
||||
|
||||
#define __seterrno() seterrno (__FILE__, __LINE__)
|
||||
#define __seterrno_from_win_error(val) seterrno_from_win_error (__FILE__, __LINE__, val)
|
||||
|
||||
#define set_errno(val) (_impure_ptr->_errno = (val))
|
||||
#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;
|
||||
|
||||
#endif /* defined __cplusplus */
|
||||
|
|
Loading…
Reference in New Issue