From c571716c6406baaab8a831eca54756e7ac8f9554 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Tue, 3 Feb 2004 21:59:27 +0000 Subject: [PATCH] * Makefile.in (DLL_OFILES): Add strsig.o. * cygtls.h (_local_storage::signamebuf) New element. * sysconf.cc (sysconf): Implement _SC_RTSIG_MAX. * tlsoffset.h: Regenerate. * include/limits.h (_POSIX_RTSIG_MAX): New define. (RTSIG_MAX): Ditto. * include/cygwin/signal.h (SIGRTMIN): New define. (SIGRTMAX): Ditto. (NSIG): Bump. * strsig.cc: New file. --- winsup/cygwin/ChangeLog | 25 ++++++-- winsup/cygwin/Makefile.in | 8 +-- winsup/cygwin/cygtls.h | 1 + winsup/cygwin/include/cygwin/signal.h | 6 +- winsup/cygwin/include/limits.h | 5 +- winsup/cygwin/strsig.cc | 84 +++++++++++++++++++++++++++ winsup/cygwin/sysconf.cc | 2 + winsup/cygwin/tlsoffsets.h | 64 ++++++++++---------- 8 files changed, 151 insertions(+), 44 deletions(-) create mode 100644 winsup/cygwin/strsig.cc diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 268378f64..ab9f24160 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,16 @@ +2004-02-03 Christopher Faylor + + * Makefile.in (DLL_OFILES): Add strsig.o. + * cygtls.h (_local_storage::signamebuf) New element. + * sysconf.cc (sysconf): Implement _SC_RTSIG_MAX. + * tlsoffset.h: Regenerate. + * include/limits.h (_POSIX_RTSIG_MAX): New define. + (RTSIG_MAX): Ditto. + * include/cygwin/signal.h (SIGRTMIN): New define. + (SIGRTMAX): Ditto. + (NSIG): Bump. + * strsig.cc: New file. + 2004-02-03 Jason Tishler * window.cc (Winmain): Show windows error code in error output when @@ -134,12 +147,12 @@ 2004-01-23 Pierre Humblet - * fhandler_socket.cc (fhandler_socket::create_secret_event): Avoid - creating multiple handles. Always allow event inheritance but set the - handle inheritance appropriately. Improve error handling. - (fhandler_socket::check_peer_secret_event): Improve error handling. - (fhandler_socket::close_secret_event): Simply call CloseHandle. - (fhandler_socket::set_close_on_exec): Set secret event inheritance. + * fhandler_socket.cc (fhandler_socket::create_secret_event): Avoid + creating multiple handles. Always allow event inheritance but set the + handle inheritance appropriately. Improve error handling. + (fhandler_socket::check_peer_secret_event): Improve error handling. + (fhandler_socket::close_secret_event): Simply call CloseHandle. + (fhandler_socket::set_close_on_exec): Set secret event inheritance. 2004-01-23 Christopher Faylor diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in index 8eba20951..a208ebc27 100644 --- a/winsup/cygwin/Makefile.in +++ b/winsup/cygwin/Makefile.in @@ -110,7 +110,7 @@ LIBCOS:=${sort ${addsuffix .o,${basename ${notdir ${wildcard $(srcdir)/lib/*.c}} EXTRA_DLL_OFILES:=${addsuffix .o,${basename ${notdir ${wildcard $(CONFIG_DIR)/*.c}}}} -EXTRA_OFILES=$(bupdir1)/libiberty/random.o $(bupdir1)/libiberty/strsignal.o +EXTRA_OFILES=$(bupdir1)/libiberty/random.o MALLOC_OFILES=@MALLOC_OFILES@ @@ -134,9 +134,9 @@ DLL_OFILES:=assert.o autoload.o bsdlib.o cxx.o cygheap.o cygthread.o cygtls.o \ poll.o pthread.o regcomp.o regerror.o regexec.o regfree.o registry.o \ resource.o scandir.o sched.o sec_acl.o sec_helper.o security.o \ select.o sem.o shared.o shm.o sigfe.o signal.o sigproc.o smallprint.o \ - spawn.o strace.o strsep.o sync.o syscalls.o sysconf.o syslog.o \ - termios.o thread.o timer.o times.o tty.o uinfo.o uname.o v8_regexp.o \ - v8_regerror.o v8_regsub.o wait.o wincap.o window.o \ + spawn.o strace.o strsep.o strsig.o sync.o syscalls.o sysconf.o \ + syslog.o termios.o thread.o timer.o times.o tty.o uinfo.o uname.o \ + v8_regexp.o v8_regerror.o v8_regsub.o wait.o wincap.o window.o \ $(EXTRA_DLL_OFILES) $(EXTRA_OFILES) $(MALLOC_OFILES) $(MT_SAFE_OBJECTS) GMON_OFILES:=gmon.o mcount.o profil.o diff --git a/winsup/cygwin/cygtls.h b/winsup/cygwin/cygtls.h index 0fa1b1b4c..45d067973 100644 --- a/winsup/cygwin/cygtls.h +++ b/winsup/cygwin/cygtls.h @@ -82,6 +82,7 @@ struct _local_storage struct protoent *protoent_buf; struct servent *servent_buf; struct hostent *hostent_buf; + char signamebuf[sizeof ("Unknown signal XX")]; }; /* Please keep this file simple. Changes to the below structure may require diff --git a/winsup/cygwin/include/cygwin/signal.h b/winsup/cygwin/include/cygwin/signal.h index 87af7c883..864ddff7b 100644 --- a/winsup/cygwin/include/cygwin/signal.h +++ b/winsup/cygwin/include/cygwin/signal.h @@ -198,7 +198,11 @@ struct sigaction #define SIGLOST 29 /* resource lost (eg, record-lock lost) */ #define SIGUSR1 30 /* user defined signal 1 */ #define SIGUSR2 31 /* user defined signal 2 */ -#define NSIG 32 /* signal 0 implied */ + +/* Real-Time signals per SUSv3. RT_SIGMAX is defined as 8 in limits.h */ +#define SIGRTMIN 32 +#define SIGRTMAX ((SIGRTMIN) + 0) +#define NSIG 33 /* signal 0 implied */ int sigwait (const sigset_t *, int *); int sigwaitinfo (const sigset_t *, siginfo_t *); diff --git a/winsup/cygwin/include/limits.h b/winsup/cygwin/include/limits.h index 9fa3cf4fe..5d5244384 100644 --- a/winsup/cygwin/include/limits.h +++ b/winsup/cygwin/include/limits.h @@ -1,6 +1,6 @@ /* limits.h - Copyright 1999, 2000, 2001 Red Hat, Inc. + Copyright 1999, 2000, 2001, 2002, 2003, 2004 Red Hat, Inc. This file is part of Cygwin. @@ -164,6 +164,9 @@ details. */ #define _POSIX_SSIZE_MAX 32767 #define _POSIX_STREAM_MAX 8 #define _POSIX_TZNAME_MAX 3 +#define _POSIX_RTSIG_MAX 8 + +#define RTSIG_MAX _POSIX_RTSIG_MAX #endif /* _MACH_MACHLIMITS_H_ */ #endif /* _LIMITS_H___ */ diff --git a/winsup/cygwin/strsig.cc b/winsup/cygwin/strsig.cc new file mode 100644 index 000000000..6d3c479ec --- /dev/null +++ b/winsup/cygwin/strsig.cc @@ -0,0 +1,84 @@ +/* strsig.cc + + 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. */ + +#include "winsup.h" +#include "thread.h" +#include +#include +#include +#include +#include + +struct sigdesc +{ + int n; + const char *name; + const char *str; +}; + +#define _s(n, s) {n, #n, s} +static const sigdesc siglist[] = +{ + _s(SIGHUP, "Hangup"), + _s(SIGINT, "Interrupt"), + _s(SIGQUIT, "Quit"), + _s(SIGILL, "Illegal instruction"), + _s(SIGTRAP, "Trace/breakpoint trap"), + _s(SIGABRT, "Aborted"), + _s(SIGEMT, "EMT instruction"), + _s(SIGFPE, "Floating point exception"), + _s(SIGKILL, "Killed"), + _s(SIGBUS, "Bus error"), + _s(SIGSEGV, "Segmentation fault"), + _s(SIGSYS, "Bad system call"), + _s(SIGPIPE, "Broken pipe"), + _s(SIGALRM, "Alarm clock"), + _s(SIGTERM, "Terminated"), + _s(SIGURG, "Urgent I/O condition"), + _s(SIGSTOP, "Stopped (signal)"), + _s(SIGTSTP, "Stopped"), + _s(SIGCONT, "Continued"), + _s(SIGCHLD, "Child exited"), + _s(SIGCLD, "Child exited"), + _s(SIGTTIN, "Stopped (tty input)"), + _s(SIGTTOU, "Stopped (tty output)"), + _s(SIGIO, "I/O possible"), + _s(SIGPOLL, "I/O possible"), + _s(SIGXCPU, "CPU time limit exceeded"), + _s(SIGXFSZ, "File size limit exceeded"), + _s(SIGVTALRM, "Virtual timer expired"), + _s(SIGPROF, "Profiling timer expired"), + _s(SIGWINCH, "Window changed"), + _s(SIGLOST, "Resource lost"), + _s(SIGUSR1, "User defined signal 1"), + _s(SIGUSR2, "User defined signal 2"), + _s(SIGRTMIN, "Real-time signal 0"), + _s(SIGRTMAX, "Real-time signal 0"), + {0, NULL, NULL} +}; + +extern "C" const char * +strsignal (int signo) +{ + for (int i = 0; siglist[i].n; i++) + if (siglist[i].n == signo) + return siglist[i].str; + __small_sprintf (_my_tls.locals.signamebuf, "Unknown signal %d", signo); + return _my_tls.locals.signamebuf; +} + +extern "C" int +strtosigno (const char *name) +{ + for (int i = 0; siglist[i].n; i++) + if (strcmp (siglist[i].name, name) == 0) + return siglist[i].n; + return 0; +} diff --git a/winsup/cygwin/sysconf.cc b/winsup/cygwin/sysconf.cc index b5a2b383d..5722ed366 100644 --- a/winsup/cygwin/sysconf.cc +++ b/winsup/cygwin/sysconf.cc @@ -120,6 +120,8 @@ sysconf (int in) } return spi.AvailablePages; } + case _SC_RTSIG_MAX: + return RTSIG_MAX; } /* Invalid input or unimplemented sysconf name */ diff --git a/winsup/cygwin/tlsoffsets.h b/winsup/cygwin/tlsoffsets.h index 51c79561e..4fbadb7d1 100644 --- a/winsup/cygwin/tlsoffsets.h +++ b/winsup/cygwin/tlsoffsets.h @@ -1,21 +1,21 @@ //;# autogenerated: Do not edit. -//; $tls::func = -3704; -//; $tls::saved_errno = -3700; -//; $tls::sa_flags = -3696; -//; $tls::oldmask = -3692; -//; $tls::newmask = -3688; -//; $tls::event = -3684; -//; $tls::errno_addr = -3680; -//; $tls::initialized = -3676; -//; $tls::sigmask = -3672; -//; $tls::sigwait_mask = -3668; -//; $tls::sigwait_info = -3664; -//; $tls::threadkill = -3660; -//; $tls::infodata = -3656; -//; $tls::tid = -3508; -//; $tls::local_clib = -3504; -//; $tls::locals = -2576; +//; $tls::func = -3724; +//; $tls::saved_errno = -3720; +//; $tls::sa_flags = -3716; +//; $tls::oldmask = -3712; +//; $tls::newmask = -3708; +//; $tls::event = -3704; +//; $tls::errno_addr = -3700; +//; $tls::initialized = -3696; +//; $tls::sigmask = -3692; +//; $tls::sigwait_mask = -3688; +//; $tls::sigwait_info = -3684; +//; $tls::threadkill = -3680; +//; $tls::infodata = -3676; +//; $tls::tid = -3528; +//; $tls::local_clib = -3524; +//; $tls::locals = -2596; //; $tls::prev = -1040; //; $tls::next = -1036; //; $tls::stackptr = -1032; @@ -24,22 +24,22 @@ //; $tls::padding = 0; //; __DATA__ -#define tls_func (-3704) -#define tls_saved_errno (-3700) -#define tls_sa_flags (-3696) -#define tls_oldmask (-3692) -#define tls_newmask (-3688) -#define tls_event (-3684) -#define tls_errno_addr (-3680) -#define tls_initialized (-3676) -#define tls_sigmask (-3672) -#define tls_sigwait_mask (-3668) -#define tls_sigwait_info (-3664) -#define tls_threadkill (-3660) -#define tls_infodata (-3656) -#define tls_tid (-3508) -#define tls_local_clib (-3504) -#define tls_locals (-2576) +#define tls_func (-3724) +#define tls_saved_errno (-3720) +#define tls_sa_flags (-3716) +#define tls_oldmask (-3712) +#define tls_newmask (-3708) +#define tls_event (-3704) +#define tls_errno_addr (-3700) +#define tls_initialized (-3696) +#define tls_sigmask (-3692) +#define tls_sigwait_mask (-3688) +#define tls_sigwait_info (-3684) +#define tls_threadkill (-3680) +#define tls_infodata (-3676) +#define tls_tid (-3528) +#define tls_local_clib (-3524) +#define tls_locals (-2596) #define tls_prev (-1040) #define tls_next (-1036) #define tls_stackptr (-1032)