From patchwork Thu Apr 20 17:56:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 752934 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 3w864Z36Q9z9s7B for ; Fri, 21 Apr 2017 03:56:30 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="VA02bt5k"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; q=dns; s= default; b=PNjuyqpy2fAC6DPBUbSm45wPSQRteu33KT6kXvlLFl7bGnybviz8M hNiuiIvrNr8ZlXjCJo3uF1Ee9DFAzloZX9Buv4Xk2f+W0S+PzFs9R3Iq4IV9AS15 DPAnaCbocRV5fiyb/1eMcEqe7A1xSTOTnG9Ig4u0r4RbNB7XyawzU8= 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:from:to:subject:date:message-id; s=default; bh=I+CTEWDI0VPVUsrRLoaKXiYBZxY=; b=VA02bt5kUi5lEwEVK6ZsurZBPGcY gaa2RCMdlGVlL+nEW2Ki6tsB8XUFd+AFuELSVLnT0oJ+7dzdiBceuidNRlHyCiZ1 wHgYSz/XF0ACFdfwBtNoMl96ay66lZ+GFuDelg8ImU/xFwtoa3KIfo4zqBrVLaZs ghuFFX3T/JfQ7G4= Received: (qmail 105339 invoked by alias); 20 Apr 2017 17:56:20 -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 105275 invoked by uid 89); 20 Apr 2017 17:56:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=pii X-HELO: mail-qt0-f181.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=Em5kzddxZ+RxPgfR6TQlgEbhUjLEzAThUGnoR76uikI=; b=EeINEvUYNm3ybVWpKmnYdbcIINtxoQ5rXQB0zahGSVU96lUzlPXs/RbSOr4VAI3QL7 ++klH3XrgS/w/pV64ztOvOa5QSBYC8Pj8Z/nIFXh1TVOuRJ915ALbjZIwGNcPDfthb/A NanNFDjQEeB6p5C+/x0vvHE6xcVd15mxXPf59SZjAQeZAIAH0tsh+3EhzJqTulJeCvK+ CD7F2GfBDyB4mJ8BjZFXEII7UIglSh73PZ79srXfSBNJH8FJIy3Hv+AT66aIhe+YZRqp OsM9Dqn/+82WfSGyXjHSKZBBJBHU1AqUhYARYPaMuEO5IXVK4hZsiOFjXC4syyI7SWF5 9wtA== X-Gm-Message-State: AN3rC/6cuMNK/nxBNJnGi9WHqkFNOJoIua5Y1LNazUUsUpSgHF2LU0Bo mHLZ5TLfqrkb/wBC4XczmA== X-Received: by 10.237.36.211 with SMTP id u19mr8872620qtc.187.1492710975304; Thu, 20 Apr 2017 10:56:15 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 1/3] Consolidate Linux poll implementation Date: Thu, 20 Apr 2017 14:56:06 -0300 Message-Id: <1492710968-7699-1-git-send-email-adhemerval.zanella@linaro.org> This patch consolidates the poll Linux syscall implementation on sysdeps/unix/sysv/linux/poll.c. It basically removes poll from auto-generation list and add a default implementation that either call __NR_poll directly (if the kernel headers defines it) or ppoll adjusting the timeout argument (as the generic implementation). Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/generic/poll.c: Remove file. * sysdeps/unix/sysv/linux/poll.c: New file. * sysdeps/unix/sysv/linux/syscalls.list: Remove poll from auto-generation list. --- ChangeLog | 7 +++++++ sysdeps/unix/sysv/linux/{generic => }/poll.c | 8 ++++++-- sysdeps/unix/sysv/linux/syscalls.list | 1 - 3 files changed, 13 insertions(+), 3 deletions(-) rename sysdeps/unix/sysv/linux/{generic => }/poll.c (88%) diff --git a/sysdeps/unix/sysv/linux/generic/poll.c b/sysdeps/unix/sysv/linux/poll.c similarity index 88% rename from sysdeps/unix/sysv/linux/generic/poll.c rename to sysdeps/unix/sysv/linux/poll.c index c06d383..5a781dd 100644 --- a/sysdeps/unix/sysv/linux/generic/poll.c +++ b/sysdeps/unix/sysv/linux/poll.c @@ -1,6 +1,6 @@ -/* Copyright (C) 2011-2017 Free Software Foundation, Inc. +/* Linux poll implementation. + Copyright (C) 2017 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -25,6 +25,9 @@ int __poll (struct pollfd *fds, nfds_t nfds, int timeout) { +#ifdef __NR_poll + return SYSCALL_CANCEL (poll, fds, nfds, timeout); +#else struct timespec timeout_ts; struct timespec *timeout_ts_p = NULL; @@ -36,6 +39,7 @@ __poll (struct pollfd *fds, nfds_t nfds, int timeout) } return SYSCALL_CANCEL (ppoll, fds, nfds, timeout_ts_p, NULL, 0); +#endif } libc_hidden_def (__poll) weak_alias (__poll, poll) diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list index 5d3c417..fcefefc 100644 --- a/sysdeps/unix/sysv/linux/syscalls.list +++ b/sysdeps/unix/sysv/linux/syscalls.list @@ -50,7 +50,6 @@ pause - pause Ci: __libc_pause pause pipe - pipe i:f __pipe pipe pipe2 - pipe2 i:fi __pipe2 pipe2 pivot_root EXTRA pivot_root i:ss pivot_root -poll - poll Ci:pii __libc_poll __poll poll prctl EXTRA prctl i:iiiii __prctl prctl putpmsg - putpmsg i:ippii putpmsg query_module EXTRA query_module i:sipip __compat_query_module query_module@GLIBC_2.0:GLIBC_2.23