diff options
author | Roland McGrath <roland@gnu.org> | 1996-01-04 16:31:08 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1996-01-04 16:31:08 +0000 |
commit | ff795a1448f7f9bf997413510302a6ab285d94b2 (patch) | |
tree | 7fc79b6d45ff5dcdc21ce457efa6d15fd9fda517 | |
parent | 6506ffbeb81bb6b8a5d20bb90d3077bef76feb48 (diff) |
(safe_bzero): Rewritten using hurd_catch_signal.
-rw-r--r-- | exec/exec.c | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/exec/exec.c b/exec/exec.c index 083de201..51ea2bd2 100644 --- a/exec/exec.c +++ b/exec/exec.c @@ -1,5 +1,5 @@ /* GNU Hurd standard exec server. - Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc. + Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. Written by Roland McGrath. Can exec ELF format directly. @@ -110,32 +110,12 @@ check_section (bfd *bfd, asection *sec, void *userdata) /* Zero the specified region but don't crash the server if it faults. */ +#include <hurd/sigpreempt.h> + static error_t safe_bzero (void *ptr, size_t size) { - jmp_buf env; - void fault (int signo) { longjmp (env, 1); } - thread_t thisthread = hurd_thread_self (); - volatile error_t error; - sighandler_t preempt (thread_t thread, int signo, - long int sigcode, int sigerror) - { - if (thread == thisthread) - { - error = sigerror ?: EIO; - return &fault; - } - return SIG_DFL; - } - struct hurd_signal_preempt preempter; - hurd_preempt_signals (&preempter, SIGSEGV, - (long int) ptr, (long int) (ptr + size), - &preempt); - error = 0; - if (! setjmp (env)) - bzero (ptr, size); - hurd_unpreempt_signals (&preempter, SIGSEGV); - return error; + return hurd_safe_memset (ptr, 0, size); } |