* cygwin/include/signal.h: Add copyright notice.

* cygwin.din: Make clock SIGFE.  Add clock_gettime, sigwaitinfo, timer_create,
timer_delete, timer_settime.
* include/cygwin/version.h: Reflect above additions.
* fork.cc (fork_child): Call fixup_timers_after_fork.
* signal.cc (sigwait): Remove unused variable.
* timer.cc: New file.
(clock_gettime): Define new function.
(timer_tracker): Define new struct used by timer functions.
(timer_tracker::timer_tracker): New function.
(to_us): New function.
(timer_thread): New function.
(timer_tracker::settime): New function.
(timer_create): New function.
(timer_settime): New function.
(timer_delete): New function.
(fixup_timers_after_fork): New function.
* cygthread.cc: Bump thread count.
* signal.cc (sigwaitinfo): Define new function.
(sigwait): Redefine based on sigwaitinfo.
* include/cygwin/signal.h (sigwaitinfo): Declare.
(sigwait): Ditto.
* dtable.cc (dtable::vfork_parent_restore): Avoid double close of ctty when
ctty == ctty_on_hold.
* cygtls.h (_threadinfo::threadkill): New element.
(_threadinfo::set_threadkill): Declare new function.
(_threadinfo::reset_threadkill): Declare new function.
* dcrt0.cc (dcrt0_1): Call here so that it will be possible to attach to
running process with #(*& Windows Me/9x.
(initial_env): Try to initialize strace if uninitialized.
* gendef: Don't zero signal if threadkill is set since that will happen in the
called function.
* signal.cc (sigwait): Ensure cleanup in error conditions.
* sigproc.cc (sig_send): Clear packet mask storage.
(wait_subproc): Fill in child exit code in siginfo_t structure.
* thread.cc (pthread_kill): Set threadkill flag.
* tlsoffsets.h: Regenerate.  Throughout, use siginfo_t to fill out all signal
information for "kernel" signals.
* cygtls.h (_threadinfo::set_siginfo): Declare new function.
* cygtls.cc (_threadinfo::set_siginfo): Define new function.
* dcrt0.cc (do_exit): Accommodate siginfo_t considerations.
* exceptions.cc (handle_exceptions): Ditto.
(sig_handle_tty_stop): Ditto.
(ctrl_c_handler): Use killsys() to send signal.
(sigpacket::process): Rename from sig_handle.  Use siginfo_t field from
sigpacket for everything.
(tty_min::kill_pgrp): Accommodate siginfo_t considerations.
(fhandler_termios::bg_check): Ditto.
* fhandler_tty.cc (fhandler_tty_slave::ioctl): Use killsys() to send signal.
* signal.cc (kill_worker): Rewrite to use siginfo_t second argument.
(kill_pgrp): Ditto.
(kill0): Define new function pulled from kill().
(kill): Rewrite as frontend to kill0.
(killsys): Define new function.
* sigproc.cc (sigelem): Eliminate.
(sigpacket): Move to sigproc.h.  Subsume sigelem.
(pending_signals): Use sigpacket rather than sigelem for everything.
(sig_clear): Ditto.
(wait_sig): Ditto.
(sig_send): Rewrite to use siginfo_t argument.
(sig_send): New function wratpper to sig_send with siginfo_t argument.
(wait_subproc): Accommodate siginfo_t considerations.
* thread.cc (pthread_kill): Ditto.
* sigproc.h (sigpacket): Move here.
(sigpacket::process): Declare "new" function.
(sig_handle): Eliminate declaration.
(sig_send): Declare with new paramaters.
(killsys): Declare new function.
(kill_pgrp): Declare.
* winsup.h: Move some signal-specific stuff to sigproc.h.
* include/cygwin/signal.h: Tweak some siginfo_t stuff.
This commit is contained in:
Christopher Faylor
2004-01-19 05:46:54 +00:00
parent 49fec4c011
commit f6936c48f3
25 changed files with 819 additions and 253 deletions

View File

