aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog16
-rw-r--r--linuxthreads/ChangeLog5
-rw-r--r--linuxthreads/sysdeps/unix/sysv/linux/bits/sigthread.h5
-rw-r--r--signal/signal.h73
-rw-r--r--sysdeps/generic/segfault.c33
-rw-r--r--sysdeps/i386/i486/bits/string.h2
-rw-r--r--wcsmbs/wchar.h3
7 files changed, 78 insertions, 59 deletions
diff --git a/ChangeLog b/ChangeLog
index b0bd30e6b8..ba55a5701b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+1998-09-12 Mark Kettenis <kettenis@phys.uva.nl>
+
+ * sysdeps/generic/segfault.c (install_handler): Install signal
+ handler with SA_ONSTACK instead of setting the stack flags to
+ SS_ONSTACK. Do not install handler for SIGSTKFLT if it is not
+ defined.
+
+1998-09-12 14:24 -0400 Zack Weinberg <zack@rabi.phys.columbia.edu>
+
+ * signal/signal.h: Fix multiple inclusion guard to cover the
+ entire file.
+ * wcsmbs/wchar.h: Remove prototype of internal function
+ __mbsrtowcs.
+ * sysdeps/i386/i486/bits/string.h (memchr): Don't do
+ arithmetic on `void *'.
+
1998-09-12 01:09 Tim Waugh <tim@cyberelk.demon.co.uk>
* posix/wordexp-test.c: Fix wrong tests. Add new tests.
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index 2812806fe7..b33db03c35 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,8 @@
+1998-09-12 14:24 -0400 Zack Weinberg <zack@rabi.phys.columbia.edu>
+
+ * linuxthreads/sysdeps/unix/sysv/linux/bits/sigthread.h: Add
+ multiple inclusion guard.
+
1998-09-02 11:08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* signals.c (sigaction): Check that sig is less than NSIG to avoid
diff --git a/linuxthreads/sysdeps/unix/sysv/linux/bits/sigthread.h b/linuxthreads/sysdeps/unix/sysv/linux/bits/sigthread.h
index 7bd0974409..c9b1dcf1be 100644
--- a/linuxthreads/sysdeps/unix/sysv/linux/bits/sigthread.h
+++ b/linuxthreads/sysdeps/unix/sysv/linux/bits/sigthread.h
@@ -17,6 +17,9 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#ifndef _BITS_SIGTHREAD_H
+#define _BITS_SIGTHREAD_H 1
+
#if !defined _SIGNAL_H && !defined _PTHREAD_H
# error "Never include this file directly. Use <pthread.h> instead"
#endif
@@ -30,3 +33,5 @@ extern int pthread_sigmask __P ((int __how, __const __sigset_t *__newmask,
/* Send signal SIGNO to the given thread. */
extern int pthread_kill __P ((pthread_t __thread, int __signo));
+
+#endif /* bits/sigthread.h */
diff --git a/signal/signal.h b/signal/signal.h
index 93058973a9..62ccf19699 100644
--- a/signal/signal.h
+++ b/signal/signal.h
@@ -23,33 +23,44 @@
#ifndef _SIGNAL_H
#if !defined __need_sig_atomic_t && !defined __need_sigset_t
-# define _SIGNAL_H 1
-# include <features.h>
+# define _SIGNAL_H
#endif
+#include <features.h>
+
__BEGIN_DECLS
-#include <bits/types.h>
#include <bits/sigset.h> /* __sigset_t, __sig_atomic_t. */
-#if defined _SIGNAL_H && defined __USE_XOPEN && !defined pid_t
-typedef __pid_t pid_t;
-# define pid_t pid_t
-#endif /* Unix98 */
-
-#if !defined __sig_atomic_t_defined \
- && (defined _SIGNAL_H || defined __need_sig_atomic_t)
/* An integral type that can be modified atomically, without the
possibility of a signal arriving in the middle of the operation. */
+#ifndef __sig_atomic_t_defined
+# if defined __need_sig_atomic_t || defined _SIGNAL_H
+# undef __need_sig_atomic_t
+# define __sig_atomic_t_defined 1
typedef __sig_atomic_t sig_atomic_t;
-# define __sig_atomic_t_defined
-#endif /* `sig_atomic_t' undefined and <signal.h> or need `sig_atomic_t'. */
-#undef __need_sig_atomic_t
+# endif
+#endif
+
+#ifndef __sigset_t_defined
+# if defined __need_sigset_t || (defined _SIGNAL_H && defined __USE_POSIX)
+# undef __need_sigset_t
+# define __sigset_t_defined 1
+typedef __sigset_t sigset_t;
+# endif
+#endif
#ifdef _SIGNAL_H
+#include <bits/types.h>
#include <bits/signum.h>
+#if defined __USE_XOPEN && !defined pid_t
+typedef __pid_t pid_t;
+# define pid_t pid_t
+#endif /* Unix98 */
+
+
/* Type of a signal handler. */
typedef void (*__sighandler_t) __PMT ((int));
@@ -120,7 +131,7 @@ extern void psignal __P ((int __sig, __const char *__s));
selects the X/Open version. */
extern int __sigpause __P ((int __sig_or_mask, int __is_sig));
-#if defined __USE_BSD || defined __USE_GNU
+#ifdef __USE_BSD
/* Set the mask of blocked signals to MASK,
wait for a signal to arrive, and then restore the mask. */
extern int sigpause __P ((int __mask));
@@ -166,20 +177,8 @@ typedef __sighandler_t sighandler_t;
typedef __sighandler_t sig_t;
#endif
-#endif /* <signal.h> included. */
-
-
-#if !defined __sigset_t_defined \
- && ((defined _SIGNAL_H && defined __USE_POSIX) || defined __need_sigset_t)
-typedef __sigset_t sigset_t;
-# define __sigset_t_defined 1
-#endif /* `sigset_t' not defined and <signal.h> or need `sigset_t'. */
-#undef __need_sigset_t
-
#ifdef __USE_POSIX
-# ifdef _SIGNAL_H
-
/* We need `struct timespec' later on. */
# define __need_timespec
# include <time.h>
@@ -253,11 +252,9 @@ extern int sigtimedwait __P ((__const sigset_t *__set, siginfo_t *__info,
extern int sigqueue __P ((__pid_t __pid, int __sig,
__const union sigval __val));
-# endif /* <signal.h> included. */
-
#endif /* Use POSIX. */
-#if defined _SIGNAL_H && defined __USE_BSD
+#ifdef __USE_BSD
/* Names of the signals. This variable exists only for compatibility.
Use `strsignal' instead (see <string.h>). */
@@ -295,13 +292,10 @@ extern int sigvec __P ((int __sig, __const struct sigvec *__vec,
/* Restore the state saved in SCP. */
extern int sigreturn __P ((struct sigcontext *__scp));
-#endif /* signal.h included and use BSD. */
-
+#endif /* use BSD. */
-#if defined _SIGNAL_H && (defined __USE_BSD || defined __USE_XOPEN_EXTENDED)
-# define __need_size_t
-# include <stddef.h>
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
/* If INTERRUPT is nonzero, make signal SIG interrupt system calls
(causing them to fail with EINTR); if INTERRUPT is zero, make system
@@ -321,10 +315,9 @@ extern int sigstack __P ((__const struct sigstack *__ss,
extern int sigaltstack __P ((__const struct sigaltstack *__ss,
struct sigaltstack *__oss));
-#endif /* signal.h included and use BSD or X/Open Unix. */
-
+#endif /* use BSD or X/Open Unix. */
-#if defined _SIGNAL_H && defined __USE_UNIX98
+#ifdef __USE_UNIX98
/* Simplified interface for signal management. */
/* Add SIG to the calling process' signal mask. */
@@ -338,7 +331,7 @@ extern int sigignore __P ((int __sig));
/* Set the disposition of SIG. */
extern __sighandler_t sigset __P ((int __sig, __sighandler_t __disp));
-#endif
+#endif /* use Unix98 */
#ifdef __USE_POSIX
/* Some of the functions for handling signals in threaded programs must
@@ -357,6 +350,8 @@ extern int __libc_current_sigrtmax __P ((void));
/* Allocate real-time signal with highest/lowest available priority. */
extern int __libc_allocate_rtsig __P ((int __high));
+#endif /* signal.h */
+
__END_DECLS
-#endif /* signal.h */
+#endif /* not signal.h */
diff --git a/sysdeps/generic/segfault.c b/sysdeps/generic/segfault.c
index 5a9e64a105..b0778df6fc 100644
--- a/sysdeps/generic/segfault.c
+++ b/sysdeps/generic/segfault.c
@@ -163,6 +163,23 @@ install_handler (void)
sigemptyset (&sa.sa_mask);
sa.sa_flags = SA_RESTART;
+ /* Maybe we are expected to use an alternative stack. */
+ if (getenv ("SEGFAULT_USE_ALTSTACK") != 0)
+ {
+ void *stack_mem = malloc (2 * SIGSTKSZ);
+ struct sigaltstack ss;
+
+ if (stack_mem != NULL)
+ {
+ ss.ss_sp = stack_mem;
+ ss.ss_flags = 0;
+ ss.ss_size = 2 * SIGSTKSZ;
+
+ if (sigaltstack (&ss, NULL) == 0)
+ sa.sa_flags |= SA_ONSTACK;
+ }
+ }
+
if (sigs == NULL)
sigaction (SIGSEGV, &sa, NULL);
else if (sigs[0] == '\0')
@@ -191,20 +208,4 @@ install_handler (void)
INSTALL_FOR_SIG (SIGABRT, "abrt");
INSTALL_FOR_SIG (SIGFPE, "fpe");
}
-
- /* Maybe we are expected to use an alternative stack. */
- if (getenv ("SEGFAULT_USE_ALTSTACK") != 0)
- {
- void *stack_mem = malloc (2 * SIGSTKSZ);
- struct sigaltstack ss;
-
- if (stack_mem != NULL)
- {
- ss.ss_sp = stack_mem;
- ss.ss_flags = SS_ONSTACK;
- ss.ss_size = 2 * SIGSTKSZ;
-
- sigaltstack (&ss, NULL);
- }
- }
}
diff --git a/sysdeps/i386/i486/bits/string.h b/sysdeps/i386/i486/bits/string.h
index 921c66498e..134f117377 100644
--- a/sysdeps/i386/i486/bits/string.h
+++ b/sysdeps/i386/i486/bits/string.h
@@ -329,7 +329,7 @@ __STRING_INLINE void *
memchr (__const void *__s, int __c, size_t __n)
{
register unsigned long int __d0;
- register void *__res;
+ register unsigned char *__res;
if (__n == 0)
return NULL;
#ifdef __i686__
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index 0bf9c7c5b9..0bd50f7c60 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -244,9 +244,6 @@ extern __inline size_t mbrlen (__const char *__restrict __s, size_t __n,
/* Write wide character representation of multibyte character string
SRC to DST. */
-extern size_t __mbsrtowcs __P ((wchar_t *__restrict __dst,
- __const char **__restrict __src,
- size_t __len, mbstate_t *__restrict __ps));
extern size_t mbsrtowcs __P ((wchar_t *__restrict __dst,
__const char **__restrict __src,
size_t __len, mbstate_t *__restrict __ps));