Index: libpager/chg-compl.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libpager/chg-compl.c,v
retrieving revision 1.6
diff -u -r1.6 chg-compl.c
--- libpager/chg-compl.c	5 Sep 1995 22:14:35 -0000	1.6
+++ libpager/chg-compl.c	7 Aug 2003 16:09:27 -0000
@@ -1,5 +1,5 @@
 /* Completion of memory_object_change_attributes
-   Copyright (C) 1994, 1995 Free Software Foundation
+   Copyright (C) 1994, 1995, 2003 Free Software Foundation
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -21,15 +21,23 @@
 /* The kernel calls this (as described in <mach/memory_object.defs>)
    when a memory_object_change_attributes call has completed.  Read this
    in combination with pager-attr.c.  */
+#ifdef OLD_MEMORY_OBJECT_ATTRIBUTE_INFO
+kern_return_t
+_pager_seqnos_memory_object_change_completed (mach_port_t obj,
+					      mach_port_seqno_t seq,
+					      mach_port_t cntl,
+					      memory_object_flavor_t flavor)
+#else
 kern_return_t
 _pager_seqnos_memory_object_change_completed (mach_port_t obj,
 				       mach_port_seqno_t seq,
 				       boolean_t maycache,
 				       memory_object_copy_strategy_t strat)
