From patchwork Tue Nov 1 14:25:19 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: 17082 Received: (qmail 38516 invoked by alias); 1 Nov 2016 14:25:57 -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 37949 invoked by uid 89); 1 Nov 2016 14:25:54 -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=(unknown) X-HELO: mail-vk0-f49.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=ZVlKqQ1NlijiIC5LTXnECKl7jD9i0nWnT4bf4n2ZBW0=; b=XmZly3VI/E09mRwYIuu5s9e1ZNFSvLQG8NmbIk9MHmDkCjm5mMoG7isMn9x8iyQFBc Pz9/6zTjT+u7czIMpb8374jhK4Z7MTdeT00KnxkFYZvY2u4Ofzt9nvocc/QDnUlaW0FQ ySkUwzjk8l/u9jasNqw01sj+rSz0qyn7KgaBfJuugiMtmI1v5vYNznEJhqENzvcrnEWT X91VG/brlvaKbrsD86v4yBv/wvLBybtLi7zHrU2rXmEEs4+iHhoWVoCrMhpwPn9uvEPr TTm1bj7qXkCUKu5A+os/1/vtEUz+oADHLTk7bjccotbOAlDq420+lgqX4fTxrcjuqNiX WhmA== X-Gm-Message-State: ABUngvdtsYr0K8F19xPsICslOAbJFd8UbPWQrFfpt7b1ks+d6nNIZdCPo7CJaat+hxrW2Q4D X-Received: by 10.31.13.133 with SMTP id 127mr28093047vkn.132.1478010343643; Tue, 01 Nov 2016 07:25:43 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 11/15] Use shmat syscall for Linux implementation Date: Tue, 1 Nov 2016 12:25:19 -0200 Message-Id: <1478010323-13076-12-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1478010323-13076-1-git-send-email-adhemerval.zanella@linaro.org> References: <1478010323-13076-1-git-send-email-adhemerval.zanella@linaro.org> This patch add a direct call to shmat syscall if it is defined by kernel headers. 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..b247db9 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 __NR_shmat + 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 }