about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--abilist/librt.abilist7
-rw-r--r--nptl/ChangeLog5
-rw-r--r--nptl/sysdeps/unix/sysv/linux/timer_create.c68
4 files changed, 56 insertions, 28 deletions
diff --git a/ChangeLog b/ChangeLog
index 64c3dfc794..c2a56cbd49 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2003-03-26  Ulrich Drepper  <drepper@redhat.com>
+
+	* abilist/librt.abilist: Add new timer interfaces for 64-bit archs.
+
 2003-03-25  Jiro SEKIBA  <jir@yamato.ibm.com>
 
 	* iconvdata/euc-tw.c (from_euc_tw): Fix return value of TO_LOOP.
diff --git a/abilist/librt.abilist b/abilist/librt.abilist
index 15e212c26e..c457073cb9 100644
--- a/abilist/librt.abilist
+++ b/abilist/librt.abilist
@@ -37,3 +37,10 @@ GLIBC_2.2.5 x86_64-.*-linux.*
  timer_settime F
 GLIBC_2.2 i.86-.*-linux.* ia64-.*-linux.* powerpc-.*-linux.* s390-.*-linux.* sh[34].*-.*-linux.*
  GLIBC_2.2 A
+GLIBC_2.3.3 ia64-.*-linux.* powerpc64-.*-linux.* s390x-.*-linux.* x86_64-.*-linux.*
+ GLIBC_2.3.3 A
+ timer_create F
+ timer_delete F
+ timer_getoverrun F
+ timer_gettime F
+ timer_settime F
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index e912bcaeac..0fd99d580b 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,8 @@
+2003-03-26  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/sysv/linux/timer_create.c (timer_create): If EVP ==
+	NULL provide default definition to syscall.
+
 2003-03-25  Roland McGrath  <roland@redhat.com>
 
 	* sysdeps/pthread/posix-timer.h (TIMER_MAX): Define if not defined.
diff --git a/nptl/sysdeps/unix/sysv/linux/timer_create.c b/nptl/sysdeps/unix/sysv/linux/timer_create.c
index 637d925168..9e6b53ef37 100644
--- a/nptl/sysdeps/unix/sysv/linux/timer_create.c
+++ b/nptl/sysdeps/unix/sysv/linux/timer_create.c
@@ -60,6 +60,30 @@ timer_create (clock_id, evp, timerid)
       if (evp == NULL
 	  || __builtin_expect (evp->sigev_notify != SIGEV_THREAD, 1))
 	{
+	  struct sigevent local_evp;
+
+	  /* We avoid allocating too much memory by basically
+	     using struct timer as a derived class with the
+	     first two elements being in the superclass.  We only
+	     need these two elements here.  */
+	  struct timer *newp = (struct timer *) malloc (offsetof (struct timer,
+								  thrfunc));
+	  if (newp == NULL)
+	    /* No more memory.  */
+	    return -1;
+
+	  if (evp == NULL)
+	    {
+	      /* The kernel has to pass up the timer ID which is a
+		 userlevel object.  Therefore we cannot leave it up to
+		 the kernel to determine it.  */
+	      local_evp.sigev_notify = SIGEV_SIGNAL;
+	      local_evp.sigev_signo = SIGALRM;
+	      local_evp.sigev_value.sival_ptr = newp;
+
+	      evp = &local_evp;
+	    }
+
 	  kernel_timer_t ktimerid;
 	  int retval = INLINE_SYSCALL (timer_create, 3, clock_id, evp,
 				       &ktimerid);
@@ -70,43 +94,31 @@ timer_create (clock_id, evp, timerid)
 	    {
 # ifndef __ASSUME_POSIX_TIMERS
 	      __no_posix_timers = 1;
-#endif
+# endif
 
 	      if (retval != -1)
 		{
-		  struct timer *newp;
-
-		  /* We avoid allocating too much memory by basically
-		     using struct timer as a derived class with the
-		     first two elements being in the superclass.  We only
-		     need these two elements here.  */
-		  newp = (struct timer *) malloc (offsetof (struct timer,
-							    thrfunc));
-		  if (newp != NULL)
-		    {
-		      newp->sigev_notify = (evp != NULL
-					    ? evp->sigev_notify
-					    : SIGEV_SIGNAL);
-		      newp->ktimerid = ktimerid;
-
-		      *timerid = (timer_t) newp;
-		    }
-		  else
-		    {
-		      /* No memory.  Free the kernel timer.  */
-		      INTERNAL_SYSCALL_DECL (err);
-		      (void) INTERNAL_SYSCALL (timer_delete, err, 1, ktimerid);
-
-		      retval = -1;
-		    }
+		  newp->sigev_notify = (evp != NULL
+					? evp->sigev_notify : SIGEV_SIGNAL);
+		  newp->ktimerid = ktimerid;
+
+		  *timerid = (timer_t) newp;
+		}
+	      else
+		{
+		  /* Cannot allocate the timer, fail.  */
+		  free (newp);
+		  retval = -1;
 		}
 
 	      return retval;
 	    }
+
+	  free (newp);
 	}
       else
 	{
-#ifndef __ASSUME_POSIX_TIMERS
+# ifndef __ASSUME_POSIX_TIMERS
 	  /* Make sure we have the necessary kernel support.  */
 	  if (__no_posix_timers == 0)
 	    {
@@ -118,7 +130,7 @@ timer_create (clock_id, evp, timerid)
 	    }
 
 	  if (__no_posix_timers > 0)
-#endif
+# endif
 	    {
 		  sigset_t ss;
 		  sigemptyset (&ss);