+#endif
 {
   struct pager *p;
   struct attribute_request *ar;
-  
+
   p = ports_lookup_port (0, obj, _pager_class);
   if (!p)
     {
@@ -41,7 +49,11 @@
   _pager_wait_for_seqno (p, seq);
 
   for (ar = p->attribute_requests; ar; ar = ar->next)
+#ifdef OLD_MEMORY_OBJECT_ATTRIBUTE_INFO
+    if (ar->object == cntl)
+#else
     if (ar->may_cache == maycache && ar->copy_strategy == strat)
+#endif
       {
 	if (ar->attrs_pending && !--ar->attrs_pending)
 	  condition_broadcast (&p->wakeup);
Index: libpager/demuxer.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libpager/demuxer.c,v
retrieving revision 1.13
diff -u -r1.13 demuxer.c
--- libpager/demuxer.c	13 May 2002 01:57:27 -0000	1.13
+++ libpager/demuxer.c	7 Aug 2003 16:09:27 -0000
@@ -1,5 +1,5 @@
 /* Demuxer for pager library
-   Copyright (C) 1994, 1995, 2002 Free Software Foundation
+   Copyright (C) 1994, 1995, 2002, 2003 Free Software Foundation
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -41,10 +41,19 @@
 	{
 	  /* Synchronize our bookkeeping of the port's seqno with
 	     the one consumed by this bogus message.  */
+#ifdef MACH_MSG_TRAILER_FORMAT_0
+	  mach_msg_format_0_trailer_t *trailer;
+	  mutex_lock (&p->interlock);
+	  trailer = (mach_msg_format_0_trailer_t *)
+	    ((vm_offset_t) inp + round_msg (inp->msgh_size));
+	  _pager_wait_for_seqno (p, trailer->msgh_seqno);
+	  _pager_release_seqno (p, trailer->msgh_seqno);
+#else
 	  mutex_lock (&p->interlock);
 	  _pager_wait_for_seqno (p, inp->msgh_seqno);
 	  _pager_release_seqno (p, inp->msgh_seqno);
 	  mutex_unlock (&p->interlock);
+#endif
 	  ports_port_deref (p);
 	}
     }
Index: libpager/lock-object.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libpager/lock-object.c,v
retrieving revision 1.16
diff -u -r1.16 lock-object.c
--- libpager/lock-object.c	25 Jul 2000 19:40:27 -0000	1.16
+++ libpager/lock-object.c	7 Aug 2003 16:09:27 -0000
@@ -1,5 +1,5 @@
 /* Synchronous wrapper for memory_object_lock_request
-   Copyright (C) 1993, 1994, 1996, 1997, 2000 Free Software Foundation
+   Copyright (C) 1993,94,96,97, 2000, 2003 Free Software Foundation
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -33,6 +33,13 @@
   int i;
   struct lock_request *lr = 0;
 
+#ifdef OSFMACH
+  /* Work around a bug in memory_object_lock_request in OSF Mach (it
+     sends a memory_object_lock_completed message with
+     round_page(SIZE) as the size).  */
+  size = round_page (size);
+#endif
+  
   mutex_lock (&p->interlock);
   if (p->pager_state != NORMAL)
     {
@@ -84,7 +91,7 @@
 
       if (should_flush)
 	{
-	  vm_offset_t pm_offs = offset / __vm_page_size;
+	  vm_offset_t pm_offs = offset / vm_page_size;
 
 	  _pager_pagemap_resize (p, offset + size);
 	  if (p->pagemapsize > pm_offs)
Index: libpager/object-init.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libpager/object-init.c,v
retrieving revision 1.15
diff -u -r1.15 object-init.c
--- libpager/object-init.c	21 Feb 1996 20:17:26 -0000	1.15
+++ libpager/object-init.c	7 Aug 2003 16:09:27 -0000
@@ -21,14 +21,25 @@
 
 /* Implement the object initialiation call as described in
    <mach/memory_object.defs>.  */
+#ifdef OSFMACH
+kern_return_t
+_pager_seqnos_memory_object_init (mach_port_t object,
+				  mach_port_seqno_t seqno,
+				  mach_port_t control,
+				  vm_size_t pagesize)
+#else
 kern_return_t
 _pager_seqnos_memory_object_init (mach_port_t object, 
 				  mach_port_seqno_t seqno,
 				  mach_port_t control,
 				  mach_port_t name,
 				  vm_size_t pagesize)
+#endif
 {
   struct pager *p;
+#ifdef OLD_MEMORY_OBJECT_ATTRIBUTE_INFO
+  old_memory_object_attr_info_data_t attr;
+#endif
 
   p = ports_lookup_port (0, object, _pager_class);
   if (!p)
@@ -64,9 +75,22 @@
     }
 
   p->memobjcntl = control;
+#ifndef OSFMACH
   p->memobjname = name;
+#endif
 
+#ifdef OLD_MEMORY_OBJECT_ATTRIBUTE_INFO
+  attr.object_ready = 1;
+  attr.may_cache = p->may_cache;
+  attr.copy_strategy = p->copy_strategy;
+  memory_object_change_attributes (control,
+				   OLD_MEMORY_OBJECT_ATTRIBUTE_INFO,
+				   (memory_object_info_t) &attr,
+				   OLD_MEMORY_OBJECT_ATTR_INFO_COUNT,
+				   MACH_PORT_NULL);
+#else
   memory_object_ready (control, p->may_cache, p->copy_strategy);
+#endif
 
   p->pager_state = NORMAL;
 
Index: libpager/object-terminate.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libpager/object-terminate.c,v
retrieving revision 1.19
diff -u -r1.19 object-terminate.c
--- libpager/object-terminate.c	25 Jul 2000 19:40:27 -0000	1.19
+++ libpager/object-terminate.c	7 Aug 2003 16:09:27 -0000
@@ -21,11 +21,18 @@
 
 /* Implement the object termination call from the kernel as described
    in <mach/memory_object.defs>. */
+#ifdef OSFMACH
+kern_return_t
+_pager_seqnos_memory_object_terminate (mach_port_t object,
+				       mach_port_seqno_t seqno,
+				       mach_port_t control)
+#else
 kern_return_t
 _pager_seqnos_memory_object_terminate (mach_port_t object, 
 				       mach_port_seqno_t seqno,
 				       mach_port_t control,
 				       mach_port_t name)
+#endif
 {
   struct pager *p;
   
@@ -41,11 +48,13 @@
       printf ("incg terminate: wrong control port");
       goto out;
     }
+#ifndef OSFMACH
   if (name != p->memobjname)
     {
       printf ("incg terminate: wrong name port");
       goto out;
     }
+#endif
 
   while (p->noterm)
     {
@@ -56,7 +65,9 @@
   /* Destry the ports we received; mark that in P so that it doesn't bother
      doing it again. */
   mach_port_destroy (mach_task_self (), control);
+#ifndef OSFMACH
   mach_port_destroy (mach_task_self (), name);
+#endif
   p->memobjcntl = p->memobjname = MACH_PORT_NULL;
 
   _pager_free_structure (p);
@@ -65,12 +76,26 @@
   if (p->init_head)
     {
       struct pending_init *i = p->init_head;
+#ifdef OLD_MEMORY_OBJECT_ATTRIBUTE_INFO
+      old_memory_object_attr_info_data_t attr;
+#endif
       p->init_head = i->next;
       if (!i->next)
 	p->init_tail = 0;
       p->memobjcntl = i->control;
       p->memobjname = i->name;
+#ifdef OLD_MEMORY_OBJECT_ATTRIBUTE_INFO
+      attr.object_ready = 1;
+      attr.may_cache = p->may_cache;
+      attr.copy_strategy = p->copy_strategy;
+      memory_object_change_attributes (i->control,
+				       OLD_MEMORY_OBJECT_ATTRIBUTE_INFO,
+				       (memory_object_info_t) &attr,
+				       OLD_MEMORY_OBJECT_ATTR_INFO_COUNT,
+				       MACH_PORT_NULL);
+#else
       memory_object_ready (i->control, p->may_cache, p->copy_strategy);
+#endif
       p->pager_state = NORMAL;
       free (i);
     }
@@ -115,11 +140,13 @@
       mach_port_deallocate (mach_task_self (), p->memobjcntl);
       p->memobjcntl = MACH_PORT_NULL;
     }
+#ifndef OSFMACH
   if (p->memobjname != MACH_PORT_NULL)
     {
       mach_port_deallocate (mach_task_self (), p->memobjname);
       p->memobjname = MACH_PORT_NULL;
     }
+#endif
 
   /* Free the pagemap */
   if (p->pagemapsize)
Index: libpager/pager-attr.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libpager/pager-attr.c,v
retrieving revision 1.4
diff -u -r1.4 pager-attr.c
--- libpager/pager-attr.c	6 Mar 1996 23:10:30 -0000	1.4
+++ libpager/pager-attr.c	7 Aug 2003 16:09:27 -0000
@@ -16,7 +16,6 @@
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 #include "priv.h"
-#include <assert.h>
 
 /* Change the attributes of the memory object underlying pager P.
    Args MAY_CACHE and COPY_STRATEGY are as for 
@@ -55,8 +54,12 @@
   if (wait)
     {
       for (ar = p->attribute_requests; ar; ar = ar->next)
+#ifdef OLD_MEMORY_OBJECT_ATTRIBUTE_INFO
+	if (ar->object == p->memobjcntl)
+#else
 	if (ar->may_cache == may_cache 
 	    && ar->copy_strategy == copy_strategy)
+#endif
 	  {
 	    ar->attrs_pending++;
 	    ar->threads_waiting++;
@@ -65,8 +68,12 @@
       if (!ar)
 	{
 	  ar = malloc (sizeof (struct attribute_request));
+#ifdef OLD_MEMORY_OBJECT_ATTRIBUTE_INFO
+	  ar->object = p->memobjcntl;
+#else
 	  ar->may_cache = may_cache;
 	  ar->copy_strategy = copy_strategy;
+#endif
 	  ar->attrs_pending = 1;
 	  ar->threads_waiting = 1;
 	  ar->next = p->attribute_requests;
@@ -77,8 +84,22 @@
 	}
     }      
 
+#ifdef OLD_MEMORY_OBJECT_ATTRIBUTE_INFO
+  {
+    struct old_memory_object_attr_info info = {
+      may_cache: may_cache,
+      copy_strategy: copy_strategy
+    };
+    memory_object_change_attributes (p->memobjcntl,
+				     OLD_MEMORY_OBJECT_ATTRIBUTE_INFO,
+				     &info,
+				     OLD_MEMORY_OBJECT_ATTR_INFO_COUNT,
+				     wait ? p->port.port_right : MACH_PORT_NULL);
+  }
+#else
   memory_object_change_attributes (p->memobjcntl, may_cache, copy_strategy,
 				   wait ? p->port.port_right : MACH_PORT_NULL);
+#endif
   
   if (wait)
     {
Index: libpager/priv.h
===================================================================
RCS file: /cvsroot/hurd/hurd/libpager/priv.h,v
retrieving revision 1.23
diff -u -r1.23 priv.h
--- libpager/priv.h	25 Jul 2000 19:40:27 -0000	1.23
+++ libpager/priv.h	7 Aug 2003 16:09:28 -0000
@@ -81,8 +81,12 @@
 struct attribute_request
 {
   struct attribute_request *next, **prevp;
+#ifdef OLD_MEMORY_OBJECT_ATTRIBUTE_INFO
+  mach_port_t object;
+#else
   boolean_t may_cache;
   memory_object_copy_strategy_t copy_strategy;
+#endif
   int threads_waiting;
   int attrs_pending;
 };
Index: libpager/stubs.c
===================================================================
RCS file: /cvsroot/hurd/hurd/libpager/stubs.c,v
retrieving revision 1.7
diff -u -r1.7 stubs.c
--- libpager/stubs.c	22 Jul 1994 15:55:06 -0000	1.7
+++ libpager/stubs.c	7 Aug 2003 16:09:28 -0000
@@ -44,6 +44,19 @@
   return EOPNOTSUPP;
 }
 
+#ifdef OSFMACH
+kern_return_t
+_pager_seqnos_memory_object_discard_request (mach_port_t obj,
+					     mach_port_seqno_t seq,
+					     mach_port_t ctl,
+					     vm_offset_t off,
+					     vm_size_t len)
+{
+  printf ("m_o_discard_request called\n");
+  return EOPNOTSUPP;
+}
+#endif
+
 kern_return_t
 _pager_seqnos_memory_object_supply_completed (mach_port_t obj,
 				       mach_port_seqno_t seq,
@@ -57,3 +70,16 @@
   return EOPNOTSUPP;
 }
 
+#ifdef OSFMACH
+kern_return_t
+_pager_seqnos_memory_object_synchronize (mach_port_t obj,
+					 mach_port_seqno_t seq,
+					 mach_port_t ctl,
+					 vm_offset_t off,
+					 vm_offset_t len,
+					 vm_sync_t flags)
+{
+  printf ("m_o_synchronize called\n");
+  return EOPNOTSUPP;
+}
+#endif

