From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21185 invoked by alias); 28 Apr 2004 20:11:48 -0000 Mailing-List: contact libc-hacker-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sources.redhat.com Received: (qmail 21167 invoked from network); 28 Apr 2004 20:11:47 -0000 Received: from unknown (HELO sunsite.ms.mff.cuni.cz) (195.113.15.26) by sources.redhat.com with SMTP; 28 Apr 2004 20:11:47 -0000 Received: from sunsite.ms.mff.cuni.cz (sunsite.mff.cuni.cz [127.0.0.1]) by sunsite.ms.mff.cuni.cz (8.12.8/8.12.8) with ESMTP id i3SHxk3j001499; Wed, 28 Apr 2004 19:59:46 +0200 Received: (from jakub@localhost) by sunsite.ms.mff.cuni.cz (8.12.8/8.12.8/Submit) id i3SHxkTb001497; Wed, 28 Apr 2004 19:59:46 +0200 Date: Wed, 28 Apr 2004 20:11:00 -0000 From: Jakub Jelinek To: Ulrich Drepper , Roland McGrath Cc: Glibc hackers Subject: [PATCH] Fix [BZ #130, #131, #133] Message-ID: <20040428175946.GO5191@sunsite.ms.mff.cuni.cz> Reply-To: Jakub Jelinek Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i X-SW-Source: 2004-04/txt/msg00091.txt.bz2 Hi! 2004-04-28 Jakub Jelinek * 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 . * 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 . --- 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 , 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