]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
* sysdeps/mach/configure.in: Check for <mach/machine/ndr_def.h>
authorRoland McGrath <roland@gnu.org>
Mon, 18 Feb 2002 20:57:51 +0000 (20:57 +0000)
committerRoland McGrath <roland@gnu.org>
Mon, 18 Feb 2002 20:57:51 +0000 (20:57 +0000)
or <machine/ndr_def.h> and add -DNDR_DEF_HEADER=... to DEFINES.
* sysdeps/mach/configure: Regenerated.
* mach/mach_init.c [NDR_DEF_HEADER]: #include it.

* hurd/hurdfault.c (_hurdsig_fault_init): Add a cast.

* hurd/hurd/signal.h: Include <setjmp.h> for `jmp_buf' decl.

* mach/msgserver.c (__mach_msg_server_timeout) [! MACH_RCV_LARGE]:
Double MAX_SIZE and don't retry on MACH_RCV_TOO_LARGE.

* sysdeps/mach/hurd/times.c
[NO_CREATION_TIME] (startup_time): New static variable.
[NO_CREATION_TIME] (times_init): New static function in __libc_subinit.
(__times) [NO_CREATION_TIME]: Use startup_time in lieu of task
creation_time from task_basic_info.
(__times): Use __gettimeofday instead of __host_get_time.

* hurd/intr-msg.c (_hurd_intr_rpc_mach_msg) [! MACH_MSG_TYPE_BIT]:
Use untyped Mach IPC message format.

* hurd/catch-exc.c: Include <assert.h>, missing from last change.

ChangeLog
hurd/catch-exc.c
hurd/hurd/signal.h
hurd/hurdfault.c
hurd/intr-msg.c
mach/mach_init.c
mach/msgserver.c
sysdeps/mach/configure
sysdeps/mach/configure.in
sysdeps/mach/hurd/times.c

index 513702ff2fa55bbe9596ec83680ee162dce072d1..eba6c7cec67d41a2ae06cb083fa7dbe95afe02a3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,31 @@
+2002-02-18  Roland McGrath  <roland@frob.com>
+
+       * sysdeps/mach/configure.in: Check for <mach/machine/ndr_def.h>
+       or <machine/ndr_def.h> and add -DNDR_DEF_HEADER=... to DEFINES.
+       * sysdeps/mach/configure: Regenerated.
+       * mach/mach_init.c [NDR_DEF_HEADER]: #include it.
+
+       * hurd/hurdfault.c (_hurdsig_fault_init): Add a cast.
+
+       * hurd/hurd/signal.h: Include <setjmp.h> for `jmp_buf' decl.
+
+       * mach/msgserver.c (__mach_msg_server_timeout) [! MACH_RCV_LARGE]:
+       Double MAX_SIZE and don't retry on MACH_RCV_TOO_LARGE.
+
 2002-02-17  Roland McGrath  <roland@frob.com>
 
+       * sysdeps/mach/hurd/times.c
+       [NO_CREATION_TIME] (startup_time): New static variable.
+       [NO_CREATION_TIME] (times_init): New static function in __libc_subinit.
+       (__times) [NO_CREATION_TIME]: Use startup_time in lieu of task
+       creation_time from task_basic_info.
+       (__times): Use __gettimeofday instead of __host_get_time.
+
+       * hurd/intr-msg.c (_hurd_intr_rpc_mach_msg) [! MACH_MSG_TYPE_BIT]:
+       Use untyped Mach IPC message format.
+
+       * hurd/catch-exc.c: Include <assert.h>, missing from last change.
+
        * hurd/Versions (libc: GLIBC_2.0): Add _S_catch_exception_raise_state,
        _S_catch_exception_raise_state_identity,
        _hurdsig_fault_catch_exception_raise_state,
index 6c58793a98d090e0f0896c988e7499512e02c03c..33366e0d1a92b1eec099e4a1b80291242698de19 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <mach/exc_server.h>
 #include <hurd/signal.h>
+#include <assert.h>
 
 /* Called by the microkernel when a thread gets an exception.  */
 
index c955ae3ab5bd7c8767121b075c074aae7fed888f..238a73f19c09236b4a6f457abf32dc6bfa1e465c 100644 (file)
@@ -1,5 +1,5 @@
 /* Implementing POSIX.1 signals under the Hurd.
-   Copyright (C) 1993, 94, 95, 96, 98, 99 Free Software Foundation, Inc.
+   Copyright (C) 1993,94,95,96,98,99,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
@@ -38,6 +38,7 @@
 #include <hurd/msg.h>
 
 #include <cthreads.h>          /* For `struct mutex'.  */
