* autoload.cc (noload): Use proper method for multiline strings or newer gcc's

complain.
* exceptions.cc (unused_sig_wrapper): Ditto.
* fhandler.h (fhandler_base): Make get_io_handle and friends return self.
* fhandler_tty.cc (fhandler_pty_common::close_on_exec): Accomodate DEBUGGING
flag to avoid spurious warnings when inheritance is set.
This commit is contained in:
Christopher Faylor 2001-03-11 01:58:23 +00:00
parent 7cf3b655ec
commit 2116a17508
5 changed files with 186 additions and 167 deletions

View File

@ -1,3 +1,13 @@
Sat Mar 10 20:54:47 2001 Christopher Faylor <cgf@cygnus.com>
* autoload.cc (noload): Use proper method for multiline strings or
newer gcc's complain.
* exceptions.cc (unused_sig_wrapper): Ditto.
* fhandler.h (fhandler_base): Make get_io_handle and friends return
self.
* fhandler_tty.cc (fhandler_pty_common::close_on_exec): Accomodate
DEBUGGING flag to avoid spurious warnings when inheritance is set.
Sat Mar 10 16:52:12 2001 Christopher Faylor <cgf@cygnus.com> Sat Mar 10 16:52:12 2001 Christopher Faylor <cgf@cygnus.com>
* shortcut.c (PATH_ALL_EXEC): Add parentheses to avoid a compiler * shortcut.c (PATH_ALL_EXEC): Add parentheses to avoid a compiler

View File

@ -24,45 +24,45 @@ struct DLLinfo
}; };
/* FIXME: This is not thread-safe! */ /* FIXME: This is not thread-safe! */
__asm__ (" __asm__ ("\n\
msg1: msg1:\n\
.ascii \"couldn't dynamically determine load address for '%s' (handle %p), %E\\0\" .ascii \"couldn't dynamically determine load address for '%s' (handle %p), %E\\0\"\n\
\n\
.align 32 .align 32\n\
noload: noload:\n\
popl %edx # Get the address of the information block popl %edx # Get the address of the information block\n\
movl 8(%edx),%eax # Should we 'ignore' the lack movl 8(%edx),%eax # Should we 'ignore' the lack\n\
test $1,%eax # of this function? test $1,%eax # of this function?\n\
jz 1f # Nope. jz 1f # Nope.\n\
decl %eax # Yes. This is the # of bytes + 1 decl %eax # Yes. This is the # of bytes + 1\n\
popl %edx # Caller's caller popl %edx # Caller's caller\n\
addl %eax,%esp # Pop off bytes addl %eax,%esp # Pop off bytes\n\
xor %eax,%eax # Zero functional return xor %eax,%eax # Zero functional return\n\
jmp *%edx # Return jmp *%edx # Return\n\
1: 1:\n\
movl 4(%edx),%eax # Handle value movl 4(%edx),%eax # Handle value\n\
pushl (%eax) pushl (%eax)\n\
leal 12(%edx),%eax # Location of name of function leal 12(%edx),%eax # Location of name of function\n\
push %eax push %eax\n\
push $msg1 # The message push $msg1 # The message\n\
call ___api_fatal # Print message. Never returns call ___api_fatal # Print message. Never returns\n\
\n\
.globl cygwin_dll_func_load .globl cygwin_dll_func_load\n\
cygwin_dll_func_load: cygwin_dll_func_load:\n\
movl (%esp),%eax # 'Return address' contains load info movl (%esp),%eax # 'Return address' contains load info\n\
addl $12,%eax # Address of name of function to load addl $12,%eax # Address of name of function to load\n\
pushl %eax # Second argument pushl %eax # Second argument\n\
movl -8(%eax),%eax # Address of Handle to DLL movl -8(%eax),%eax # Address of Handle to DLL\n\
pushl (%eax) # Handle to DLL pushl (%eax) # Handle to DLL\n\
call _GetProcAddress@8# Load it call _GetProcAddress@8# Load it\n\
test %eax,%eax # Success? test %eax,%eax # Success?\n\
jne gotit # Yes jne gotit # Yes\n\
jmp noload # Issue an error or return jmp noload # Issue an error or return\n\
gotit: gotit:\n\
popl %ecx # Pointer to 'return address' popl %ecx # Pointer to 'return address'\n\
movb $0xe0,-1(%ecx) # Turn preceding call to a jmp *%eax movb $0xe0,-1(%ecx) # Turn preceding call to a jmp *%eax\n\
movl %eax,(%ecx) # Point dispatch to address loaded above movl %eax,(%ecx) # Point dispatch to address loaded above\n\
jmp *%eax jmp *%eax\n\
"); ");
LoadDLLinitfunc (advapi32) LoadDLLinitfunc (advapi32)

