Eliminate use of sigframe and sigthread throughout.

* Makefile.in (DLL_OFILES): Add sigfe.o.  Remove reliance on cygwin.def from
cygwin0.dll dependency since dependence on sigfe.o implies that.  Generate def
file on the fly using 'gendef'.
* configure.in: Don't auto-generate cygwin.def.
* configure: Regenerate.
* cygwin.din: Add SIGFE stuff where appropriate.
* dcrt0.cc (dll_crt0_1): Initialize cygwin tls early in process startup.  Set
_main_tls to address of the main thread's cygwin tls.
* debug.h: Remove now unneeded WFSO and WFMO declarations.
* exceptions.cc (_last_thread): Define.
(set_thread_state_for_signals): New function.
(reset_thread_exception_for_signals): Ditto.
(init_thread_for_signals): Ditto.
(delete_thread_for_signals): Ditto.
(capture_thread_for_signals): Ditto.
(handle_exceptions): Set return address explicitly for exceptions prior to
calling sig_send.
(interrupt_on_return): Eliminate.
(setup_handler): Add preliminary implementation for dealing with
thread-specific signals by querying _main_tls.
(signal_exit): Use cygthread::main_thread_id instead of mainthread.id.
(call_signal_handler_now): For now, just handle the main thread.
* fork.cc (vfork): Save and restore main _my_tls.
* gendef: New file.  Generates def file and sigfe.s file.
* gentls_offsets: New file.  Generates offsets for perl to use in sigfe.s.
* how-signals-work.txt: Mention that info is obsolete.
* init.cc (dll_entry): Initialize cygwin tls storage here.
* miscfuncs.cc (low_priority_sleep): Make a C function for easier calling from
asm.
* perthread.h (vfork_save::tls): New element.
* signal.cc (nanosleep): Replace previous use of
sigframe.call_signal_handler_now with straight call to call_signal_handler_now.
(abort): Ditto.
* syscalls.cc (readv): Ditto.
* termios.cc (tcsetattr): Ditto.
* wait.cc (wait4): Ditto.
* sigproc.cc (sig_dispatch_pending): Ditto.
(sig_send): Ditto.
* sigproc.h: Declare call_signal_handler_now.
* thread.cc (pthread::thread_init_wrapper): Initialize cygwin tls.  Remove
obsolete and unworking signal stuff.
* thread.h (verifyable_object::sigs): Eliminate.
(verifyable_object::sigmask): Eliminate.
(verifyable_object::sigtodo): Eliminate.
(verifyable_object::exit): Make attribute noreturn.
(verifyable_object::thread_init_wrapper): Ditto.
(pthread_null::exit): Ditto.
* winbase.h (__stackbase): Always define.
* winsup.h (low_priority_sleep): Declare as a "C" function.
* include/cygwin/version.h: Bump API version to reflect sigwait export.
* include/sys/queue.h: Protect SLIST_ENTRY from previous declaration.
* signal.cc (sigwait): Implement.
* select.cc (fhandler_base::ready_for_read): Add debugging output.
* devices.h: Define more device pointers via their storage.
* devices.in: Don't parse things like /dev/inet/tcp, as they really have no
meaning.
* devices.cc: Regenerate.
* gendevices: Set proper protection for output file.
* cygtls.h: New file.
* gendef: New file.
* gentls_offsets: New file.
* tlsoffsets.h: New file.  Autogenerated.
* config/i386/longjmp.c: Remove.  File subsumed by gendef output.
* config/i386/makefrag: Remove obsolete file.
* fhandler.cc: Remove spurious access_worker declaration.
* spawn.cc (spawnve): Make debugging output more accurate.
* cygwin-gperf: Remove.
* devices.cc: Remove.
This commit is contained in:
Christopher Faylor
2003-11-28 20:55:59 +00:00
parent ffe0063843
commit 9a4d574b8d
50 changed files with 3311 additions and 3466 deletions

View File

