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: 17122 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(-) 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 }