This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix [BZ #130, #131, #133]


Hi!

2004-04-28  Jakub Jelinek  <jakub@redhat.com>

	* manual/resource.texi (sched_setaffinity, sched_getaffinity): Fix
	prototypes and description [BZ #131].

	* string/bits/string2.h (strpbrk): Cast NULL to char * [BZ #130].
	Patch by Ed Catmur <ed@catmur.co.uk>.
	* string/tst-inlcall.c (main): Add test for strpbrk.
linuxthreads/
	* semaphore.c (sem_timedwait): Return -1 and set errno instead of
	returning error number [BZ #133].  Patch by <rmhaddad@yahoo.com>.

--- libc/linuxthreads/semaphore.c.jj	2001-09-12 05:51:41.000000000 +0200
+++ libc/linuxthreads/semaphore.c	2004-04-28 20:43:02.615562441 +0200
@@ -225,7 +225,8 @@ int sem_timedwait(sem_t *sem, const stru
     /* The standard requires that if the function would block and the
        time value is illegal, the function returns with an error.  */
     __pthread_unlock(&sem->__sem_lock);
-    return EINVAL;
+    __set_errno (EINVAL);
+    return -1;
   }
 
   /* Set up extrication interface */
@@ -263,7 +264,8 @@ int sem_timedwait(sem_t *sem, const stru
 
 	if (was_on_queue) {
 	  __pthread_set_own_extricate_if(self, 0);
-	  return ETIMEDOUT;
+	  __set_errno (ETIMEDOUT);
+	  return -1;
 	}
 
 	/* Eat the outstanding restart() from the signaller */
--- libc/manual/resource.texi.jj	2003-05-10 10:11:40.000000000 +0200
+++ libc/manual/resource.texi	2004-04-28 20:51:33.197059589 +0200
@@ -1367,12 +1367,12 @@ affinity mask can be retrieved from the 
 
 @comment sched.h
 @comment GNU
-@deftypefun int sched_getaffinity (pid_t @var{pid}, cpu_set_t *@var{cpuset})
+@deftypefun int sched_getaffinity (pid_t @var{pid}, size_t @var{cpusetsize}, cpu_set_t *@var{cpuset})
 
 This functions stores the CPU affinity mask for the process or thread
-with the ID @var{pid} in the memory pointed to by @var{cpuset}.  If
-successful, the function always initializes all bits in the
-@code{cpu_set_t} object and returns zero.
+with the ID @var{pid} in the @var{cpusetsize} bytes long bitmap
+pointed to by @var{cpuset}.  If successful, the function always
+initializes all bits in the @code{cpu_set_t} object and returns zero.
 
 If @var{pid} does not correspond to a process or thread on the system
 the or the function fails for some other reason, it returns @code{-1}
@@ -1395,12 +1395,12 @@ interface must be provided for that.
 
 @comment sched.h
 @comment GNU
-@deftypefun int sched_setaffinity (pid_t @var{pid}, const cpu_set_t *@var{cpuset})
+@deftypefun int sched_setaffinity (pid_t @var{pid}, size_t @var{cpusetsize}, const cpu_set_t *@var{cpuset})
 
-This function installs the affinity mask pointed to by @var{cpuset}
-for the process or thread with the ID @var{pid}.  If successful the
-function returns zero and the scheduler will in future take the
-affinity information into account.
+This function installs the @var{cpusetsize} bytes long affinity mask
+pointed to by @var{cpuset} for the process or thread with the ID @var{pid}.
+If successful the function returns zero and the scheduler will in future
+take the affinity information into account.
 
 If the function fails it will return @code{-1} and @code{errno} is set
 to the error code:
--- libc/string/tst-inlcall.c.jj	2001-07-06 06:55:42.000000000 +0200
+++ libc/string/tst-inlcall.c	2004-04-28 21:03:43.374202339 +0200
@@ -1,5 +1,5 @@
 /* Tester for calling inline string functions.
-   Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000, 2004 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
@@ -62,6 +62,13 @@ main (void)
       ++errors;
     }
 
+  const char * const hw = "hello world";
+  if (strpbrk (hw, "o") - hw != 4)
+    {
+      puts ("strpbrk test 1 failed");
+      ++errors;
+    }
+
   if (errors == 0)
     {
       status = EXIT_SUCCESS;
--- libc/string/bits/string2.h.jj	2003-08-26 23:07:42.000000000 +0200
+++ libc/string/bits/string2.h	2004-04-28 20:58:24.146412115 +0200
@@ -1,5 +1,5 @@
 /* Machine-independant string function optimizations.
-   Copyright (C) 1997-2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1997-2003, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -1019,7 +1019,7 @@ __strspn_c3 (__const char *__s, int __ac
   ({ char __a0, __a1, __a2;						      \
      (__builtin_constant_p (accept) && __string2_1bptr_p (accept)	      \
       ? ((__a0 = ((__const char  *) (accept))[0], __a0 == '\0')		      \
-	 ? ((void) (s), NULL)						      \
+	 ? ((void) (s), (char *) NULL)					      \
 	 : ((__a1 = ((__const char *) (accept))[1], __a1 == '\0')	      \
 	    ? strchr (s, __a0)						      \
 	    : ((__a2 = ((__const char *) (accept))[2], __a2 == '\0')	      \

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]