@ -253,7 +253,7 @@ List_remove (fast_mutex &mx, list_node *&head, list_node *node)
}
mx.unlock ();
}
template <class list_node> class List
{
@ -305,7 +305,7 @@ protected:
list_node *head;
};
class pthread_key:public verifyable_object
class pthread_key: public verifyable_object
{
public:
static bool is_good_object (pthread_key_t const *);
@ -343,7 +343,7 @@ private:
void *fork_buf;
};
class pthread_attr:public verifyable_object
class pthread_attr: public verifyable_object
{
public:
static bool is_good_object(pthread_attr_t const *);
@ -357,7 +357,7 @@ public:
~pthread_attr ();
};
class pthread_mutexattr:public verifyable_object
class pthread_mutexattr: public verifyable_object
{
public:
static bool is_good_object(pthread_mutexattr_t const *);
@ -367,7 +367,7 @@ public:
~pthread_mutexattr ();
};
class pthread_mutex:public verifyable_object
class pthread_mutex: public verifyable_object
{
public:
static bool is_good_object (pthread_mutex_t const *);
@ -448,7 +448,8 @@ private:
#define WAIT_CANCELED (WAIT_OBJECT_0 + 1)
class pthread:public verifyable_object
class _threadinfo;
class pthread: public verifyable_object
{
public:
HANDLE win32_obj_id;
@ -459,13 +460,10 @@ public:
bool valid;
bool suspended;
int cancelstate, canceltype;
_threadinfo *cygtls;
HANDLE cancel_event;
pthread_t joiner;
/* signal handling */
struct sigaction *sigs;
sigset_t *sigmask;
LONG *sigtodo;
virtual void create (void *(*)(void *), pthread_attr *, void *);
pthread ();
@ -488,7 +486,7 @@ public:
static int suspend (pthread_t * thread);
static int resume (pthread_t * thread);
virtual void exit (void *value_ptr);
virtual void exit (void *value_ptr) __attribute__ ((noreturn));
virtual int cancel ();
@ -504,7 +502,7 @@ public:
virtual void pop_cleanup_handler (int const execute);
static pthread* self ();
static void *thread_init_wrapper (void *);
static void *thread_init_wrapper (void *) __attribute__ ((noreturn));
virtual unsigned long getsequence_np();
@ -545,12 +543,10 @@ private:
void pop_all_cleanup_handlers (void);
void precreate (pthread_attr *);
void postcreate ();
void set_thread_id_to_current ();
static void set_tls_self_pointer (pthread *);
void set_tls_self_pointer ();
static pthread *get_tls_self_pointer ();
void cancel_self ();
DWORD get_thread_id ();
void init_current_thread ();
};
class pthread_null : public pthread
@ -563,7 +559,7 @@ class pthread_null : public pthread
* as the ojbect is not verifyable
*/
void create (void *(*)(void *), pthread_attr *, void *);
void exit (void *value_ptr);
void exit (void *value_ptr) __attribute__ ((noreturn));
int cancel ();
void testcancel ();
int setcancelstate (int state, int *oldstate);
@ -577,7 +573,7 @@ class pthread_null : public pthread
static pthread_null _instance;
};
class pthread_condattr:public verifyable_object
class pthread_condattr: public verifyable_object
{
public:
static bool is_good_object(pthread_condattr_t const *);
@ -587,7 +583,7 @@ public:
~pthread_condattr ();
};
class pthread_cond:public verifyable_object
class pthread_cond: public verifyable_object
{
public:
static bool is_good_object (pthread_cond_t const *);
@ -628,7 +624,7 @@ private:
static fast_mutex cond_initialization_lock;
};
class pthread_rwlockattr:public verifyable_object
class pthread_rwlockattr: public verifyable_object
{
public:
static bool is_good_object(pthread_rwlockattr_t const *);
@ -638,7 +634,7 @@ public:
~pthread_rwlockattr ();
};
class pthread_rwlock:public verifyable_object
class pthread_rwlock: public verifyable_object
{
public:
static bool is_good_object (pthread_rwlock_t const *);
@ -717,7 +713,7 @@ public:
};
/* shouldn't be here */
class semaphore:public verifyable_object
class semaphore: public verifyable_object
{
public:
static bool is_good_object(sem_t const *);
@ -767,9 +763,8 @@ public:
class callback * next;
};
class MTinterface
struct MTinterface
{
public:
// General
int concurrency;
long int threadcount;
@ -789,12 +784,17 @@ public:
void fixup_before_fork (void);
void fixup_after_fork (void);
#if 1 // avoid initialization since zero is implied and
// only use of this class is static
MTinterface () : reent_key (NULL), thread_self_key (NULL) {}
#else
MTinterface () :
concurrency (0), threadcount (1),
concurrency (0), threadcount (0),
pthread_prepare (NULL), pthread_child (NULL), pthread_parent (NULL),
reent_key (NULL), thread_self_key (NULL)
{
}
#endif
};
#define MT_INTERFACE user_data->threadinterface