diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | grp/grp.h | 3 | ||||
-rw-r--r-- | hurd/hurdsig.c | 2 | ||||
-rw-r--r-- | pwd/pwd.h | 2 | ||||
-rw-r--r-- | shadow/shadow.h | 3 | ||||
-rw-r--r-- | stdlib/atexit.c | 4 | ||||
-rw-r--r-- | stdlib/random.c | 16 | ||||
-rw-r--r-- | sysdeps/mach/hurd/sigwait.c | 136 | ||||
-rw-r--r-- | sysdeps/mach/hurd/ttyname_r.c | 4 | ||||
-rw-r--r-- | sysdeps/stub/lockfile.c | 2 |
10 files changed, 162 insertions, 14 deletions
@@ -1,3 +1,7 @@ +Tue Nov 5 00:04:48 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu> + + * stdio-common/vfprintf.c: Include <libc-lock.h>. + Mon Nov 4 16:57:42 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu> * sysdeps/mach/hurd/ttyname_r.c (ttyname_r): Change prototype to @@ -29,6 +29,9 @@ __BEGIN_DECLS #include <gnu/types.h> +#define __need_size_t +#include <stddef.h> + /* The group structure. */ struct group diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c index 2783a0c..bc2ad9e 100644 --- a/hurd/hurdsig.c +++ b/hurd/hurdsig.c @@ -162,7 +162,7 @@ write_corefile (int signo, const struct hurd_signal_detail *detail) /* Create the new file, but don't link it into the directory yet. */ __dir_mkfile (coredir, O_WRONLY|O_CREAT, 0600 & ~_hurd_umask, /* XXX ? */ - &file)) + &file); /* Call the core dumping server to write the core file. */ err = __crash_dump_task (coreserver, @@ -29,6 +29,8 @@ __BEGIN_DECLS #include <gnu/types.h> +#define __need_size_t +#include <stddef.h> /* The passwd structure. */ struct passwd diff --git a/shadow/shadow.h b/shadow/shadow.h index c27cc9a..c65afc3 100644 --- a/shadow/shadow.h +++ b/shadow/shadow.h @@ -26,6 +26,9 @@ Boston, MA 02111-1307, USA. */ #define __need_FILE #include <stdio.h> +#define __need_size_t +#include <stddef.h> + /* Paths to the userd files. */ #define SHADOW "/etc/shadow" diff --git a/stdlib/atexit.c b/stdlib/atexit.c index 675de66..bf7f91a 100644 --- a/stdlib/atexit.c +++ b/stdlib/atexit.c @@ -49,7 +49,7 @@ __new_exitfn (void) struct exit_function_list *l; size_t i = 0; - __libc_lock_lock (lock) + __libc_lock_lock (lock); for (l = __exit_funcs; l != NULL; l = l->next) { @@ -84,7 +84,7 @@ __new_exitfn (void) if (l != NULL) l->fns[i].flavor = ef_us; - __libc_lock_unlock (lock) + __libc_lock_unlock (lock); return l == NULL ? NULL : &l->fns[i]; } diff --git a/stdlib/random.c b/stdlib/random.c index 461b76f..ffa658d 100644 --- a/stdlib/random.c +++ b/stdlib/random.c @@ -180,9 +180,9 @@ void __srandom (x) unsigned int x; { - __libc_lock_lock (lock) + __libc_lock_lock (lock); (void) __srandom_r (x, &unsafe_state); - __libc_lock_unlock (lock) + __libc_lock_unlock (lock); } weak_alias (__srandom, srandom) @@ -207,13 +207,13 @@ __initstate (seed, arg_state, n) { void *ostate; - __libc_lock_lock (lock) + __libc_lock_lock (lock); ostate = (void *) &unsafe_state.state[-1]; __initstate_r (seed, arg_state, n, &unsafe_state); - __libc_lock_unlock (lock) + __libc_lock_unlock (lock); return ostate; } @@ -234,14 +234,14 @@ __setstate (arg_state) { void *ostate; - __libc_lock_lock (lock) + __libc_lock_lock (lock); ostate = (void *) &unsafe_state.state[-1]; if (__setstate_r (arg_state, &unsafe_state) < 0) ostate = NULL; - __libc_lock_unlock (lock) + __libc_lock_unlock (lock); return ostate; } @@ -264,11 +264,11 @@ __random () { int32_t retval; - __libc_lock_lock (lock) + __libc_lock_lock (lock); (void) __random_r (&unsafe_state, &retval); - __libc_lock_unlock (lock) + __libc_lock_unlock (lock); return retval; } diff --git a/sysdeps/mach/hurd/sigwait.c b/sysdeps/mach/hurd/sigwait.c new file mode 100644 index 0000000..b3916f8 --- /dev/null +++ b/sysdeps/mach/hurd/sigwait.c @@ -0,0 +1,136 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <errno.h> +#include <hurd.h> +#include <hurd/signal.h> +#include <hurd/msg.h> +#include <hurd/sigpreempt.h> +#include <assert.h> + +/* Select any of pending signals from SET or wait for any to arrive. */ +int +__sigwait (const sigset_t *set, int *sig) +{ + struct hurd_sigstate *ss; + sigset_t mask; + int signo = 0; + struct hurd_signal_preempter preempter; + jmp_buf buf; + mach_port_t wait; + mach_msg_header_t msg; + + sighandler_t + preempt_fun (struct hurd_signal_preempter *pe, + struct hurd_sigstate *ss, + int *sigp, + struct hurd_signal_detail *detail) + { + if (signo) + /* We've already been run; don't interfere. */ + return SIG_ERR; + + signo = *sigp; + + /* Make sure this is all kosher */ + assert (__sigismember (&mask, signo)); + + /* Make sure this signal is unblocked */ + __sigdelset (&ss->blocked, signo); + + return pe->handler; + } + + void + handler (int sig) + { + assert (sig == signo); + longjmp (buf, 1); + } + + wait = __mach_reply_port (); + + if (set != NULL) + /* Crash before locking */ + mask = *set; + + ss = _hurd_self_sigstate (); + __spin_lock (&ss->lock); + + /* See if one of these signals is currently pending */ + if (ss->pending & mask) + { + for (signo = 1; signo < NSIG; signo++) + if (__sigismember (&ss->pending, signo)) + { + __sigdelset (&ss->pending, signo); + goto all_done; + } + /* Huh? Where'd it go? */ + abort (); + } + + /* Wait for one of them to show up */ + + if (!setjmp (buf)) + { + /* Make the preempter */ + preempter.signals = mask; + preempter.first = 0; + preempter.last = -1; + preempter.preempter = preempt_fun; + preempter.handler = handler; + + /* Install this preempter */ + preempter.next = ss->preempters; + ss->preempters = &preempter; + + __spin_unlock (&ss->lock); + + /* Wait. */ + __mach_msg (&msg, MACH_RCV_MSG, 0, sizeof (msg), wait, + MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + abort (); + } + else + { + assert (signo); + + __spin_lock (&ss->lock); + + /* Delete our preempter. */ + assert (ss->preempters == &preempter); + ss->preempters = preempter.next; + } + + +all_done: + /* Cause the pointless side-effect. */ + __sigfillset (&ss->blocked); + for (signo = 1; signo < NSIG; signo++) + if (__sigismember (&mask, signo)) + __sigdelset (&ss->blocked, signo); + + spin_unlock (&ss->lock); + + __mach_port_destroy (__mach_task_self (), wait); + *sig = signo; + return 0; +} + +weak_alias (__sigwait, sigwait) diff --git a/sysdeps/mach/hurd/ttyname_r.c b/sysdeps/mach/hurd/ttyname_r.c index 67ff37d..f958dd9 100644 --- a/sysdeps/mach/hurd/ttyname_r.c +++ b/sysdeps/mach/hurd/ttyname_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994, 1995 Free Software Foundation, Inc. +/* Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -26,7 +26,7 @@ Cambridge, MA 02139, USA. */ /* Store at most BUFLEN characters of the pathname of the terminal FD is open on in BUF. Return 0 on success, -1 otherwise. */ int -ttyname_r (int fd, char *buf, int buflen) +ttyname_r (int fd, char *buf, size_t buflen) { error_t err; char nodename[1024]; /* XXX */ diff --git a/sysdeps/stub/lockfile.c b/sysdeps/stub/lockfile.c index 112a7ad..b3ccc7b 100644 --- a/sysdeps/stub/lockfile.c +++ b/sysdeps/stub/lockfile.c @@ -41,7 +41,7 @@ __internal_funlockfile (FILE *stream) #ifdef USE_IN_LIBIO weak_alias (__internal_funlockfile, _IO_funlockfile) #else -weak_alias (__internal_funlockfile, __internal_funlockfile) +weak_alias (__internal_funlockfile, __funlockfile) #endif weak_alias (__internal_funlockfile, funlockfile); |