summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-06-21 04:35:29 +0000
committerUlrich Drepper <drepper@redhat.com>2000-06-21 04:35:29 +0000
commit697568d1b48a497024bca234483a157cee79c7a2 (patch)
tree890f34b715a2a1fdbeaa1307e676e49ea15d3632
parent1b97149de806a27fe8f52cd5841c252df168a5b8 (diff)
downloadglibc-697568d1b48a497024bca234483a157cee79c7a2.tar.gz
glibc-697568d1b48a497024bca234483a157cee79c7a2.tar.xz
glibc-697568d1b48a497024bca234483a157cee79c7a2.zip
Update.
2000-06-20  Jes Sorensen  <jes@linuxcare.com>

	* sysdeps/unix/sysv/linux/ia64/syscalls.list: New file.

2000-06-20  Jes Sorensen  <jes@linuxcare.com>

	* sysdeps/unix/sysv/linux/ia64/machine-gmon.h: New file.
	* sysdeps/unix/sysv/linux/ia64/profil-counter.h: New file.

2000-06-20  David Mosberger-Tang  <davidm@hpl.hp.com>

	* sysdeps/unix/sysv/linux/ia64/getpagesize.c: New file.

2000-06-20  Jes Sorensen  <jes@linuxcare.com>

	* sysdeps/unix/sysv/linux/ia64/sys/ucontext.h: Fix typo.
-rw-r--r--ChangeLog17
-rw-r--r--linuxthreads/ChangeLog13
-rw-r--r--linuxthreads/Examples/ex9.c94
-rw-r--r--linuxthreads/Makefile5
-rw-r--r--linuxthreads/Versions3
-rw-r--r--linuxthreads/barrier.c125
-rw-r--r--linuxthreads/sysdeps/pthread/bits/pthreadtypes.h14
-rw-r--r--linuxthreads/sysdeps/pthread/pthread.h30
-rw-r--r--linuxthreads/sysdeps/pthread/timer_create.c16
-rw-r--r--linuxthreads/sysdeps/pthread/timer_delete.c15
-rw-r--r--linuxthreads/sysdeps/unix/sysv/linux/bits/posix_opt.h3
-rw-r--r--linuxthreads/sysdeps/unix/sysv/linux/i386/bits/posix_opt.h3
-rw-r--r--sysdeps/unix/sysv/linux/ia64/getpagesize.c46
-rw-r--r--sysdeps/unix/sysv/linux/ia64/machine-gmon.h26
-rw-r--r--sysdeps/unix/sysv/linux/ia64/profil-counter.h27
-rw-r--r--sysdeps/unix/sysv/linux/ia64/sys/ucontext.h2
-rw-r--r--sysdeps/unix/sysv/linux/ia64/syscalls.list77
17 files changed, 497 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index 5f0a52514b..7c3faba27f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2000-06-20  Jes Sorensen  <jes@linuxcare.com>
+
+	* sysdeps/unix/sysv/linux/ia64/syscalls.list: New file.
+
+2000-06-20  Jes Sorensen  <jes@linuxcare.com>
+
+	* sysdeps/unix/sysv/linux/ia64/machine-gmon.h: New file.
+	* sysdeps/unix/sysv/linux/ia64/profil-counter.h: New file.
+
+2000-06-20  David Mosberger-Tang  <davidm@hpl.hp.com>
+
+	* sysdeps/unix/sysv/linux/ia64/getpagesize.c: New file.
+
+2000-06-20  Jes Sorensen  <jes@linuxcare.com>
+
+	* sysdeps/unix/sysv/linux/ia64/sys/ucontext.h: Fix typo.
+
 2000-06-20  Ulrich Drepper  <drepper@redhat.com>
 
 	* locale/programs/ld-collate.c (insert_value): Now take string and
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index b79ee3f43e..965ac05e31 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,16 @@
+2000-06-20  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/sysv/linux/bits/posix_opt.h: Define _POSIX_BARRIERS.
+	* sysdeps/unix/sysv/linux/i386/bits/posix_opt.h: Likewise.
+
+	* Makefile (libpthread-routines): Add barrier.
+	(tests): Add ex9.  Add rule to build ex9.
+	* Versions: Export barrier functions.
+	* barrier.c: New file.
+	* Examples/ex9.c: New file.
+	* sysdeps/pthread/pthread.h: Add barrier data types and declarations.
+	* sysdeps/pthread/bits/pthreadtypes.h: Likewise.
+
 2000-06-19  H.J. Lu  <hjl@gnu.org>
 
 	* spinlock.h (HAS_COMPARE_AND_SWAP): Defined if