@ -1,6 +1,20 @@
/* signal.h
Copyright 2004 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. */
#ifndef _CYGWIN_SIGNAL_H
#define _CYGWIN_SIGNAL_H
#ifdef __cplusplus
extern "C" {
#endif
#if 0
struct ucontext
{
@ -8,7 +22,7 @@ struct ucontext
void *uc_link;
stack_t uc_stack;
struct sigcontext uc_mcontext;
sigset_t uc_sigmask;
sigset_t uc_sigmask;
};
#endif
@ -18,49 +32,55 @@ typedef union sigval
void *sival_ptr; /* pointer signal value */
} sigval_t;
typedef struct sigevent
{
sigval_t sigev_value; /* signal value */
int sigev_signo; /* signal number */
int sigev_notify; /* notification type */
void (*sigev_notify_function) (sigval_t); /* notification function */
pthread_attr_t *sigev_notify_attributes; /* notification attributes */
} sigevent_t;
#pragma pack(push,4)
typedef struct
{
int si_signo; /* signal number */
int si_errno; /* errno associated with signal */
int si_code; /* signal code */
pid_t si_pid; /* sender's pid */
uid_t si_uid; /* sender's uid */
int si_errno; /* errno associated with signal */
union
{
int __pad[128]; /* plan for future growth */
__uint32_t __pad[32]; /* plan for future growth */
union
{
/* timers */
/* timers */
struct
{
unsigned int si_tid; /* timer id */
unsigned int si_overrun; /* overrun count */
union
{
struct
{
timer_t si_tid; /* timer id */
unsigned int si_overrun; /* overrun count */
};
sigval_t si_sigval; /* signal value */
sigval_t si_value; /* signal value */
};
};
/* POSIX signals or signals invoked by kill() */
struct
{
pid_t si_pid; /* sender's pid */
uid_t si_uid; /* sender's uid */
};
sigval_t si_sigval; /* signal value */
};
/* SIGCHLD */
struct
{
pid_t si_pid2; /* which child */
uid_t si_uid2; /* sender's uid */
int si_status; /* exit code */
int si_status; /* exit code */
clock_t si_utime; /* user time */
clock_t si_stime; /* system time */
};
/* core dumping signals */
struct
{
void *si_addr; /* faulting address */
};
void *si_addr; /* faulting address */
};
} siginfo_t;
#pragma pack(pop)
@ -77,7 +97,7 @@ enum
unimplemented) */
SI_KERNEL, /* sent by system */
ILL_ILLOP, /* illegal opcode */
ILL_ILLOPC, /* illegal opcode */
ILL_ILLOPN, /* illegal operand */
ILL_ILLADR, /* illegal addressing mode */
ILL_ILLTRP, /* illegal trap*/
@ -110,15 +130,6 @@ enum
CLD_CONTINUED /* stopped child has continued */
};
typedef struct sigevent
{
sigval_t sigev_value; /* signal value */
int sigev_signo; /* signal number */
int sigev_notify; /* notification type */
void (*sigev_notify_function) (sigval_t); /* notification function */
pthread_attr_t *sigev_notify_attributes; /* notification attributes */
} sigevent_t;
enum
{
SIGEV_SIGNAL = 0, /* a queued signal, with an application
@ -133,7 +144,7 @@ enum
typedef void (*_sig_func_ptr)(int);
struct sigaction
struct sigaction
{
union
{
@ -188,4 +199,10 @@ struct sigaction
#define SIGUSR1 30 /* user defined signal 1 */
#define SIGUSR2 31 /* user defined signal 2 */
#define NSIG 32 /* signal 0 implied */
int sigwait (const sigset_t *, int *);
int sigwaitinfo (const sigset_t *, siginfo_t *);
#ifdef __cplusplus
}
#endif
#endif /*_CYGWIN_SIGNAL_H*/

View File

@ -233,12 +233,14 @@ details. */
106: Export flock.
107: Export fcntl64.
108: Remove unused (hopefully) reent_data export.
109: Export clock_gettime, sigwaitinfo, timer_create, timer_delete,
timer_settime
*/
/* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
#define CYGWIN_VERSION_API_MAJOR 0
#define CYGWIN_VERSION_API_MINOR 108
#define CYGWIN_VERSION_API_MINOR 109
/* There is also a compatibity version number associated with the
shared memory regions. It is incremented when incompatible