diff options
author | Roland McGrath <roland@gnu.org> | 2002-02-17 07:19:11 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2002-02-17 07:19:11 +0000 |
commit | 61c83c3f0573d03cda87717ee46b5c985c4646fd (patch) | |
tree | 1f3a38e0adcca1304a73547f63d86938c97e1951 | |
parent | c12bc232a1d747402e88efc8b4a90e0014f04928 (diff) | |
download | glibc-61c83c3f0573d03cda87717ee46b5c985c4646fd.tar glibc-61c83c3f0573d03cda87717ee46b5c985c4646fd.tar.gz glibc-61c83c3f0573d03cda87717ee46b5c985c4646fd.tar.bz2 glibc-61c83c3f0573d03cda87717ee46b5c985c4646fd.zip |
* sysdeps/mach/configure.in: Add some checks for Mach headers
to ensure a sane installation.
(mach_interface_list): Define this variable by checking for .defs
files found in various variants.
* configure.in (mach_interface_list): AC_SUBST this.
* config.make.in (mach-interface-list): New substituted variable.
* mach/Makefile (user-interfaces): Define this using the value
of $(mach-interface-list) instead of mach, mach4.
Updated other references to mach_interface to use it as well.
* sysdeps/mach/powerpc/machine-lock.h: Avoid multi-line strings.
* mach/msgserver.c [NDR_CHAR_ASCII] (mig_reply_header_t): #define as
mig_reply_error_t for OSF Mach variant.
* mach/Makefile (routines): Remove bootprivport.
* mach/bootprivport.c: File removed. It has never been used.
* mach/msg-destroy.c (__mach_msg_destroy) [MACH_MSG_PORT_DESCRIPTOR]:
Grok the OSF flavor of message format.
(mach_msg_destroy_port): For MAKE_SEND and
MAKE_SEND_ONCE rights, create an destroy a right to ensure proper
no-senders notification.
2002-02-06 Roland McGrath <roland@frob.com>
* hurd/Versions (libc: GLIBC_2.0): Move cthread_fork, cthread_detach
to here if 2.0 compatibility enabled ...
(libc: GLIBC_2.1.3): ... from here.
-rw-r--r-- | ChangeLog | 32 | ||||
-rw-r--r-- | config.make.in | 2 | ||||
-rw-r--r-- | configure.in | 3 | ||||
-rw-r--r-- | hurd/Versions | 8 | ||||
-rw-r--r-- | mach/msg-destroy.c | 100 | ||||
-rw-r--r-- | mach/msgserver.c | 10 | ||||
-rw-r--r-- | sysdeps/mach/configure.in | 29 | ||||
-rw-r--r-- | sysdeps/mach/powerpc/machine-lock.h | 20 |
8 files changed, 184 insertions, 20 deletions
@@ -1,3 +1,35 @@ +2002-02-16 Roland McGrath <roland@frob.com> + + * sysdeps/mach/configure.in: Add some checks for Mach headers + to ensure a sane installation. + (mach_interface_list): Define this variable by checking for .defs + files found in various variants. + * configure.in (mach_interface_list): AC_SUBST this. + * config.make.in (mach-interface-list): New substituted variable. + * mach/Makefile (user-interfaces): Define this using the value + of $(mach-interface-list) instead of mach, mach4. + Updated other references to mach_interface to use it as well. + + * sysdeps/mach/powerpc/machine-lock.h: Avoid multi-line strings. + + * mach/msgserver.c [NDR_CHAR_ASCII] (mig_reply_header_t): #define as + mig_reply_error_t for OSF Mach variant. + + * mach/Makefile (routines): Remove bootprivport. + * mach/bootprivport.c: File removed. It has never been used. + + * mach/msg-destroy.c (__mach_msg_destroy) [MACH_MSG_PORT_DESCRIPTOR]: + Grok the OSF flavor of message format. + (mach_msg_destroy_port): For MAKE_SEND and + MAKE_SEND_ONCE rights, create an destroy a right to ensure proper + no-senders notification. + +2002-02-06 Roland McGrath <roland@frob.com> + + * hurd/Versions (libc: GLIBC_2.0): Move cthread_fork, cthread_detach + to here if 2.0 compatibility enabled ... + (libc: GLIBC_2.1.3): ... from here. + 2002-02-15 Ulrich Drepper <drepper@redhat.com> * elf/dl-open.c (dl_open_worker): Catch wrap-around of TLS diff --git a/config.make.in b/config.make.in index 7caf2a2863..76048959c2 100644 --- a/config.make.in +++ b/config.make.in @@ -57,6 +57,8 @@ no-whole-archive = @no_whole_archive@ exceptions = @exceptions@ have_doors = @linux_doors@ +mach-interface-list = @mach_interface_list@ + have-bash2 = @libc_cv_have_bash2@ have-ksh = @libc_cv_have_ksh@ diff --git a/configure.in b/configure.in index 5d9a52bda4..3546475297 100644 --- a/configure.in +++ b/configure.in @@ -1658,6 +1658,9 @@ case "$add_ons" in esac AC_SUBST(linux_doors) +dnl See sysdeps/mach/configure.in for this variable. +AC_SUBST(mach_interface_list) + if test "`(cd $srcdir; pwd)`" = "`pwd`"; then config_makefile= else diff --git a/hurd/Versions b/hurd/Versions index bac36c75f9..9b20923f8a 100644 --- a/hurd/Versions +++ b/hurd/Versions @@ -22,6 +22,9 @@ libc { # cthreads functions with stubs in libc cthread_keycreate; cthread_getspecific; cthread_setspecific; __libc_getspecific; + + # weak refs to libthreads functions that libc calls iff libthreads in use + cthread_fork; cthread_detach; %endif # necessary for the Hurd brk implementation @@ -124,11 +127,6 @@ libc { seteuids; } GLIBC_2.1.3 { -%if SHLIB_COMPAT (libc, GLIBC_2_1_3, HURD_CTHREADS_0_3) - # c* - cthread_fork; cthread_detach; -%endif - # d* directory_name_split; diff --git a/mach/msg-destroy.c b/mach/msg-destroy.c index 1e618df0bf..9ecbdc0512 100644 --- a/mach/msg-destroy.c +++ b/mach/msg-destroy.c @@ -26,6 +26,15 @@ /* * HISTORY * $Log$ + * Revision 1.6 2002/02/17 07:13:36 roland + * 2002-02-16 Roland McGrath <roland@frob.com> + * + * * mach/msg-destroy.c (__mach_msg_destroy) [MACH_MSG_PORT_DESCRIPTOR]: + * Grok the OSF flavor of message format. + * (mach_msg_destroy_port): For MAKE_SEND and + * MAKE_SEND_ONCE rights, create an destroy a right to ensure proper + * no-senders notification. + * * Revision 1.5 1997/06/21 01:40:07 drepper * More 64bit changes. * @@ -91,6 +100,69 @@ __mach_msg_destroy(msg) mach_msg_destroy_port(msg->msgh_remote_port, MACH_MSGH_BITS_REMOTE(mbits)); if (mbits & MACH_MSGH_BITS_COMPLEX) { +#ifdef MACH_MSG_PORT_DESCRIPTOR + mach_msg_body_t *body; + mach_msg_descriptor_t *saddr, *eaddr; + + body = (mach_msg_body_t *) (msg + 1); + saddr = (mach_msg_descriptor_t *) + ((mach_msg_base_t *) msg + 1); + eaddr = saddr + body->msgh_descriptor_count; + + for ( ; saddr < eaddr; saddr++) { + switch (saddr->type.type) { + + case MACH_MSG_PORT_DESCRIPTOR: { + mach_msg_port_descriptor_t *dsc; + + /* + * Destroy port rights carried in the message + */ + dsc = &saddr->port; + mach_msg_destroy_port(dsc->name, dsc->disposition); + break; + } + + case MACH_MSG_OOL_DESCRIPTOR : { + mach_msg_ool_descriptor_t *dsc; + + /* + * Destroy memory carried in the message + */ + dsc = &saddr->out_of_line; + if (dsc->deallocate) { + mach_msg_destroy_memory((vm_offset_t)dsc->address, + dsc->size); + } + break; + } + + case MACH_MSG_OOL_PORTS_DESCRIPTOR : { + mach_port_t *ports; + mach_msg_ool_ports_descriptor_t *dsc; + mach_msg_type_number_t j; + + /* + * Destroy port rights carried in the message + */ + dsc = &saddr->ool_ports; + ports = (mach_port_t *) dsc->address; + for (j = 0; j < dsc->count; j++, ports++) { + mach_msg_destroy_port(*ports, dsc->disposition); + } + + /* + * Destroy memory carried in the message + */ + if (dsc->deallocate) { + mach_msg_destroy_memory((vm_offset_t)dsc->address, + dsc->count * sizeof(mach_port_t)); + } + break; + } + } + } +#else vm_offset_t saddr; vm_offset_t eaddr; @@ -142,6 +214,7 @@ __mach_msg_destroy(msg) saddr += sizeof(vm_offset_t); } } +#endif } } @@ -153,15 +226,32 @@ mach_msg_destroy_port(port, type) mach_msg_type_name_t type; { if (MACH_PORT_VALID(port)) switch (type) { - case MACH_MSG_TYPE_PORT_SEND: - case MACH_MSG_TYPE_PORT_SEND_ONCE: - (void) __mach_port_deallocate(__mach_task_self(), port); + case MACH_MSG_TYPE_MOVE_SEND: + case MACH_MSG_TYPE_MOVE_SEND_ONCE: + /* destroy the send/send-once right */ + (void) __mach_port_deallocate(mach_task_self(), port); break; - case MACH_MSG_TYPE_PORT_RECEIVE: - (void) __mach_port_mod_refs(__mach_task_self(), port, + case MACH_MSG_TYPE_MOVE_RECEIVE: + /* destroy the receive right */ + (void) __mach_port_mod_refs(mach_task_self(), port, MACH_PORT_RIGHT_RECEIVE, -1); break; + + case MACH_MSG_TYPE_MAKE_SEND: + /* create a send right and then destroy it */ + (void) __mach_port_insert_right(mach_task_self(), port, + port, MACH_MSG_TYPE_MAKE_SEND); + (void) __mach_port_deallocate(mach_task_self(), port); + break; + + case MACH_MSG_TYPE_MAKE_SEND_ONCE: + /* create a send-once right and then destroy it */ + (void) __mach_port_extract_right(mach_task_self(), port, + MACH_MSG_TYPE_MAKE_SEND_ONCE, + &port, &type); + (void) __mach_port_deallocate(mach_task_self(), port); + break; } } diff --git a/mach/msgserver.c b/mach/msgserver.c index d15f0c1cee..6471877a78 100644 --- a/mach/msgserver.c +++ b/mach/msgserver.c @@ -49,6 +49,12 @@ /* * HISTORY * $Log$ + * Revision 1.8 2002/02/17 07:13:32 roland + * 2002-02-16 Roland McGrath <roland@frob.com> + * + * * mach/msgserver.c [NDR_CHAR_ASCII] (mig_reply_header_t): #define as + * mig_reply_error_t for OSF Mach variant. + * * Revision 1.7 2001/07/06 04:55:34 aj * Update to LGPL v2.1. * @@ -93,6 +99,10 @@ #include <stdlib.h> /* For malloc and free. */ #include <assert.h> +#ifdef NDR_CHAR_ASCII /* OSF Mach flavors have different names. */ +# define mig_reply_header_t mig_reply_error_t +#endif + mach_msg_return_t __mach_msg_server_timeout (boolean_t (*demux) (mach_msg_header_t *request, mach_msg_header_t *reply), diff --git a/sysdeps/mach/configure.in b/sysdeps/mach/configure.in index 2a76ead8ed..058a2a05c8 100644 --- a/sysdeps/mach/configure.in +++ b/sysdeps/mach/configure.in @@ -1,6 +1,11 @@ sinclude(./aclocal.m4)dnl Autoconf lossage. GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. +### Sanity checks for Mach header installation +AC_CHECK_HEADER(mach/mach_types.h,, [AC_MSG_ERROR([cannot find Mach headers])]) +AC_CHECK_HEADER(mach/mach_types.defs,, [dnl +AC_MSG_ERROR([cannot find Mach .defs files])]) + dnl dnl mach_TYPE_CHECK(foo_t, bar_t) dnl @@ -21,6 +26,9 @@ dnl mach_TYPE_CHECK(task_t, task_port_t) mach_TYPE_CHECK(thread_t, thread_port_t) +dnl +dnl The creation_time field is a GNU Mach addition the other variants lack. +dnl AC_CACHE_CHECK(for creation_time in task_basic_info, libc_cv_mach_task_creation_time, [dnl AC_TRY_COMPILE([#include <mach/task_info.h>], [ @@ -30,3 +38,24 @@ long s = i->creation_time.seconds; if test $libc_cv_mach_task_creation_time = no; then DEFINES="$DEFINES -DNO_CREATION_TIME=1" fi + +dnl +dnl The Darwin variant no longer has <mach/mach.defs> +dnl but instead has several constituent .defs files. +dnl In this scenario we will presume there is a <mach/mach_interface.h> +dnl that contains an #include for each constituent header file, +dnl but we don't do a check for that here because in a bare +dnl environment the compile against those headers will fail. +dnl +mach_interface_list= +for ifc in mach mach4 \ + clock_priv host_priv host_security ledger lock_set \ + processor processor_set task thread_act vm_map \ + memory_object memory_object_default default_pager \ + ; do + AC_CHECK_HEADER(mach/${ifc}.defs, [dnl + mach_interface_list="$mach_interface_list $ifc"]) +done +if test "x$mach_interface_list" = x; then + AC_MSG_ERROR([what manner of Mach is this?]) +fi diff --git a/sysdeps/mach/powerpc/machine-lock.h b/sysdeps/mach/powerpc/machine-lock.h index 96e833ca15..cba6b0a6e2 100644 --- a/sysdeps/mach/powerpc/machine-lock.h +++ b/sysdeps/mach/powerpc/machine-lock.h @@ -1,5 +1,5 @@ /* Machine-specific definition for spin locks. PowerPC version. - Copyright (C) 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 1994,97,2002 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 @@ -40,9 +40,9 @@ __spin_unlock (__spin_lock_t *__lock) { long int __locked; __asm__ __volatile__ ("\ -0: lwarx %0,0,%1 - stwcx. %2,0,%1 - bne- 0b +0: lwarx %0,0,%1\n\ + stwcx. %2,0,%1\n\ + bne- 0b\n\ " : "=&r" (__locked) : "r" (__lock), "r" (0) : "cr0"); } @@ -53,9 +53,9 @@ __spin_try_lock (register __spin_lock_t *__lock) { long int __rtn; __asm__ __volatile__ ("\ -0: lwarx %0,0,%1 - stwcx. %2,0,%1 - bne- 0b +0: lwarx %0,0,%1\n\ + stwcx. %2,0,%1\n\ + bne- 0b\n\ " : "=&r" (__rtn) : "r" (__lock), "r" (1) : "cr0"); return !__rtn; } @@ -67,9 +67,9 @@ __spin_lock_locked (__spin_lock_t *__lock) { long int __rtn; __asm__ __volatile__ ("\ -0: lwarx %0,0,%1 - stwcx. %0,0,%1 - bne- 0b +0: lwarx %0,0,%1\n\ + stwcx. %0,0,%1\n\ + bne- 0b\n\ " : "=&r" (__rtn) : "r" (__lock) : "cr0"); return __rtn; } |