diff --git a/linuxthreads/Examples/ex9.c b/linuxthreads/Examples/ex9.c
new file mode 100644
index 0000000000..0c08741003
--- /dev/null
+++ b/linuxthreads/Examples/ex9.c
@@ -0,0 +1,94 @@
+/* Tests for pthread_barrier_* functions.
+   Copyright (C) 2000 Free Software Foundation, Inc.
+   Contributed by Kaz Kylheku <kaz@ashi.footprints.net>, 2000.
+
+   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., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <errno.h>
+#include <error.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <pthread.h>
+
+#define NUM_THREADS 10
+#define NUM_ITERS   500
+
+static void *thread (void *);
+static pthread_barrier_t barrier;
+
+int
+main (void)
+{
+  pthread_t th;
+  int i;
+
+  if (pthread_barrier_init (&barrier, NULL, NUM_THREADS + 1) != 0)
+    error (EXIT_FAILURE, 0, "cannot initialize barrier");
+
+  for (i = 0; i < NUM_THREADS; i++)
+    {
+      if (pthread_create (&th, NULL, thread, NULL) != 0)
+	error (EXIT_FAILURE, 0, "cannot create thread");
+    }
+
+  (void) thread (NULL);
+  /* notreached */
+  return 0;
+}
+
+
+static void *
+thread (void *arg)
+{
+  int i;
+  pthread_t self = pthread_self ();
+  static pthread_t last_serial_thread;
+  static int linecount; /* protected by flockfile(stdout) */
+
+  for (i = 0; i < NUM_ITERS; i++)
+    {
+      switch (pthread_barrier_wait (&barrier))
+	{
+	case 0:
+	  flockfile (stdout);
+	  printf ("%04d: non-serial thread %lu\n", ++linecount, 
+		  (unsigned long) self);
+	  funlockfile (stdout);
+	  break;
+	case PTHREAD_BARRIER_SERIAL_THREAD:
+	  flockfile (stdout);
+	  printf ("%04d: serial thread %lu\n", ++linecount, 
+		  (unsigned long) self);
+	  funlockfile (stdout);
+	  last_serial_thread = self;
+	  break;
+	default:
+	  /* Huh? */
+	  error (EXIT_FAILURE, 0, "unexpected return value from barrier wait");
+	}
+    }
+
+  if (pthread_equal (self, last_serial_thread))
+  {
+    flockfile (stdout);
+    printf ("%04d: last serial thread %lu terminating process\n", 
+	    ++linecount, (unsigned long) self);
+    funlockfile (stdout);
+    exit (0);
+  }
+
+  pthread_exit(NULL);
+}
diff --git a/linuxthreads/Makefile b/linuxthreads/Makefile
index 6e9f8141bd..1b4ecc0012 100644
--- a/linuxthreads/Makefile
+++ b/linuxthreads/Makefile
@@ -35,10 +35,10 @@ extra-libs-others := $(extra-libs)
 libpthread-routines := attr cancel condvar join manager mutex ptfork \
 		       ptlongjmp pthread signals specific errno lockfile \
 		       semaphore spinlock wrapsyscall rwlock pt-machine \
-		       oldsemaphore events getcpuclockid pspinlock
+		       oldsemaphore events getcpuclockid pspinlock barrier
 
 vpath %.c Examples
-tests = ex1 ex2 ex3 ex4 ex5 ex6 ex7 ex8 joinrace
+tests = ex1 ex2 ex3 ex4 ex5 ex6 ex7 ex8 ex9 joinrace
 
 include ../Rules
 
@@ -68,4 +68,5 @@ $(objpfx)ex5: $(libpthread)
 $(objpfx)ex6: $(libpthread)
 $(objpfx)ex7: $(libpthread)
 $(objpfx)ex8: $(libpthread)
+$(objpfx)ex9: $(libpthread)
 $(objpfx)joinrace: $(libpthread)
