* exceptions.cc (sigsave): Copy on fork so that we can restore correct behavior
in forked process. (interruptible): Flag as interruptible when running in main process module. (interrupt_setup): Save return address and address of return address. (signal_fixup_after_fork): New function. Uses above two values to restore proper behavior to forked process. (interrupt_on_return): Pass return address address to interupt_setup. (interrupt_now): Pass NULL for return address address to interrupt_setup. * fork.cc (fork): Call signal_fixup_after_fork. * shared.h: Lint cleanups. * winsup.h: Ditto.
This commit is contained in:
parent
65c0e6e68c
commit
0cda2f4609
|
@ -1,3 +1,19 @@
|
||||||
|
Sat Apr 8 00:08:53 2000 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
|
* exceptions.cc (sigsave): Copy on fork so that we can restore correct
|
||||||
|
behavior in forked process.
|
||||||
|
(interruptible): Flag as interruptible when running in main process
|
||||||
|
module.
|
||||||
|
(interrupt_setup): Save return address and address of return address.
|
||||||
|
(signal_fixup_after_fork): New function. Uses above two values to
|
||||||
|
restore proper behavior to forked process.
|
||||||
|
(interrupt_on_return): Pass return address address to interupt_setup.
|
||||||
|
(interrupt_now): Pass NULL for return address address to
|
||||||
|
interrupt_setup.
|
||||||
|
* fork.cc (fork): Call signal_fixup_after_fork.
|
||||||
|
* shared.h: Lint cleanups.
|
||||||
|
* winsup.h: Ditto.
|
||||||
|
|
||||||
Mon Apr 3 14:10:44 2000 Christopher Faylor <cgf@cygnus.com>
|
Mon Apr 3 14:10:44 2000 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
* fhandler.h (select_stuff): Eliminate use of 'total'.
|
* fhandler.h (select_stuff): Eliminate use of 'total'.
|
||||||
|
@ -7,28 +23,28 @@ Mon Apr 3 14:10:44 2000 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
Mon Apr 03 13:58:00 2000 Corinna Vinschen <corinna@vinschen.de>
|
Mon Apr 03 13:58:00 2000 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* grp.cc (parse_grp): Save empty array instead of
|
* grp.cc (parse_grp): Save empty array instead of
|
||||||
NULL in gr_mem if no supplementary group is given.
|
NULL in gr_mem if no supplementary group is given.
|
||||||
|
|
||||||
Sun Apr 02 16:02:00 2000 Corinna Vinschen <corinna@vinschen.de>
|
Sun Apr 02 16:02:00 2000 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* syscalls.cc (chown_worker): Use previous uid/gid if
|
* syscalls.cc (chown_worker): Use previous uid/gid if
|
||||||
new uid/gid is -1.
|
new uid/gid is -1.
|
||||||
|
|
||||||
Fry Mar 31 22:55:00 2000 Corinna Vinschen <corinna@vinschen.de>
|
Fry Mar 31 22:55:00 2000 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* syscalls.cc (chown_worker): New static function with
|
* syscalls.cc (chown_worker): New static function with
|
||||||
chown functionality.
|
chown functionality.
|
||||||
(chown): Call chown_worker with SYMLINK_FOLLOW.
|
(chown): Call chown_worker with SYMLINK_FOLLOW.
|
||||||
(fchown): New function. Call chown_worker with SYMLINK_FOLLOW.
|
(fchown): New function. Call chown_worker with SYMLINK_FOLLOW.
|
||||||
(lchown): New function. Call chown_worker with SYMLINK_IGNORE.
|
(lchown): New function. Call chown_worker with SYMLINK_IGNORE.
|
||||||
* cygwin.din: Add symbols for fchown, lchown.
|
* cygwin.din: Add symbols for fchown, lchown.
|
||||||
|
|
||||||
Fry Mar 31 11:18:00 2000 Corinna Vinschen <corinna@vinschen.de>
|
Fry Mar 31 11:18:00 2000 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* path.cc (symlink): Call `set_file_attribute()' and
|
* path.cc (symlink): Call `set_file_attribute()' and
|
||||||
`SetFileAttributeA()' instead of `chmod()' to set
|
`SetFileAttributeA()' instead of `chmod()' to set
|
||||||
uid/gid correct.
|
uid/gid correct.
|
||||||
|
|
||||||
Wed Mar 29 22:49:56 2000 Christopher Faylor <cgf@cygnus.com>
|
Wed Mar 29 22:49:56 2000 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ static size_t windows_system_directory_length;
|
||||||
static NO_COPY int exit_already = 0;
|
static NO_COPY int exit_already = 0;
|
||||||
static NO_COPY muto *mask_sync = NULL;
|
static NO_COPY muto *mask_sync = NULL;
|
||||||
|
|
||||||
HMODULE cygwin_hmodule;
|
HMODULE NO_COPY cygwin_hmodule;
|
||||||
HANDLE NO_COPY console_handler_thread_waiter = NULL;
|
HANDLE NO_COPY console_handler_thread_waiter = NULL;
|
||||||
|
|
||||||
static const struct
|
static const struct
|
||||||
|
@ -226,7 +226,7 @@ public:
|
||||||
|
|
||||||
/* This is the main stack frame info for this process. */
|
/* This is the main stack frame info for this process. */
|
||||||
static NO_COPY stack_info thestack;
|
static NO_COPY stack_info thestack;
|
||||||
signal_dispatch NO_COPY sigsave;
|
signal_dispatch sigsave;
|
||||||
|
|
||||||
/* Initialize everything needed to start iterating. */
|
/* Initialize everything needed to start iterating. */
|
||||||
void
|
void
|
||||||
|
@ -558,12 +558,7 @@ extern int pending_signals;
|
||||||
int
|
int
|
||||||
interruptible (DWORD pc)
|
interruptible (DWORD pc)
|
||||||
{
|
{
|
||||||
#if 0
|
int res;
|
||||||
DWORD pchigh = pc & 0xf0000000;
|
|
||||||
return ((pc >= (DWORD) &__sigfirst) && (pc <= (DWORD) &__siglast)) ||
|
|
||||||
!(pchigh == 0xb0000000 || pchigh == 0x70000000 || pchigh == 0x60000000);
|
|
||||||
#else
|
|
||||||
int res = 1;
|
|
||||||
if ((pc >= (DWORD) &__sigfirst) && (pc <= (DWORD) &__siglast))
|
if ((pc >= (DWORD) &__sigfirst) && (pc <= (DWORD) &__siglast))
|
||||||
res = 0;
|
res = 0;
|
||||||
else
|
else
|
||||||
|
@ -575,25 +570,29 @@ interruptible (DWORD pc)
|
||||||
|
|
||||||
char *checkdir = (char *) alloca (windows_system_directory_length);
|
char *checkdir = (char *) alloca (windows_system_directory_length);
|
||||||
# define h ((HMODULE) m.AllocationBase)
|
# define h ((HMODULE) m.AllocationBase)
|
||||||
if (h == cygwin_hmodule)
|
if (h == user_data->hmodule)
|
||||||
|
res = 1;
|
||||||
|
else if (h == cygwin_hmodule)
|
||||||
res = 0;
|
res = 0;
|
||||||
else if (!GetModuleFileName (h, checkdir, windows_system_directory_length))
|
else if (!GetModuleFileName (h, checkdir, windows_system_directory_length))
|
||||||
res = 0;
|
res = 0;
|
||||||
else
|
else
|
||||||
res = !strncasematch (windows_system_directory, checkdir,
|
res = !strncasematch (windows_system_directory, checkdir,
|
||||||
windows_system_directory_length);
|
windows_system_directory_length);
|
||||||
|
minimal_printf ("h %p", h);
|
||||||
|
# undef h
|
||||||
}
|
}
|
||||||
|
|
||||||
sigproc_printf ("interruptible %d", res);
|
minimal_printf ("interruptible %d", res);
|
||||||
return res;
|
return res;
|
||||||
# undef h
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __stdcall
|
static void __stdcall
|
||||||
interrupt_setup (int sig, struct sigaction& siga, void *handler, DWORD retaddr)
|
interrupt_setup (int sig, struct sigaction& siga, void *handler,
|
||||||
|
DWORD retaddr, DWORD *retaddr_on_stack)
|
||||||
{
|
{
|
||||||
sigsave.retaddr = retaddr;
|
sigsave.retaddr = retaddr;
|
||||||
|
sigsave.retaddr_on_stack = retaddr_on_stack;
|
||||||
sigsave.oldmask = myself->getsigmask (); // Remember for restoration
|
sigsave.oldmask = myself->getsigmask (); // Remember for restoration
|
||||||
/* FIXME: Not multi-thread aware */
|
/* FIXME: Not multi-thread aware */
|
||||||
set_process_mask (myself->getsigmask () | siga.sa_mask | SIGTOMASK (sig));
|
set_process_mask (myself->getsigmask () | siga.sa_mask | SIGTOMASK (sig));
|
||||||
|
@ -606,11 +605,25 @@ interrupt_setup (int sig, struct sigaction& siga, void *handler, DWORD retaddr)
|
||||||
static void
|
static void
|
||||||
interrupt_now (CONTEXT *ctx, int sig, struct sigaction& siga, void *handler)
|
interrupt_now (CONTEXT *ctx, int sig, struct sigaction& siga, void *handler)
|
||||||
{
|
{
|
||||||
interrupt_setup (sig, siga, handler, ctx->Eip);
|
interrupt_setup (sig, siga, handler, ctx->Eip, 0);
|
||||||
ctx->Eip = (DWORD) sigdelayed;
|
ctx->Eip = (DWORD) sigdelayed;
|
||||||
SetThreadContext (myself->getthread2signal(), ctx); /* Restart the thread */
|
SetThreadContext (myself->getthread2signal(), ctx); /* Restart the thread */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void __cdecl
|
||||||
|
signal_fixup_after_fork ()
|
||||||
|
{
|
||||||
|
if (!sigsave.sig)
|
||||||
|
return;
|
||||||
|
|
||||||
|
sigsave.sig = 0;
|
||||||
|
if (sigsave.retaddr_on_stack)
|
||||||
|
{
|
||||||
|
*sigsave.retaddr_on_stack = sigsave.retaddr;
|
||||||
|
set_process_mask (sigsave.oldmask);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
interrupt_on_return (DWORD ebp, int sig, struct sigaction& siga, void *handler)
|
interrupt_on_return (DWORD ebp, int sig, struct sigaction& siga, void *handler)
|
||||||
{
|
{
|
||||||
|
@ -626,7 +639,7 @@ interrupt_on_return (DWORD ebp, int sig, struct sigaction& siga, void *handler)
|
||||||
DWORD *addr_retaddr = ((DWORD *)thestack.sf.AddrFrame.Offset) + 1;
|
DWORD *addr_retaddr = ((DWORD *)thestack.sf.AddrFrame.Offset) + 1;
|
||||||
if (*addr_retaddr == thestack.sf.AddrReturn.Offset)
|
if (*addr_retaddr == thestack.sf.AddrReturn.Offset)
|
||||||
{
|
{
|
||||||
interrupt_setup (sig, siga, handler, *addr_retaddr);
|
interrupt_setup (sig, siga, handler, *addr_retaddr, addr_retaddr);
|
||||||
*addr_retaddr = (DWORD) sigdelayed;
|
*addr_retaddr = (DWORD) sigdelayed;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1055,8 +1068,6 @@ _sigdelayed:
|
||||||
pushl $_sigreturn
|
pushl $_sigreturn
|
||||||
|
|
||||||
call _reset_signal_arrived@0
|
call _reset_signal_arrived@0
|
||||||
# pushl _signal_arrived # Everybody waiting for this should
|
|
||||||
# call _ResetEvent@4 # have woken up by now.
|
|
||||||
movl $0,%0
|
movl $0,%0
|
||||||
|
|
||||||
cmpl $0,_pending_signals
|
cmpl $0,_pending_signals
|
||||||
|
|
|
@ -17,7 +17,7 @@ details. */
|
||||||
#include "winsup.h"
|
#include "winsup.h"
|
||||||
#include "dll_init.h"
|
#include "dll_init.h"
|
||||||
|
|
||||||
DWORD chunksize = 0;
|
DWORD NO_COPY chunksize = 0;
|
||||||
/* Timeout to wait for child to start, parent to init child, etc. */
|
/* Timeout to wait for child to start, parent to init child, etc. */
|
||||||
/* FIXME: Once things stabilize, bump up to a few minutes. */
|
/* FIXME: Once things stabilize, bump up to a few minutes. */
|
||||||
#define FORK_WAIT_TIMEOUT (300 * 1000) /* 300 seconds */
|
#define FORK_WAIT_TIMEOUT (300 * 1000) /* 300 seconds */
|
||||||
|
@ -516,6 +516,7 @@ fork ()
|
||||||
MALLOC_CHECK;
|
MALLOC_CHECK;
|
||||||
|
|
||||||
dtable.fixup_after_fork (hParent);
|
dtable.fixup_after_fork (hParent);
|
||||||
|
signal_fixup_after_fork ();
|
||||||
ForceCloseHandle (hParent);
|
ForceCloseHandle (hParent);
|
||||||
|
|
||||||
MALLOC_CHECK;
|
MALLOC_CHECK;
|
||||||
|
|
|
@ -14,7 +14,6 @@ details. */
|
||||||
extern "C" void __api_fatal (const char *, ...) __attribute__ ((noreturn));
|
extern "C" void __api_fatal (const char *, ...) __attribute__ ((noreturn));
|
||||||
extern "C" int __small_sprintf (char *dst, const char *fmt, ...);
|
extern "C" int __small_sprintf (char *dst, const char *fmt, ...);
|
||||||
extern "C" int __small_vsprintf (char *dst, const char *fmt, va_list ap);
|
extern "C" int __small_vsprintf (char *dst, const char *fmt, va_list ap);
|
||||||
extern "C" int __small_sprintf (char *dst, const char *fmt, ...);
|
|
||||||
|
|
||||||
/******** Deletion Queue Class ********/
|
/******** Deletion Queue Class ********/
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@ void __stdcall sigproc_terminate ();
|
||||||
BOOL __stdcall proc_exists (pinfo *);
|
BOOL __stdcall proc_exists (pinfo *);
|
||||||
int __stdcall proc_subproc (DWORD, DWORD);
|
int __stdcall proc_subproc (DWORD, DWORD);
|
||||||
int __stdcall sig_send (pinfo *, int, DWORD ebp = 0);
|
int __stdcall sig_send (pinfo *, int, DWORD ebp = 0);
|
||||||
|
void __stdcall signal_fixup_after_fork ();
|
||||||
|
|
||||||
extern char myself_nowait_dummy[];
|
extern char myself_nowait_dummy[];
|
||||||
extern char myself_nowait_nonmain_dummy[];
|
extern char myself_nowait_nonmain_dummy[];
|
||||||
|
|
|
@ -310,6 +310,7 @@ struct signal_dispatch
|
||||||
DWORD ebp;
|
DWORD ebp;
|
||||||
DWORD oldmask;
|
DWORD oldmask;
|
||||||
DWORD retaddr;
|
DWORD retaddr;
|
||||||
|
DWORD *retaddr_on_stack;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -501,9 +502,6 @@ extern void (*__DTOR_LIST__) (void);
|
||||||
|
|
||||||
/*************************** Unsorted ******************************/
|
/*************************** Unsorted ******************************/
|
||||||
|
|
||||||
/* The size of the console title */
|
|
||||||
#define TITLESIZE 1024
|
|
||||||
|
|
||||||
#define WM_ASYNCIO 0x8000 // WM_APP
|
#define WM_ASYNCIO 0x8000 // WM_APP
|
||||||
|
|
||||||
/* Note that MAX_PATH is defined in the windows headers */
|
/* Note that MAX_PATH is defined in the windows headers */
|
||||||
|
@ -523,9 +521,9 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
#include <sys/reent.h>
|
#include <sys/reent.h>
|
||||||
|
|
||||||
#define STD_RBITS S_IRUSR | S_IRGRP | S_IROTH
|
#define STD_RBITS (S_IRUSR | S_IRGRP | S_IROTH)
|
||||||
#define STD_WBITS S_IWUSR
|
#define STD_WBITS (S_IWUSR)
|
||||||
#define STD_XBITS S_IXUSR | S_IXGRP | S_IXOTH
|
#define STD_XBITS (S_IXUSR | S_IXGRP | S_IXOTH)
|
||||||
|
|
||||||
#define O_NOSYMLINK 0x080000
|
#define O_NOSYMLINK 0x080000
|
||||||
#define O_DIROPEN 0x100000
|
#define O_DIROPEN 0x100000
|
||||||
|
|
Loading…
Reference in New Issue