+#include <setjmp.h>            /* For `jmp_buf'.  */
 #include <spin-lock.h>
 #include <hurd/threadvar.h>    /* We cache sigstate in a threadvar.  */
 struct hurd_signal_preemptor;  /* <hurd/sigpreempt.h> */
@@ -204,7 +205,7 @@ _hurd_critical_section_unlock (void *our_lock)
       __spin_unlock (&ss->critical_section_lock);
       pending = ss->pending & ~ss->blocked;
       __spin_unlock (&ss->lock);
-      if (pending)
+      if (! __sigisemptyset (&pending))
        /* There are unblocked signals pending, which weren't
           delivered because we were in the critical section.
           Tell the signal thread to deliver them now.  */
index ceb2f8c679eadbb41f10486d139a8e8295d3a7ec..6313f16e2e06344b0ee01a3423a1689fb8efb6f6 100644 (file)
@@ -193,7 +193,8 @@ _hurdsig_fault_init (void)
     assert (MACH_PORT_RECEIVE_STATUS_COUNT == sizeof lim / sizeof (natural_t));
     err = __mach_port_set_attributes (__mach_task_self (), forward_sigexc,
                                      MACH_PORT_RECEIVE_STATUS,
-                                     &lim, MACH_PORT_RECEIVE_STATUS_COUNT);
+                                     (mach_port_info_t) &lim,
+                                     MACH_PORT_RECEIVE_STATUS_COUNT);
   }
 #else
   err = __mach_port_set_qlimit (__mach_task_self (), forward_sigexc, 1);
index ae997b2bb23e7eb132c485ce150c780bcf2eae40..e75fca81fb66a27c9d95a2963794eaf550431d66 100644 (file)
@@ -1,5 +1,5 @@
 /* Replacement for mach_msg used in interruptible Hurd RPCs.
-   Copyright (C) 95,96,97,98,99,2000,01 Free Software Foundation, Inc.
+   Copyright (C) 1995,96,97,98,99,2000,01,02 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
@@ -25,6 +25,9 @@
 
 #include "intr-msg.h"
 
+#ifdef NDR_CHAR_ASCII          /* OSF Mach flavors have different names.  */
+# define mig_reply_header_t    mig_reply_error_t
+#endif
 
 error_t
 _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
@@ -40,7 +43,15 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
   const mach_msg_option_t user_option = option;
   const mach_msg_timeout_t user_timeout = timeout;
 