diff --git a/linuxthreads/Versions b/linuxthreads/Versions
index 327e62ea0c..48f62ae0dd 100644
--- a/linuxthreads/Versions
+++ b/linuxthreads/Versions
@@ -135,6 +135,9 @@ libpthread {
     pthread_spin_destroy; pthread_spin_init; pthread_spin_lock;
     pthread_spin_trylock; pthread_spin_unlock;
     pthread_getcpuclockid;
+    pthread_barrier_destroy; pthread_barrier_init; pthread_barrier_wait;
+    pthread_barrierattr_destroy; pthread_barrierattr_init; 
+    pthread_barrierattr_getpshared; pthread_barrierattr_setpshared;
 
     # Extensions.
     pthread_yield;
diff --git a/linuxthreads/barrier.c b/linuxthreads/barrier.c
new file mode 100644
index 0000000000..1293bad858
--- /dev/null
+++ b/linuxthreads/barrier.c
@@ -0,0 +1,125 @@
+/* POSIX barrier implementation for LinuxThreads.
+   Copyright (C) 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Kaz Kylheku <kaz@ashi.footprints.net>, 2000.
+
+   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., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <errno.h>
+#include "pthread.h"
+#include "internals.h"
+#include "spinlock.h"
+#include "queue.h"
+#include "restart.h"
+
+int
+pthread_barrier_wait(pthread_barrier_t *barrier)
+{
+  pthread_descr self = thread_self();
+  pthread_descr temp_wake_queue, th;
+  int result = 0;
+
+  __pthread_lock(&barrier->__ba_lock, self);
+
+  /* If the required number of threads have achieved rendezvous... */
+  if (barrier->__ba_present >= barrier->__ba_required - 1)
+    {
+      /* ... then this last caller shall be the serial thread */
+      result = PTHREAD_BARRIER_SERIAL_THREAD;
+      /* Copy and clear wait queue and reset barrier. */
+      temp_wake_queue = barrier->__ba_waiting;
+      barrier->__ba_waiting = NULL;
+      barrier->__ba_present = 0;
+    }
+  else
+    {
+      result = 0;
+      barrier->__ba_present++;
+      enqueue(&barrier->__ba_waiting, self);
+    }
+
+  __pthread_unlock(&barrier->__ba_lock);
+
+  if (result == 0)
+    {
+      /* Non-serial threads have to suspend */
+      suspend(self);
+      /* We don't bother dealing with cancellation because the POSIX
+         spec for barriers doesn't mention that pthread_barrier_wait
+         is a cancellation point. */
+    }
+  else
+    {
+      /* Serial thread wakes up all others. */
+      while ((th = dequeue(&temp_wake_queue)) != NULL)
+	restart(th);
+    }
+
+  return result;
+}
+
+int
+pthread_barrier_init(pthread_barrier_t *barrier,
+				const pthread_barrierattr_t *attr,
+				unsigned int count)
+{
+  if (count == 0)
+     return EINVAL;
+
+  __pthread_init_lock(&barrier->__ba_lock);
+  barrier->__ba_required = count;
+  barrier->__ba_present = 0;
+  barrier->__ba_waiting = NULL;
+  return 0;
+}
+
+int
+pthread_barrier_destroy(pthread_barrier_t *barrier)
+{
+  if (barrier->__ba_waiting != NULL) return EBUSY;
+  return 0;
+}
+
+int
+pthread_barrierattr_init(pthread_barrierattr_t *attr)
+{
+  attr->__pshared = PTHREAD_PROCESS_PRIVATE;
+  return 0;
+}
+
+int
+pthread_barrierattr_destroy(pthread_barrierattr_t *attr)
+{
+  return 0;
+}
+
+int
+__pthread_barrierattr_getpshared(const pthread_barrierattr_t *attr,
+				 int *pshared)
+{
+  *pshared = attr->__pshared;
+  return 0;
+}
+
+int
+pthread_barrierattr_setpshared(pthread_barrierattr_t *attr, int pshared)
+{
+  if (pshared != PTHREAD_PROCESS_PRIVATE && pshared != PTHREAD_PROCESS_SHARED)
+    return EINVAL;
+
+  attr->__pshared = pshared;
+  return 0;
+}
diff --git a/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h b/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h
index 99e56d23ee..a53889f5f0 100644
--- a/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h
+++ b/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h
@@ -118,6 +118,20 @@ typedef struct
 #ifdef __USE_XOPEN2K
 /* POSIX spinlock data type.  */
 typedef volatile int pthread_spinlock_t;
