From patchwork Wed Nov 2 19:26:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 80544 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp292114qge; Wed, 2 Nov 2016 12:30:09 -0700 (PDT) X-Received: by 10.98.52.194 with SMTP id b185mr9626544pfa.41.1478115009039; Wed, 02 Nov 2016 12:30:09 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id k184si1746091pgc.306.2016.11.02.12.30.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Nov 2016 12:30:09 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-74330-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org; spf=pass (google.com: domain of libc-alpha-return-74330-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-74330-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org 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:in-reply-to :references; q=dns; s=default; b=JT3nITyp1lgeI12TmRpZz0d5mMkZg4f 8TJp+YkJ5z06/DmjcwWGwxH4rNz2exEa0xyxK5938biYA0tcaeaOQFs4Z3HNP2rO CG+4+Y1fziV7/wy4rzW93kOWrMERPXVLHQNMRg62yCkF/hmnaDiJPL1MfaaWOMul RDMJeQygDAmQ= 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:in-reply-to :references; s=default; bh=Q+NjAlX52AQCPdPX8lJ5ImI0xlk=; b=E8jzD 7ZaaFg2xKkxkKBVQUI5CiZHKvuDv2hgjzIDepIYLHVQvA7xBmZJpPu3GJoKPidgi jY4Q86009BfwKag6xOTETcg7m6cHens+ZHzQqe3HRTYbQQahQRWl1L4I1dX/CAq4 YW71nrAlGlo1ga1SFz/r8UjGe1xhoayWp6WQ9U= Received: (qmail 65896 invoked by alias); 2 Nov 2016 19:27:30 -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 65555 invoked by uid 89); 2 Nov 2016 19:27:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-ua0-f172.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=4f5JaousHREQOZZGDoytBAT1jpwRCaepucK8MsFmGuw=; b=kP2h00LJonrT7sY3xh79LOByI/VqJrIxdEXBuiJ0zqZVNZB6TF2Sdwa/OYC2L3libP hCAIESToFlxg8ZV47wGpMOYv8sw3vgRgyezIPA6lbjHQ6+mbxFolbD2abPt6Kgvb5hTA PUTOWPhfxscLMc0CUT5OxACgfiZAoLE+70O63cpawUWtKUmEM7GduMnqtjNh+n/GPFmR Iva+DamJFFPSS+iy4JIEs9yJimQVL6Pr/v5dObFwIxTO2bSQlQ3CjX8fXB6qIAcHyXHS X56WXmwXYXzeU1/nIsFaxfG4jTTcxhcxv8Fy3bc/F+3Q0C0J+uGbADyLHUG3WP+gwBkT UC2w== X-Gm-Message-State: ABUngvea2dOQxGR8rCPLT4CD8v2sr6/Ri+8M5oVpJB+GA5YO1mehB5Vk2EeWM2bccUUJYvIL X-Received: by 10.159.37.235 with SMTP id 98mr1763907uaf.115.1478114835565; Wed, 02 Nov 2016 12:27:15 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH v2 12/16] Use shmat syscall for Linux implementation Date: Wed, 2 Nov 2016 17:26:49 -0200 Message-Id: <1478114813-3526-13-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1478114813-3526-1-git-send-email-adhemerval.zanella@linaro.org> References: <1478114813-3526-1-git-send-email-adhemerval.zanella@linaro.org> Changes from previous version: - Use __ASSUME_SYSVIPC_SYSCALL instead of __NR_syscall to issue the wired syscall or the ipc one. -- This patch add a direct call to shmat syscall if it is supported by kernel features. Checked on x86_64, i686, powerpc64le, aarch64, and armhf. * sysdeps/unix/sysv/linux/shmat.c (shmat): Use shmat syscall if it is defined. --- ChangeLog | 3 +++ sysdeps/unix/sysv/linux/shmat.c | 17 ++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) -- 2.7.4 diff --git a/sysdeps/unix/sysv/linux/shmat.c b/sysdeps/unix/sysv/linux/shmat.c index 5afc93c..97a15c2 100644 --- a/sysdeps/unix/sysv/linux/shmat.c +++ b/sysdeps/unix/sysv/linux/shmat.c @@ -16,13 +16,10 @@ License along with the GNU C Library; if not, see . */ -#include -#include +#include #include - #include -#include -#include +#include /* Attach the shared memory segment associated with SHMID to the data segment of the calling process. SHMADDR and SHMFLG determine how @@ -31,17 +28,19 @@ void * shmat (int shmid, const void *shmaddr, int shmflg) { +#ifdef __ASSUME_SYSVIPC_SYSCALL + return INLINE_SYSCALL_CALL (shmat, shmid, shmaddr, shmflg); +#else INTERNAL_SYSCALL_DECL(err); unsigned long resultvar; void *raddr; - resultvar = INTERNAL_SYSCALL (ipc, err, 5, IPCOP_shmat, - shmid, shmflg, - (long int) &raddr, - (void *) shmaddr); + resultvar = INTERNAL_SYSCALL_CALL (ipc, err, IPCOP_shmat, shmid, shmflg, + &raddr, shmaddr); if (INTERNAL_SYSCALL_ERROR_P (resultvar, err)) return (void *) INLINE_SYSCALL_ERROR_RETURN_VALUE (INTERNAL_SYSCALL_ERRNO (resultvar, err)); return raddr; +#endif }