-  struct clobber { int i[2]; };
+  struct clobber
+  {
+#ifdef NDR_CHAR_ASCII
+    NDR_record_t ndr;
+#else
+    mach_msg_type_t type;
+#endif
+    error_t err;
+  };
   union msg
   {
     mach_msg_header_t header;
@@ -48,7 +59,11 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
     struct
     {
       mach_msg_header_t header;
+#ifdef NDR_CHAR_ASCII
+      NDR_record_t ndr;
+#else
       int type;
+#endif
       int code;
     } check;
     struct
@@ -147,8 +162,12 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
         the message buffer and we might need to clean up the port rights.  */
     case MACH_SEND_TIMED_OUT:
     case MACH_SEND_INVALID_NOTIFY:
+#ifdef MACH_SEND_NO_NOTIFY
     case MACH_SEND_NO_NOTIFY:
+#endif
+#ifdef MACH_SEND_NOTIFY_IN_PROGRESS
     case MACH_SEND_NOTIFY_IN_PROGRESS:
+#endif
       if (MACH_MSGH_BITS_REMOTE (msg->msgh_bits) == MACH_MSG_TYPE_MOVE_SEND)
        {
          __mach_port_deallocate (__mach_task_self (), msg->msgh_remote_port);
@@ -159,6 +178,7 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
        }
       if (msg->msgh_bits & MACH_MSGH_BITS_COMPLEX)
        {
+#ifndef MACH_MSG_PORT_DESCRIPTOR
          /* Check for MOVE_SEND rights in the message.  These hold refs
             that we need to release in case the message is in fact never
             re-sent later.  Since it might in fact be re-sent, we turn
@@ -228,6 +248,62 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
                  ++(void **) ty;
                }
            }
+#else  /* Untyped Mach IPC flavor. */
+         mach_msg_body_t *body = (void *) (msg + 1);
+         mach_msg_descriptor_t *desc = (void *) (body + 1);
+         mach_msg_descriptor_t *desc_end = desc + body->msgh_descriptor_count;
+         for (; desc < desc_end; ++desc)
+           switch (desc->type.type)
+             {
+             case MACH_MSG_PORT_DESCRIPTOR:
+               switch (desc->port.disposition)
+                 {
+                 case MACH_MSG_TYPE_MOVE_SEND:
+                   __mach_port_deallocate (mach_task_self (),
+                                           desc->port.name);
+                   desc->port.disposition = MACH_MSG_TYPE_COPY_SEND;
+                   break;
+                 case MACH_MSG_TYPE_COPY_SEND:
+                 case MACH_MSG_TYPE_MOVE_RECEIVE:
+                   break;
+                 default:
+                   assert (! "unexpected port type in interruptible RPC");
+                 }
+               break;
+             case MACH_MSG_OOL_DESCRIPTOR:
+               if (desc->out_of_line.deallocate)
+                 __vm_deallocate (__mach_task_self (),
+                                  (vm_address_t) desc->out_of_line.address,
+                                  desc->out_of_line.size);
+               break;
+             case MACH_MSG_OOL_PORTS_DESCRIPTOR:
+               switch (desc->ool_ports.disposition)
+                 {
+                 case MACH_MSG_TYPE_MOVE_SEND:
+                   {
+                     mach_msg_size_t i;
+                     const mach_port_t *ports = desc->ool_ports.address;
+                     for (i = 0; i < desc->ool_ports.count; ++i)
+                       __mach_port_deallocate (__mach_task_self (), ports[i]);
+                     desc->ool_ports.disposition = MACH_MSG_TYPE_COPY_SEND;
+                     break;
+                   }
+                 case MACH_MSG_TYPE_COPY_SEND:
+                 case MACH_MSG_TYPE_MOVE_RECEIVE:
+                   break;
+                 default:
+                   assert (! "unexpected port type in interruptible RPC");
+                 }
+               if (desc->ool_ports.deallocate)
+                 __vm_deallocate (__mach_task_self (),
+                                  (vm_address_t) desc->ool_ports.address,
+                                  desc->ool_ports.count
+                                  * sizeof (mach_port_t));
+               break;
+             default:
+               assert (! "unexpected descriptor type in interruptible RPC");
+             }
+#endif
        }
       break;
 
@@ -285,6 +361,7 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
     case MACH_MSG_SUCCESS:
       {
        /* We got a reply.  Was it EINTR?  */
+#ifdef MACH_MSG_TYPE_BIT
        const union
        {
          mach_msg_type_t t;
@@ -292,10 +369,13 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
        } check =
          { t: { MACH_MSG_TYPE_INTEGER_T, sizeof (integer_t) * 8,
                 1, TRUE, FALSE, FALSE, 0 } };
+#endif
 
         if (m->reply.RetCode == EINTR &&
            m->header.msgh_size == sizeof m->reply &&
+#ifdef MACH_MSG_TYPE_BIT
            m->check.type == check.i &&
+#endif
            !(m->header.msgh_bits & MACH_MSGH_BITS_COMPLEX))
          {
            /* It is indeed EINTR.  Is the interrupt for us?  */
index 0dd33e44d9c68ebadbf24af350249ee9aaf981b4..552d2685ffe89de364b27ea7d4b397fdec0be392 100644 (file)
@@ -24,6 +24,11 @@ mach_port_t __mach_task_self_;
 vm_size_t __vm_page_size = 0;  /* Must be data not bss for weak alias.  */
 weak_alias (__vm_page_size, vm_page_size)
 
+#ifdef NDR_DEF_HEADER
+/* This defines NDR_record, which the MiG-generated stubs use. XXX namespace */
+# include NDR_DEF_HEADER
+#endif
+
 void
 __mach_init (void)
 {
index 6471877a78fe1c6f7fdc8944fc415e4986ae193d..82dc3d0c8fda9929dd72805b39945a2f7a3f566e 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1994, 1995, 1996, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1993,94,95,96,2001,02 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
 /*
  * HISTORY
  * $Log$
+ * Revision 1.9  2002/02/18 20:56:35  roland
+ * 2002-02-18  Roland McGrath  <roland@frob.com>
+ *
+ *     * mach/msgserver.c (__mach_msg_server_timeout) [! MACH_RCV_LARGE]:
+ *     Double MAX_SIZE and don't retry on MACH_RCV_TOO_LARGE.
+ *
  * Revision 1.8  2002/02/17 07:13:32  roland
  * 2002-02-16  Roland McGrath  <roland@frob.com>
  *
@@ -116,8 +122,12 @@ __mach_msg_server_timeout (boolean_t (*demux) (mach_msg_header_t *request,
 
   if (max_size == 0)
     {
+#ifdef MACH_RCV_LARGE
       option |= MACH_RCV_LARGE;
       max_size = 2 * __vm_page_size; /* Generic.  Good? XXX */
+#else
+      max_size = 4 * __vm_page_size; /* XXX */
+#endif
     }
 
   request = __alloca (max_size);
@@ -187,6 +197,7 @@ __mach_msg_server_timeout (boolean_t (*demux) (mach_msg_header_t *request,
       switch (mr)
        {
        case MACH_RCV_TOO_LARGE:
+#ifdef MACH_RCV_LARGE
          /* The request message is larger than MAX_SIZE, and has not
             been dequeued.  The message header has the actual size of
             the message.  We recurse here in hopes that the compiler
@@ -194,6 +205,10 @@ __mach_msg_server_timeout (boolean_t (*demux) (mach_msg_header_t *request,
             space instead of way too much.  */
          return __mach_msg_server_timeout (demux, request->Head.msgh_size,
                                            rcv_name, option, timeout);
+#else
+         /* XXX the kernel has destroyed the msg */
+         break;
+#endif
 
        case MACH_SEND_INVALID_DEST:
          /* The reply can't be delivered, so destroy it.  This error
index 7a2696023740c50aa5c2f8aa3f620c284018af20..250a2929e56313538052e481c7919951bcfdcf3d 100644 (file)
@@ -236,3 +236,70 @@ if test $libc_cv_mach_host_page_size = yes; then
 EOF
 
 fi
+
+ac_safe=`echo "mach/machine/ndr_def.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for mach/machine/ndr_def.h""... $ac_c" 1>&6
+echo "configure:243: checking for mach/machine/ndr_def.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 248 "configure"
+#include "confdefs.h"
+#include <mach/machine/ndr_def.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:253: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    DEFINES="$DEFINES -DNDR_DEF_HEADER='<mach/machine/ndr_def.h>'"
+else
+  echo "$ac_t""no" 1>&6
+ac_safe=`echo "machine/ndr_def.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for machine/ndr_def.h""... $ac_c" 1>&6
+echo "configure:274: checking for machine/ndr_def.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 279 "configure"
+#include "confdefs.h"
+#include <machine/ndr_def.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:284: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    DEFINES="$DEFINES -DNDR_DEF_HEADER='<machine/ndr_def.h>'"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
index 05dc45b61dde74a0b41e3392faacc88b942a7bbf..fc74e9cb7b4d7b0fff4b9a1055ce6d840647175d 100644 (file)
@@ -68,3 +68,8 @@ AC_EGREP_HEADER(host_page_size, mach/mach_host.defs,
 if test $libc_cv_mach_host_page_size = yes; then
   AC_DEFINE([HAVE_HOST_PAGE_SIZE])
 fi
+
+AC_CHECK_HEADER(mach/machine/ndr_def.h, [dnl
+  DEFINES="$DEFINES -DNDR_DEF_HEADER='<mach/machine/ndr_def.h>'"], [dnl
+AC_CHECK_HEADER(machine/ndr_def.h, [dnl
+  DEFINES="$DEFINES -DNDR_DEF_HEADER='<machine/ndr_def.h>'"])])
index e23275709015faafaa6e8da2e16added4f61d8b1..2065aac49aa87821a0a6e66f900b7a4d5d14c3c3 100644 (file)
@@ -33,6 +33,17 @@ clock_from_time_value (const time_value_t *t)
   return t->seconds * 1000000 + t->microseconds;
 }
 
+#if NO_CREATION_TIME
+static time_value_t startup_time;
+static void times_init (void) __attribute__ ((unused));
+static void
+times_init (void)
+{
+  __gettimeofday ((struct timeval *) &startup_time, NULL);
+}
+text_set_element (__libc_subinit, times_init);
+#endif
+
 /* Store the CPU time used by this process and all its
    dead children (and their dead children) in BUFFER.
    Return the elapsed real time, or (clock_t) -1 for errors.
@@ -66,15 +77,15 @@ __times (struct tms *tms)
   /* XXX This can't be implemented until getrusage(RUSAGE_CHILDREN) can be.  */
   tms->tms_cutime = tms->tms_cstime = 0;
 
-  err = __host_get_time (__mach_host_self (), &now);
-  if (err)
-    return __hurd_fail (err);
+  if (__gettimeofday ((struct timeval *) &now, NULL) < 0)
+    return -1;
 
 #if NO_CREATION_TIME
-  return 0;                    /* XXX */
+# define our_creation_time     startup_time
 #else
-  return (clock_from_time_value (&now)
-         - clock_from_time_value (&bi.creation_time));
+# define our_creation_time     bi.startup_time
 #endif
+  return (clock_from_time_value (&now)
+         - clock_from_time_value (&our_creation_time));
 }
 weak_alias (__times, times)