+
+/* POSIX barrier. */
+typedef struct {
+  struct _pthread_fastlock __ba_lock; /* Lock to guarantee mutual exclusion */
+  int __ba_required;                  /* Threads needed for completion */
+  int __ba_present;                   /* Threads waiting */
+  _pthread_descr __ba_waiting;        /* Queue of waiting threads */
+} pthread_barrier_t;
+
+/* barrier attribute */
+typedef struct {
+  int __pshared;
+} pthread_barrierattr_t;
+
 #endif
 
 
diff --git a/linuxthreads/sysdeps/pthread/pthread.h b/linuxthreads/sysdeps/pthread/pthread.h
index e82c4deb99..da39e7a923 100644
--- a/linuxthreads/sysdeps/pthread/pthread.h
+++ b/linuxthreads/sysdeps/pthread/pthread.h
@@ -109,6 +109,13 @@ enum
 
 #define PTHREAD_ONCE_INIT 0
 
+/* Special constants */
+
+#ifdef __USE_XOPEN2K
+/* -1 is distinct from 0 and all errno constants */
+# define PTHREAD_BARRIER_SERIAL_THREAD -1
+#endif
+
 /* Cleanup buffers */
 
 struct _pthread_cleanup_buffer
@@ -414,7 +421,7 @@ extern int pthread_rwlockattr_setkind_np (pthread_rwlockattr_t *__attr,
 #endif
 
 #ifdef __USE_XOPEN2K
-/* The IEEE Std. 10003.1j-2000 introduces functions to implement
+/* The IEEE Std. 1003.1j-2000 introduces functions to implement
    spinlocks.  */
 
 /* Initialize the spinlock LOCK.  If PSHARED is nonzero the spinlock can
@@ -433,6 +440,27 @@ extern int pthread_spin_trylock (pthread_spinlock_t *__lock) __THROW;
 
 /* Release spinlock LOCK.  */
 extern int pthread_spin_unlock (pthread_spinlock_t *__lock) __THROW;
+
+
+/* Barriers are a also a new feature in 1003.1j-2000. */
+
+extern int pthread_barrier_init (pthread_barrier_t *__barrier,
+				 __const pthread_barrierattr_t *__attr,
+				 unsigned int __count) __THROW;
+
+extern int pthread_barrier_destroy (pthread_barrier_t *__barrier) __THROW;
+
+extern int pthread_barrierattr_init (pthread_barrierattr_t *__attr) __THROW;
+
+extern int pthread_barrierattr_destroy (pthread_barrierattr_t *__attr) __THROW;
+
+extern int pthread_barrierattr_getpshared (__const pthread_barrierattr_t *__attr,
+					   int *__pshared) __THROW;
+
+extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr,
+					   int __pshared) __THROW;
+
+extern int pthread_barrier_wait (pthread_barrier_t *__barrier) __THROW;
 #endif
 
 
diff --git a/linuxthreads/sysdeps/pthread/timer_create.c b/linuxthreads/sysdeps/pthread/timer_create.c
index cbefb91831..1dccd30361 100644
--- a/linuxthreads/sysdeps/pthread/timer_create.c
+++ b/linuxthreads/sysdeps/pthread/timer_create.c
@@ -46,7 +46,7 @@ timer_create (clock_id, evp, timerid)
 #endif
       )
     {
-      errno = EINVAL;
+      __set_errno (EINVAL);
       return -1;
     }
 
@@ -54,7 +54,7 @@ timer_create (clock_id, evp, timerid)
 
   if (__timer_init_failed)
     {
-      errno = ENOMEM;
+      __set_errno (ENOMEM);
       return -1;
     }
 
@@ -63,7 +63,7 @@ timer_create (clock_id, evp, timerid)
   newtimer = __timer_alloc ();
   if (__builtin_expect (newtimer == NULL, 0))
     {
-      errno = EAGAIN;
+      __set_errno (EAGAIN);
       goto unlock_bail;
     }
 
