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: 80367 Delivered-To: patch@linaro.org Received: by 10.80.142.83 with SMTP id 19csp678616edx; Tue, 1 Nov 2016 07:28:25 -0700 (PDT) X-Received: by 10.98.11.71 with SMTP id t68mr19717367pfi.136.1478010505719; Tue, 01 Nov 2016 07:28:25 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id e13si30800523pgn.145.2016.11.01.07.28.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Nov 2016 07:28:25 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-74270-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-74270-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-74270-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=dFbrMjeOxf4+/NnMctGq01VutHSG9Xi 77I8Y54cCSX0A2cLAI5ZBd/q8PC+42+SjQwsJWi2skpr9MO/0RgADkNoQNxZoKDT vTNXXzVGOo/VEq1V/6vdv4PeeXOBIdpa7GmIBKij9BJ57uniy6YJTjnAKtCQFKYL T1bq80ZqR+h4= 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=2opzB3HJM3WuHWgTiWj9PwgCB/8=; b=CLL8k n3QNRNnGfTygltuGit7srXvx0Weln8D4OjyH27VGicElT79aS9CIlF2TxNN7JAd/ Wbn7WOD104hATW2RNfBT0cfJF8TmaOUv4GQPgtHrGoA1uoP2y+tMHEI0LtnbZBFv 5hCkYzkdLRqqN9hBpRpfxOu6wPwpFPKTCNDBsg= 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(-) -- 2.7.4 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 }