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 X-Patchwork-Id: 689930 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 3t7YVq74Drz9sxS for ; Wed, 2 Nov 2016 01:28:19 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=SCAbAY/S; 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:in-reply-to :references; q=dns; s=default; b=wYZOEiZwAojJD5M3rpzSFRNGo7Bowuy Dwr03R8WD8uLI092LHQEKKlOlAgYyxt1os8BbFYnjr/xaaoP/2CE9maRmJnMtKVS XWCNQS/lOi2r4QFL2qb3YKMiU1tjG78844WoqLDGYAGK0ikpA8E89VbKBbV8y6Cb x+eJI6/gqFRA= 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=SCAbA Y/S47jpufqf4n7w5Vc56U8ZnAPxQpERT7ks0YRnQNFTWq63aSx0oGgBRuF/udQw7 loSkzEWIL3h4Q8wR7WpsofPCZ7A2Uyl2q5MImMLfKD0a7gHcp1EkPOQ1Qo1urK64 YMyOI5Tf1DuMQf51WI6shro7H9ezjkvCtuzvpk= 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 }