@@ -106,13 +106,13 @@ timer_create (clock_id, evp, timerid)
 	  break;
 #endif
 	}
-      
+
       if (! thread->exists)
 	{
 	  if (__builtin_expect (__timer_thread_start (thread),
 				1) < 0)
 	    {
-	      errno = EAGAIN;
+	      __set_errno (EAGAIN);
 	      goto unlock_bail;
             }
         }
@@ -138,7 +138,7 @@ timer_create (clock_id, evp, timerid)
       /* Out of luck; no threads are available.  */
       if (__builtin_expect (thread == NULL, 0))
 	{
-	  errno = EAGAIN;
+	  __set_errno (EAGAIN);
 	  goto unlock_bail;
 	}
 
@@ -146,13 +146,13 @@ timer_create (clock_id, evp, timerid)
       if (! thread->exists
 	  && __builtin_expect (! __timer_thread_start (thread), 0))
 	{
-	  errno = EAGAIN;
+	  __set_errno (EAGAIN);
 	  goto unlock_bail;
 	}
       break;
 
     default:
-      errno = EINVAL;
+      __set_errno (EINVAL);
       goto unlock_bail;
     }
 
diff --git a/linuxthreads/sysdeps/pthread/timer_delete.c b/linuxthreads/sysdeps/pthread/timer_delete.c
index 4636bf707a..b7d59fe68d 100644
--- a/linuxthreads/sysdeps/pthread/timer_delete.c
+++ b/linuxthreads/sysdeps/pthread/timer_delete.c
@@ -36,9 +36,9 @@ timer_delete (timerid)
   pthread_mutex_lock (&__timer_mutex);
 
   timer = timer_id2ptr (timerid);
-  if (timer == NULL || !timer->inuse)
+  if (! timer_valid (timer))
     /* Invalid timer ID or the timer is not in use.  */
-    errno = EINVAL;
+    __set_errno (EINVAL);
   else
     {
       if (timer->armed)
@@ -50,16 +50,17 @@ timer_delete (timerid)
 	     the mutex is unlocked and timer_delete is aborted.  */
 	  pthread_cleanup_push (__timer_mutex_cancel_handler, &__timer_mutex);
 
-	    /* If timer is currently being serviced, wait for it to finish.  */
-	    while (thread->current_timer == timer)
-	      pthread_cond_wait (&thread->cond, &__timer_mutex);
+	  /* If timer is currently being serviced, wait for it to finish.  */
+	  while (thread->current_timer == timer)
+	    pthread_cond_wait (&thread->cond, &__timer_mutex);
 
-	    pthread_cleanup_pop (0);
+	  pthread_cleanup_pop (0);
         }
 
       /* Remove timer from whatever queue it may be on and deallocate it.  */
+      timer->inuse = TIMER_DELETED;
       list_unlink_ip (&timer->links);
-      __timer_dealloc (timer);
+      timer_delref (timer);
       retval = 0;
     }
 
diff --git a/linuxthreads/sysdeps/unix/sysv/linux/bits/posix_opt.h b/linuxthreads/sysdeps/unix/sysv/linux/bits/posix_opt.h
index 1fde1010b0..a1b5f04b6a 100644
--- a/linuxthreads/sysdeps/unix/sysv/linux/bits/posix_opt.h
+++ b/linuxthreads/sysdeps/unix/sysv/linux/bits/posix_opt.h
@@ -131,4 +131,7 @@
 /* We have POSIX timers.  */
 #define _POSIX_TIMERS	1
 
+/* The barrier functions are available.  */
+#define _POSIX_BARRIERS	200912L
+
 #endif /* posix_opt.h */
diff --git a/linuxthreads/sysdeps/unix/sysv/linux/i386/bits/posix_opt.h b/linuxthreads/sysdeps/unix/sysv/linux/i386/bits/posix_opt.h
index d31206bc72..19acebb8c9 100644
--- a/linuxthreads/sysdeps/unix/sysv/linux/i386/bits/posix_opt.h
+++ b/linuxthreads/sysdeps/unix/sysv/linux/i386/bits/posix_opt.h
@@ -140,4 +140,7 @@
 /* We have POSIX timers.  */
 #define _POSIX_TIMERS	1
 