View File

@ -1144,69 +1144,69 @@ void unused_sig_wrapper ()
prototype signal handlers as __stdcall), calls _set_process_mask prototype signal handlers as __stdcall), calls _set_process_mask
to restore any mask, restores any potentially clobbered registers to restore any mask, restores any potentially clobbered registers
and returns to original caller. */ and returns to original caller. */
__asm__ volatile (" __asm__ volatile ("\n\
.text .text\n\
\n\
_sigreturn: _sigreturn:\n\
addl $4,%%esp # Remove argument addl $4,%%esp # Remove argument\n\
movl %%esp,%%ebp movl %%esp,%%ebp\n\
addl $36,%%ebp addl $36,%%ebp\n\
\n\
cmpl $0,%4 # Did a signal come in? cmpl $0,%4 # Did a signal come in?\n\
jz 1f # No, if zero jz 1f # No, if zero\n\
call _call_signal_handler@0 # yes handle the signal call _call_signal_handler@0 # yes handle the signal\n\
\n\
# FIXME: There is a race here. The signal handler could set up # FIXME: There is a race here. The signal handler could set up\n\
# the sigsave structure between _call_signal_handler and the # the sigsave structure between _call_signal_handler and the\n\
# end of _set_process_mask. This would make cygwin detect an # end of _set_process_mask. This would make cygwin detect an\n\
# incorrect signal mask. # incorrect signal mask.\n\
\n\
1: call _set_process_mask@4 1: call _set_process_mask@4\n\
popl %%eax # saved errno popl %%eax # saved errno\n\
testl %%eax,%%eax # Is it < 0 testl %%eax,%%eax # Is it < 0\n\
jl 2f # yup. ignore it jl 2f # yup. ignore it\n\
movl %1,%%ebx movl %1,%%ebx\n\
movl %%eax,(%%ebx) movl %%eax,(%%ebx)\n\
2: popl %%eax 2: popl %%eax\n\
popl %%ebx popl %%ebx\n\
popl %%ecx popl %%ecx\n\
popl %%edx popl %%edx\n\
popl %%edi popl %%edi\n\
popl %%esi popl %%esi\n\
popf popf\n\
popl %%ebp popl %%ebp\n\
ret ret\n\
\n\
__no_sig_start: __no_sig_start:\n\
_sigdelayed: _sigdelayed:\n\
pushl %2 # original return address pushl %2 # original return address\n\
_sigdelayed0: _sigdelayed0:\n\
pushl %%ebp pushl %%ebp\n\
movl %%esp,%%ebp movl %%esp,%%ebp\n\
pushf pushf\n\
pushl %%esi pushl %%esi\n\
pushl %%edi pushl %%edi\n\
pushl %%edx pushl %%edx\n\
pushl %%ecx pushl %%ecx\n\
pushl %%ebx pushl %%ebx\n\
pushl %%eax pushl %%eax\n\
pushl %7 # saved errno pushl %7 # saved errno\n\
pushl %3 # oldmask pushl %3 # oldmask\n\
pushl %4 # signal argument pushl %4 # signal argument\n\
pushl $_sigreturn pushl $_sigreturn\n\
\n\
call _reset_signal_arrived@0 call _reset_signal_arrived@0\n\
pushl %5 # signal number pushl %5 # signal number\n\
movl $0,%0 # zero the signal number as a movl $0,%0 # zero the signal number as a\n\
# flag to the signal handler thread # flag to the signal handler thread\n\
# that it is ok to set up sigsave # that it is ok to set up sigsave\n\
\n\
pushl %8 pushl %8\n\
call _set_process_mask@4 call _set_process_mask@4\n\
popl %%eax popl %%eax\n\
jmp *%%eax jmp *%%eax\n\
__no_sig_end: __no_sig_end:\n\
\n\
" : "=m" (sigsave.sig) : "m" (&_impure_ptr->_errno), " : "=m" (sigsave.sig) : "m" (&_impure_ptr->_errno),
"g" (sigsave.retaddr), "g" (sigsave.oldmask), "g" (sigsave.sig), "g" (sigsave.retaddr), "g" (sigsave.oldmask), "g" (sigsave.sig),
"g" (sigsave.func), "o" (pid_offset), "g" (sigsave.saved_errno), "g" (sigsave.newmask) "g" (sigsave.func), "o" (pid_offset), "g" (sigsave.saved_errno), "g" (sigsave.newmask)

View File

@ -317,9 +317,9 @@ public:
/* Virtual accessor functions to hide the fact /* Virtual accessor functions to hide the fact
that some fd's have two handles. */ that some fd's have two handles. */
virtual HANDLE get_handle () const { return io_handle; } virtual HANDLE& get_handle () { return io_handle; }
virtual HANDLE get_io_handle () const { return io_handle; } virtual HANDLE& get_io_handle () { return io_handle; }
virtual HANDLE get_output_handle () const { return io_handle; } virtual HANDLE& get_output_handle () { return io_handle; }
virtual BOOL hit_eof () {return FALSE;} virtual BOOL hit_eof () {return FALSE;}
virtual select_record *select_read (select_record *s); virtual select_record *select_read (select_record *s);
virtual select_record *select_write (select_record *s); virtual select_record *select_write (select_record *s);
@ -347,7 +347,7 @@ private:
public: public:
fhandler_socket (const char *name = 0); fhandler_socket (const char *name = 0);
~fhandler_socket (); ~fhandler_socket ();
int get_socket () const { return (int) get_handle(); } int get_socket () { return (int) get_handle(); }
fhandler_socket * is_socket () { return this; } fhandler_socket * is_socket () { return this; }
int write (const void *ptr, size_t len); int write (const void *ptr, size_t len);
int read (void *ptr, size_t len); int read (void *ptr, size_t len);
@ -570,7 +570,7 @@ public:
{ {
// nothing to do // nothing to do
} }
HANDLE get_output_handle () const { return output_handle; } HANDLE& get_output_handle () { return output_handle; }
int line_edit (const char *rptr, int nread, int always_accept = 0); int line_edit (const char *rptr, int nread, int always_accept = 0);
void set_output_handle (HANDLE h) { output_handle = h; } void set_output_handle (HANDLE h) { output_handle = h; }
void tcinit (tty_min *this_tc, int force = FALSE); void tcinit (tty_min *this_tc, int force = FALSE);

View File

@ -1,6 +1,6 @@
/* fhandler_tty.cc /* fhandler_tty.cc
Copyright 1997, 1998, 2000 Cygnus Solutions. Copyright 1997, 1998, 2000, 2001 Red Hat, Inc.
This file is part of Cygwin. This file is part of Cygwin.
@ -728,7 +728,8 @@ fhandler_tty_slave::read (void *ptr, size_t len)
* so "restart timer" and wait until more data arrive * so "restart timer" and wait until more data arrive
*/ */
if (vmin == 0) break; if (vmin == 0)
break;
} }
termios_printf ("%d=read(%x, %d)", totalread, ptr, len); termios_printf ("%d=read(%x, %d)", totalread, ptr, len);
return totalread; return totalread;
@ -1070,7 +1071,15 @@ fhandler_pty_master::ptsname (void)
void void
fhandler_tty_common::set_close_on_exec (int val) fhandler_tty_common::set_close_on_exec (int val)
{ {
#ifndef DEBUGGING
this->fhandler_base::set_close_on_exec (val); this->fhandler_base::set_close_on_exec (val);
#else
/* FIXME: This is a duplication from fhandler_base::set_close_on_exec.
It is here because we need to specify the "from_pty" stuff here or
we'll get warnings from ForceCloseHandle when debugging. */
set_inheritance (get_io_handle (), val, "from_pty");
set_close_on_exec_flag (val);
#endif
if (output_done_event) if (output_done_event)
set_inheritance (output_done_event, val); set_inheritance (output_done_event, val);
if (ioctl_request_event) if (ioctl_request_event)
@ -1082,7 +1091,7 @@ fhandler_tty_common::set_close_on_exec (int val)
set_inheritance (output_mutex, val, "output_mutex"); set_inheritance (output_mutex, val, "output_mutex");
set_inheritance (input_mutex, val, "input_mutex"); set_inheritance (input_mutex, val, "input_mutex");
set_inheritance (input_available_event, val); set_inheritance (input_available_event, val);
set_inheritance (output_handle, val); set_inheritance (output_handle, val, "to_pty");
} }
void void