mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
* hurd/hurdsig.c: Use assert_perror for many calls which should
never fail and previously were not checked.
This commit is contained in:
@ -1,5 +1,8 @@
|
|||||||
Thu Apr 20 22:23:58 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
|
Thu Apr 20 22:23:58 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
|
||||||
|
|
||||||
|
* hurd/hurdsig.c: Use assert_perror for many calls which should
|
||||||
|
never fail and previously were not checked.
|
||||||
|
|
||||||
* sysdeps/mach/hurd/i386/trampoline.c (_hurd_setup_sighandler):
|
* sysdeps/mach/hurd/i386/trampoline.c (_hurd_setup_sighandler):
|
||||||
Point the return address for sigreturn's frame at a "hlt" insn so
|
Point the return address for sigreturn's frame at a "hlt" insn so
|
||||||
it will definitely crash if sigreturn returns.
|
it will definitely crash if sigreturn returns.
|
||||||
|
46
configure
vendored
46
configure
vendored
@ -621,6 +621,19 @@ none)
|
|||||||
base_os='' ;;
|
base_os='' ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Some configurations imply other options.
|
||||||
|
case "$os" in
|
||||||
|
gnu* | linux* | bsd4.4* | netbsd* | freebsd*)
|
||||||
|
# These systems always use GNU tools.
|
||||||
|
gnu_ld=yes gnu_as=yes
|
||||||
|
esac
|
||||||
|
case "$os" in
|
||||||
|
gnu*elf* | linux* | sysv4* | solaris2*)
|
||||||
|
# These systems always use the ELF format.
|
||||||
|
elf=yes
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
# For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
|
# For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
|
||||||
tail=$os
|
tail=$os
|
||||||
ostry=$os
|
ostry=$os
|
||||||
@ -647,6 +660,10 @@ mach=
|
|||||||
tail=$machine
|
tail=$machine
|
||||||
while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
|
while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
|
||||||
set $m
|
set $m
|
||||||
|
# If using ELF, look for an `elf' subdirectory of each machine directory.
|
||||||
|
if test "$elf" = yes; then
|
||||||
|
mach="$mach /$1/elf"
|
||||||
|
fi
|
||||||
mach="$mach /$1"
|
mach="$mach /$1"
|
||||||
tail="$2"
|
tail="$2"
|
||||||
done
|
done
|
||||||
@ -680,18 +697,6 @@ fi
|
|||||||
|
|
||||||
# We have now validated the configuration.
|
# We have now validated the configuration.
|
||||||
|
|
||||||
# Some configurations imply other options.
|
|
||||||
case "$host_os" in
|
|
||||||
gnu* | linux* | bsd4.4* | netbsd* | freebsd*)
|
|
||||||
# These systems always use GNU tools.
|
|
||||||
gnu_ld=yes gnu_as=yes
|
|
||||||
esac
|
|
||||||
case "$host_os" in
|
|
||||||
gnu*elf* | linux* | sysv4* | solaris2*)
|
|
||||||
# These systems always use the ELF format.
|
|
||||||
elf=yes
|
|
||||||
esac
|
|
||||||
|
|
||||||
|
|
||||||
# Remove the leading slashes.
|
# Remove the leading slashes.
|
||||||
sysnames="`echo $sysnames | sed -e 's@^/@@' -e 's@ /@ @g'`"
|
sysnames="`echo $sysnames | sed -e 's@^/@@' -e 's@ /@ @g'`"
|
||||||
@ -707,17 +712,6 @@ if test "$with_fp" = yes; then
|
|||||||
sysnames="`echo $fpu_dirs | sed -e 's,^/,,' -e 's, /,,g'` $sysnames"
|
sysnames="`echo $fpu_dirs | sed -e 's,^/,,' -e 's, /,,g'` $sysnames"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If using ELF, prepend the machine-specific ELF ABI directory.
|
|
||||||
if test "$elf" = yes; then
|
|
||||||
elf_dirs=
|
|
||||||
for m in $mach; do
|
|
||||||
if test -d $sysdep_dir$m/elf; then
|
|
||||||
elf_dirs="elf_dirs $m/elf"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
sysnames="`echo elf_dirs | sed -e 's,^/,,' -e 's, /,,g'` $sysnames"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Expand the list of system names into a full list of directories
|
# Expand the list of system names into a full list of directories
|
||||||
@ -999,7 +993,7 @@ else
|
|||||||
# On the NeXT, cc -E runs the code through the compiler's parser,
|
# On the NeXT, cc -E runs the code through the compiler's parser,
|
||||||
# not just through cpp.
|
# not just through cpp.
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 1003 "configure"
|
#line 997 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
Syntax Error
|
Syntax Error
|
||||||
@ -1013,7 +1007,7 @@ else
|
|||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
CPP="${CC-cc} -E -traditional-cpp"
|
CPP="${CC-cc} -E -traditional-cpp"
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 1017 "configure"
|
#line 1011 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
Syntax Error
|
Syntax Error
|
||||||
@ -1065,7 +1059,7 @@ if eval "test \"`echo '$''{'libc_cv_friendly_stddef'+set}'`\" = set"; then
|
|||||||
echo $ac_n "(cached) $ac_c" 1>&4
|
echo $ac_n "(cached) $ac_c" 1>&4
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 1069 "configure"
|
#line 1063 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
#define __need_size_t
|
#define __need_size_t
|
||||||
#define __need_wchar_t
|
#define __need_wchar_t
|
||||||
|
@ -62,7 +62,7 @@ _hurd_thread_sigstate (thread_t thread)
|
|||||||
__mutex_lock (&_hurd_siglock);
|
__mutex_lock (&_hurd_siglock);
|
||||||
for (ss = _hurd_sigstates; ss != NULL; ss = ss->next)
|
for (ss = _hurd_sigstates; ss != NULL; ss = ss->next)
|
||||||
if (ss->thread == thread)
|
if (ss->thread == thread)
|
||||||
break;
|
break;
|
||||||
if (ss == NULL)
|
if (ss == NULL)
|
||||||
{
|
{
|
||||||
ss = malloc (sizeof (*ss));
|
ss = malloc (sizeof (*ss));
|
||||||
@ -185,11 +185,14 @@ post_reply (mach_port_t *reply_port, mach_msg_type_name_t reply_port_type,
|
|||||||
int untraced,
|
int untraced,
|
||||||
error_t result)
|
error_t result)
|
||||||
{
|
{
|
||||||
|
error_t err;
|
||||||
if (reply_port == NULL || *reply_port == MACH_PORT_NULL)
|
if (reply_port == NULL || *reply_port == MACH_PORT_NULL)
|
||||||
return;
|
return;
|
||||||
(untraced ? __msg_sig_post_untraced_reply : __msg_sig_post_reply)
|
err = (untraced ? __msg_sig_post_untraced_reply : __msg_sig_post_reply)
|
||||||
(*reply_port, reply_port_type, result);
|
(*reply_port, reply_port_type, result);
|
||||||
*reply_port = MACH_PORT_NULL;
|
*reply_port = MACH_PORT_NULL;
|
||||||
|
if (err != MACH_SEND_INVALID_DEST) /* Ignore dead reply port. */
|
||||||
|
assert_perror (err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -208,7 +211,8 @@ abort_thread (struct hurd_sigstate *ss, struct machine_thread_all_state *state,
|
|||||||
{
|
{
|
||||||
if (!(state->set & THREAD_ABORTED))
|
if (!(state->set & THREAD_ABORTED))
|
||||||
{
|
{
|
||||||
__thread_abort (ss->thread);
|
error_t err = __thread_abort (ss->thread);
|
||||||
|
assert_perror (err);
|
||||||
/* Clear all thread state flavor set bits, because thread_abort may
|
/* Clear all thread state flavor set bits, because thread_abort may
|
||||||
have changed the state. */
|
have changed the state. */
|
||||||
state->set = THREAD_ABORTED;
|
state->set = THREAD_ABORTED;
|
||||||
@ -423,6 +427,7 @@ _hurd_internal_post_signal (struct hurd_sigstate *ss,
|
|||||||
mach_msg_type_name_t reply_port_type,
|
mach_msg_type_name_t reply_port_type,
|
||||||
int untraced)
|
int untraced)
|
||||||
{
|
{
|
||||||
|
error_t err;
|
||||||
struct machine_thread_all_state thread_state;
|
struct machine_thread_all_state thread_state;
|
||||||
enum { stop, ignore, core, term, handle } act;
|
enum { stop, ignore, core, term, handle } act;
|
||||||
sighandler_t handler;
|
sighandler_t handler;
|
||||||
@ -601,8 +606,13 @@ _hurd_internal_post_signal (struct hurd_sigstate *ss,
|
|||||||
{
|
{
|
||||||
if (threads[i] != _hurd_msgport_thread &&
|
if (threads[i] != _hurd_msgport_thread &&
|
||||||
(act != handle || threads[i] != ss->thread))
|
(act != handle || threads[i] != ss->thread))
|
||||||
__thread_resume (threads[i]);
|
{
|
||||||
__mach_port_deallocate (__mach_task_self (), threads[i]);
|
err = __thread_resume (threads[i]);
|
||||||
|
assert_perror (err);
|
||||||
|
}
|
||||||
|
err = __mach_port_deallocate (__mach_task_self (),
|
||||||
|
threads[i]);
|
||||||
|
assert_perror (err);
|
||||||
}
|
}
|
||||||
__vm_deallocate (__mach_task_self (),
|
__vm_deallocate (__mach_task_self (),
|
||||||
(vm_address_t) threads,
|
(vm_address_t) threads,
|
||||||
@ -641,10 +651,13 @@ _hurd_internal_post_signal (struct hurd_sigstate *ss,
|
|||||||
{
|
{
|
||||||
case stop:
|
case stop:
|
||||||
if (_hurd_stopped)
|
if (_hurd_stopped)
|
||||||
/* We are already stopped, but receiving an untraced stop
|
{
|
||||||
signal. Instead of resuming and suspending again, just
|
/* We are already stopped, but receiving an untraced stop
|
||||||
notify the proc server of the new stop signal. */
|
signal. Instead of resuming and suspending again, just
|
||||||
__USEPORT (PROC, __proc_mark_stop (port, signo));
|
notify the proc server of the new stop signal. */
|
||||||
|
error_t err = __USEPORT (PROC, __proc_mark_stop (port, signo));
|
||||||
|
assert_perror (err);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
/* Suspend the process. */
|
/* Suspend the process. */
|
||||||
suspend ();
|
suspend ();
|
||||||
@ -658,7 +671,8 @@ _hurd_internal_post_signal (struct hurd_sigstate *ss,
|
|||||||
case core: /* And leave a rotting corpse. */
|
case core: /* And leave a rotting corpse. */
|
||||||
nirvana:
|
nirvana:
|
||||||
/* Have the proc server stop all other threads in our task. */
|
/* Have the proc server stop all other threads in our task. */
|
||||||
__USEPORT (PROC, __proc_dostop (port, _hurd_msgport_thread));
|
err = __USEPORT (PROC, __proc_dostop (port, _hurd_msgport_thread));
|
||||||
|
assert_perror (err);
|
||||||
/* No more user instructions will be executed.
|
/* No more user instructions will be executed.
|
||||||
The signal can now be considered delivered. */
|
The signal can now be considered delivered. */
|
||||||
reply ();
|
reply ();
|
||||||
@ -684,7 +698,10 @@ _hurd_internal_post_signal (struct hurd_sigstate *ss,
|
|||||||
|
|
||||||
/* Stop the thread and abort its pending RPC operations. */
|
/* Stop the thread and abort its pending RPC operations. */
|
||||||
if (! ss_suspended)
|
if (! ss_suspended)
|
||||||
__thread_suspend (ss->thread);
|
{
|
||||||
|
err = __thread_suspend (ss->thread);
|
||||||
|
assert_perror (err);
|
||||||
|
}
|
||||||
|
|
||||||
/* Abort the thread's kernel context, so any pending message send
|
/* Abort the thread's kernel context, so any pending message send
|
||||||
or receive completes immediately or aborts. If an interruptible
|
or receive completes immediately or aborts. If an interruptible
|
||||||
@ -750,10 +767,12 @@ _hurd_internal_post_signal (struct hurd_sigstate *ss,
|
|||||||
|
|
||||||
/* Start the thread running the handler (or possibly waiting for an
|
/* Start the thread running the handler (or possibly waiting for an
|
||||||
RPC reply before running the handler). */
|
RPC reply before running the handler). */
|
||||||
__thread_set_state (ss->thread, MACHINE_THREAD_STATE_FLAVOR,
|
err = __thread_set_state (ss->thread, MACHINE_THREAD_STATE_FLAVOR,
|
||||||
(natural_t *) &thread_state.basic,
|
(natural_t *) &thread_state.basic,
|
||||||
MACHINE_THREAD_STATE_COUNT);
|
MACHINE_THREAD_STATE_COUNT);
|
||||||
__thread_resume (ss->thread);
|
assert_perror (err);
|
||||||
|
err = __thread_resume (ss->thread);
|
||||||
|
assert_perror (err);
|
||||||
thread_state.set = 0; /* Everything we know is now wrong. */
|
thread_state.set = 0; /* Everything we know is now wrong. */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user