+/* The barrier functions are available.  */
+#define _POSIX_BARRIERS	200912L
+
 #endif /* posix_opt.h */
diff --git a/sysdeps/unix/sysv/linux/ia64/getpagesize.c b/sysdeps/unix/sysv/linux/ia64/getpagesize.c
new file mode 100644
index 0000000000..4a5c2ebe43
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/getpagesize.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 1999, 2000 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., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <unistd.h>
+#include <sys/param.h>
+
+#include <sysdep.h>
+#include <sys/syscall.h>
+
+/* Return the system page size.  The return value will depend on how
+   the kernel is configured.  A program must use this call to
+   determine the page size to ensure proper alignment for calls such
+   as mmap and friends.  --davidm 99/11/30 */
+
+/* If we are not a static program, this value is collected from the system
+   via the AT_PAGESZ auxiliary argument.  If we are a static program, we
+   use the getpagesize system call.  */
+
+extern size_t _dl_pagesize;
+
+extern size_t __syscall_getpagesize (void);
+
+int
+__getpagesize ()
+{
+  if (_dl_pagesize == 0)
+    _dl_pagesize = INLINE_SYSCALL (getpagesize, 0);
+  return _dl_pagesize;
+}
+
+weak_alias (__getpagesize, getpagesize)
diff --git a/sysdeps/unix/sysv/linux/ia64/machine-gmon.h b/sysdeps/unix/sysv/linux/ia64/machine-gmon.h
new file mode 100644
index 0000000000..96a1623951
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/machine-gmon.h
@@ -0,0 +1,26 @@
+/* Machine-specific calling sequence for `mcount' profiling function.  IA-64.
+   Copyright (C) 1995, 1996, 1997, 2000 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., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#define _MCOUNT_DECL(from, self) \
+ void __mcount (u_long from, u_long self)
+
+/* Call __mcount with our the return PC for our caller, and the return
+   PC our caller will return to.  Empty since we use an assembly stub
+   instead. */
+#define MCOUNT
diff --git a/sysdeps/unix/sysv/linux/ia64/profil-counter.h b/sysdeps/unix/sysv/linux/ia64/profil-counter.h
new file mode 100644
index 0000000000..1cc0390b8f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/profil-counter.h
@@ -0,0 +1,27 @@
+/* Machine-dependent SIGPROF signal handler.  IA-64 version.
+   Copyright (C) 1996, 1997, 2000 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., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* In many Unix systems signal handlers are called like this
+   and the interrupted PC is easily findable in the `struct sigcontext'.  */
+
+static void
+profil_counter (int signr, int code, struct sigcontext *scp)
+{
+  profil_count ((void *) scp->sc_ip);
+}
diff --git a/sysdeps/unix/sysv/linux/ia64/sys/ucontext.h b/sysdeps/unix/sysv/linux/ia64/sys/ucontext.h
index 37ee9774d1..c7adaca12b 100644
--- a/sysdeps/unix/sysv/linux/ia64/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/ia64/sys/ucontext.h
@@ -54,7 +54,7 @@ typedef struct
   unsigned long	int ss_flags;		/* Save state flags.  */
   unsigned long int br_1, br_2, br_3, br_4, br_5; /* Branch registers.  */
   unsigned long int p_regs;		/* Predicates.  */
