From patchwork Fri May 16 14:24:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?T25kxZllaiBCw61sa2E=?= X-Patchwork-Id: 349616 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 105A1140085 for ; Sat, 17 May 2014 00:24:17 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:references :mime-version:content-type:in-reply-to; q=dns; s=default; b=Ar0w SUQvDs+tbPsMcbAGw80aCtTqbPmxgiTLVYxXTVVg+M1Mp9ZjxXYx27L2x9ugfDc6 z5zuLcpaDgaFbeSw9VmU/5fjxaKy9d2YqfXAMXFtQubvOl3o20KcUfs3eBS6UjGt QhxTn/pXonZbsyAlwB3Lik9EzGBY+8193sWFyFI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:references :mime-version:content-type:in-reply-to; s=default; bh=62VLXp8U9V w0+wN/5BrdMvszzSU=; b=ICcBpVSJMGXMsJTC0P8bRn9i+UHnDJyIAZRmrnEetw xrcUQr1pmDeV/a2tdP2QBLhkZzaXDRy+ACIAWK991/jrCdRiSmX3Vh02MCCM2XoM ohnP4SUO2b2M6flZmnX+oVf5clBfAjHkUpmR7mx3Cr/WAoaTOrBXkY4cxThQUCey A= Received: (qmail 8481 invoked by alias); 16 May 2014 14:24:12 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 8462 invoked by uid 89); 16 May 2014 14:24:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, SPF_NEUTRAL autolearn=no version=3.3.2 X-HELO: popelka.ms.mff.cuni.cz Date: Fri, 16 May 2014 16:24:04 +0200 From: =?utf-8?B?T25kxZllaiBCw61sa2E=?= To: "Joseph S. Myers" Cc: Rasmus Villemoes , libc-alpha@sourceware.org Subject: Re: [PATCH] Fix prototype for eventfd Message-ID: <20140516142404.GB29829@domone.podge> References: <8761lraz3r.fsf@rasmusvillemoes.dk> <87a9asifl0.fsf@rasmusvillemoes.dk> <20140513200012.GB15468@domone.podge> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) On Tue, May 13, 2014 at 08:33:58PM +0000, Joseph S. Myers wrote: > On Tue, 13 May 2014, Ondrej Bilka wrote: > > > On Thu, May 08, 2014 at 03:07:39PM +0200, Rasmus Villemoes wrote: > > > Rasmus Villemoes writes: > > > > > > > Both the man-page and the actual kernel source says that the first > > > > argument to eventfd is unsigned int, not simply int. > > > > > > > > > > ping > > > > looks good, I am bit concerned with compatibility, Joseph could you also > > comment it? > > Compatibility would be an issue if: > > * the C ABI on some architecture defines int to be sign-extended to 64 > bits when passed as a function parameter, but unsigned int to be > zero-extended; > > * the code generated for eventfd relied on this in some way; and > > * a user binary passes a negative value for the int argument. > > I don't expect that to be an issue (in that I don't expect any dependence > beyond the value passed to the function being passed on to the kernel > unchanged) but haven't looked at generated code. > I looked linux fs/eventfd.c and it should not be case as a parameter is passed to different function. OK to commit patch with this changelog? 2014-05-16 Rasmus Villemoes * ports/sysdeps/unix/sysv/linux/hppa/sys/eventfd.h (eventfd): Make first argument unsigned. * sysdeps/unix/sysv/linux/eventfd.c (eventfd): Likewise. * sysdeps/unix/sysv/linux/sys/eventfd.h (eventfd): Likewise. diff --git a/ports/sysdeps/unix/sysv/linux/hppa/sys/eventfd.h b/ports/sysdeps/unix/sysv/linux/hppa/sys/eventfd.h index 2d198a8..a3c340e 100644 --- a/ports/sysdeps/unix/sysv/linux/hppa/sys/eventfd.h +++ b/ports/sysdeps/unix/sysv/linux/hppa/sys/eventfd.h @@ -40,7 +40,7 @@ __BEGIN_DECLS /* Return file descriptor for generic event channel. Set initial value to COUNT. */ -extern int eventfd (int __count, int __flags) __THROW; +extern int eventfd (unsigned int __count, int __flags) __THROW; /* Read event counter and possibly wait for events. */ extern int eventfd_read (int __fd, eventfd_t *__value); diff --git a/sysdeps/unix/sysv/linux/eventfd.c b/sysdeps/unix/sysv/linux/eventfd.c index 425c811..83da67f 100644 --- a/sysdeps/unix/sysv/linux/eventfd.c +++ b/sysdeps/unix/sysv/linux/eventfd.c @@ -22,7 +22,7 @@ int -eventfd (int count, int flags) +eventfd (unsigned int count, int flags) { #ifdef __NR_eventfd2 int res = INLINE_SYSCALL (eventfd2, 2, count, flags); diff --git a/sysdeps/unix/sysv/linux/sys/eventfd.h b/sysdeps/unix/sysv/linux/sys/eventfd.h index 7f977ed..0806891 100644 --- a/sysdeps/unix/sysv/linux/sys/eventfd.h +++ b/sysdeps/unix/sysv/linux/sys/eventfd.h @@ -31,7 +31,7 @@ __BEGIN_DECLS /* Return file descriptor for generic event channel. Set initial value to COUNT. */ -extern int eventfd (int __count, int __flags) __THROW; +extern int eventfd (unsigned int __count, int __flags) __THROW; /* Read event counter and possibly wait for events. */ extern int eventfd_read (int __fd, eventfd_t *__value);