about summary refs log tree commit diff
path: root/nptl/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-02-21 10:00:33 +0000
committerUlrich Drepper <drepper@redhat.com>2003-02-21 10:00:33 +0000
commit8c2e9a29b1fbda33e57b2d33c7bfcb0de666b1fb (patch)
treeaa445512e4f44e9d00ee5624417f7ee5417c4b75 /nptl/sysdeps
parent8b1a8bb409508906737ec41ed79bb88398cb5dba (diff)
downloadglibc-8c2e9a29b1fbda33e57b2d33c7bfcb0de666b1fb.tar.gz
glibc-8c2e9a29b1fbda33e57b2d33c7bfcb0de666b1fb.tar.xz
glibc-8c2e9a29b1fbda33e57b2d33c7bfcb0de666b1fb.zip
Update.
	* pthreadP.h: Define INVALID_TD_P and INVALID_NOT_TERMINATED_TD_P.
	* pthread_cancel.c: Use INVALID_TD_P.
	* pthread_detach.c: Likewise.
	* pthread_getschedparam.c: Likewise.
	* pthread_setschedparam.c: Likewise.
	* sysdeps/pthread/pthread_getcpuclockid.c: Likewise.
	* sysdeps/unix/sysv/linux/pthread_kill.c: Likewise.
	* pthread_join.c: Use INVALID_NOT_TERMINATED_TD_P.
	* pthread_timedjoin.c: Likewise.

	* tst-basic7.c: Include <signal.h>.
Diffstat (limited to 'nptl/sysdeps')
-rw-r--r--nptl/sysdeps/pthread/pthread_getcpuclockid.c21
-rw-r--r--nptl/sysdeps/unix/sysv/linux/pthread_kill.c10
2 files changed, 19 insertions, 12 deletions
diff --git a/nptl/sysdeps/pthread/pthread_getcpuclockid.c b/nptl/sysdeps/pthread/pthread_getcpuclockid.c
index 62761f9d7a..6386dc4dc0 100644
--- a/nptl/sysdeps/pthread/pthread_getcpuclockid.c
+++ b/nptl/sysdeps/pthread/pthread_getcpuclockid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2001, 2002, 2003 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
@@ -17,23 +17,30 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <errno.h>
-#include <pthread.h>
+#include <pthreadP.h>
 #include <sys/time.h>
 #include <tls.h>
 
 
 int
-pthread_getcpuclockid (thread_id, clock_id)
-     pthread_t thread_id;
-     clockid_t *clock_id;
+pthread_getcpuclockid (threadid, clockid)
+     pthread_t threadid;
+     clockid_t *clockid;
 {
+  struct pthread *pd = (struct pthread *) threadid;
+
+  /* Make sure the descriptor is valid.  */
+  if (INVALID_TD_P (pd))
+    /* Not a valid thread handle.  */
+    return ESRCH;
+
   /* We don't allow any process ID but our own.  */
-  if ((struct pthread *) thread_id != THREAD_SELF)
+  if (pd != THREAD_SELF)
     return EPERM;
 
 #ifdef CLOCK_THREAD_CPUTIME_ID
   /* Store the number.  */
-  *clock_id = CLOCK_THREAD_CPUTIME_ID;
+  *clockid = CLOCK_THREAD_CPUTIME_ID;
 
   return 0;
 #else
diff --git a/nptl/sysdeps/unix/sysv/linux/pthread_kill.c b/nptl/sysdeps/unix/sysv/linux/pthread_kill.c
index ca6dfd887a..2caa72882f 100644
--- a/nptl/sysdeps/unix/sysv/linux/pthread_kill.c
+++ b/nptl/sysdeps/unix/sysv/linux/pthread_kill.c
@@ -31,14 +31,14 @@ __pthread_kill (threadid, signo)
 {
   struct pthread *pd = (struct pthread *) threadid;
 
+  /* Make sure the descriptor is valid.  */
+  if (INVALID_TD_P (pd))
+    /* Not a valid thread handle.  */
+    return ESRCH;
+
   /* We have a special syscall to do the work.  */
   INTERNAL_SYSCALL_DECL (err);
 
-  /* The kernel returns EINVAL for PIDs <= 0.  This is not nice since
-     the user would expect ESRCH.  Correct it here.  */
-  if (pd->tid <= 0)
-    return ESRCH;
-
   int val = INTERNAL_SYSCALL (tkill, err, 2, pd->tid, signo);
 
   return (INTERNAL_SYSCALL_ERROR_P (val, err)