-} mcountext_;
+} mcontext_t;
 
 
 typedef struct ucontext
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
new file mode 100644
index 0000000000..dab59dc6b6
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -0,0 +1,77 @@
+# File name	Caller	Syscall name	# args	Strong name	Weak names
+
+umount2		-	umount		2	__umount2	umount2
+
+# Whee! 64-bit systems naturally implement llseek.
+llseek		EXTRA	lseek		3	__llseek	llseek __lseek64 lseek64
+pread		-	pread		4	__syscall_pread	__syscall_pread64 __pread pread __pread64 pread64
+pwrite		-	pwrite		4	__syscall_pwrite	__syscall_pwrite64 __pwrite pwrite __pwrite64 pwrite64
+fstatfs		-	fstatfs		2	__fstatfs	fstatfs fstatfs64
+statfs		-	statfs		2	__statfs	statfs statfs64
+mmap		-	mmap		6	__mmap		mmap __mmap64 mmap64
+getpeername	-	getpeername	3	__getpeername	getpeername
+getpriority	-	getpriority	2	__getpriority	getpriority
+
+# semaphore and shm system calls
+msgctl		-	msgctl		3	__msgctl	msgctl
+msgget		-	msgget		2	__msgget	msgget
+msgrcv		-	msgrcv		5	__msgrcv	msgrcv
+msgsnd		-	msgsnd		4	__msgsnd	msgsnd
+shmat		-	shmat		3	__shmat		shmat
+shmctl		-	shmctl		3	__shmctl	shmctl
+shmdt		-	shmdt		1	__shmdt		shmdt
+shmget		-	shmget		3	__shmget	shmget
+semop		-	semop		3	__semop		semop
+semget		-	semget		3	__semget	semget
+semctl		-	semctl		4	__semctl	semctl
+
+# proper socket implementations:
+accept		-	accept		3	__libc_accept	__accept accept
+bind		-	bind		3	__bind		bind
+connect		-	connect		3	__libc_connect	__connect connect
+getpeername	-	getpeername	3	__getpeername	getpeername
+getsockname	-	getsockname	3	__getsockname	getsockname
+getsockopt	-	getsockopt	5	__getsockopt	getsockopt
+listen		-	listen		2	__listen	listen
+recv		-	recv		4	__libc_recv	__recv recv
+recvfrom	-	recvfrom	6	__libc_recvfrom	__recvfrom recvfrom
+recvmsg		-	recvmsg		3	__libc_recvmsg	recvmsg
+send		-	send		4	__libc_send	__send send
+sendmsg		-	sendmsg		3	__libc_sendmsg	sendmsg
+sendto		-	sendto		6	__libc_sendto	__sendto sendto
+setsockopt	-	setsockopt	5	__setsockopt	setsockopt
+socket		-	socket		3	__socket	socket
+socketpair	-	socketpair	4	__socketpair	socketpair
+
+# DIG-compliant access to PCI configuration space:
+pciconfig_read	EXTRA	pciconfig_read	5	pciconfig_read
+pciconfig_write	EXTRA	pciconfig_write	5	pciconfig_write
+
+ptrace		-	ptrace		4	__ptrace	ptrace
+shutdown	-	shutdown	2	__shutdown	shutdown
+sysctl		-	_sysctl		6	__sysctl	sysctl
+
+getresuid	-	getresuid	3	getresuid
+getresgid	-	getresgid	3	getresgid
+
+rt_sigaction	EXTRA	rt_sigaction	4	__syscall_rt_sigaction		rt_sigaction
+rt_sigpending	EXTRA	rt_sigpending	2	__syscall_rt_sigpending		rt_sigpending
+rt_sigprocmask	EXTRA	rt_sigprocmask	4	__syscall_rt_sigprocmask	rt_sigprocmask
+rt_sigqueueinfo	EXTRA	rt_sigqueueinfo	3	__syscall_rt_sigqueueinfo	rt_sigqueueinfo	
+rt_sigsuspend	EXTRA	rt_sigsuspend	2	__syscall_rt_sigsuspend		rt_sigsuspend
+rt_sigtimedwait	EXTRA	rt_sigtimedwait	4	__syscall_rt_sigtimedwait	rt_sigtimedwait
+
+# System calls with wrappers.
+s_execve	execve	execve		3	__syscall_execve
+s_getcwd	getcwd	getcwd		2	__syscall_getcwd	getcwd
+s_getdents	getdents getdents	3	__syscall_getdents	getdents
+sys_mknod	xmknod	mknod		3	__syscall_mknod
+sys_readv	readv	readv		3	__syscall_readv
+sys_writev	writev	writev		3	__syscall_writev
+s_getpagesize	getpagesize getpagesize	0	__syscall_getpagesize
+s_poll		poll	poll		3	__syscall_poll
+s_reboot	reboot	reboot		3	__syscall_reboot
+s_ustat		ustat	ustat		2	__syscall_ustat
+s_stat		xstat	stat		2	__syscall_stat
+s_lstat		lxstat	lstat		2	__syscall_lstat
+s_fstat		fxstat	fstat		2	__syscall_fstat