From patchwork Mon May 2 19:15:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 1625233 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=XI4Oh5vs; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KsXsY42zHz9ryY for ; Tue, 3 May 2022 05:17:21 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1DD053858413 for ; Mon, 2 May 2022 19:17:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1DD053858413 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1651519039; bh=SZKPiaJdXtNkhmvyJm/QFshr2ZmR6IsFa7VSQk6IU2U=; h=To:Subject:In-Reply-To:References:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=XI4Oh5vsR35UbtHTaLvQ8eRZSvA67H5fS+pkXOp52NYHlRvtPsV/G2l1DcY3v8dI1 00CdAE3A4TSsvd5a0zSoamSIhfwrfGlA15P+xwPLWQ755n3JD6wVga3A3a2WRlT3i4 bo73xfiG6EyF4RCDNDEE3vtG9NpOMRajNWPZ3nKc= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 01BFA3857825 for ; Mon, 2 May 2022 19:15:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 01BFA3857825 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-226-mxnCzqv9NvOXLAmK1obboQ-1; Mon, 02 May 2022 15:15:40 -0400 X-MC-Unique: mxnCzqv9NvOXLAmK1obboQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6BD641E15C01 for ; Mon, 2 May 2022 19:15:40 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.59]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C4C57401DBE for ; Mon, 2 May 2022 19:15:39 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH 2/5] Linux: Define MMAP_CALL_INTERNAL In-Reply-To: References: X-From-Line: 74b7baf4b2b0ff4264b87dac0850eb8ef6aa04ee Mon Sep 17 00:00:00 2001 Message-Id: <74b7baf4b2b0ff4264b87dac0850eb8ef6aa04ee.1651518694.git.fweimer@redhat.com> Date: Mon, 02 May 2022 21:15:37 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" Unlike MMAP_CALL, this avoids a TCB dependency for an errno update on failure. cannot be included as is on several architectures due to the definition of page_unit, so introduce a separate header file for the definition of MMAP_CALL and MMAP_CALL_INTERNAL, . Reviewed-by: Stefan Liebler --- sysdeps/unix/sysv/linux/mmap_call.h | 22 +++++++++++++++++++ sysdeps/unix/sysv/linux/mmap_internal.h | 6 +---- .../s390/{mmap_internal.h => mmap_call.h} | 14 ++++++------ 3 files changed, 30 insertions(+), 12 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/mmap_call.h rename sysdeps/unix/sysv/linux/s390/{mmap_internal.h => mmap_call.h} (78%) diff --git a/sysdeps/unix/sysv/linux/mmap_call.h b/sysdeps/unix/sysv/linux/mmap_call.h new file mode 100644 index 0000000000..3547c99e14 --- /dev/null +++ b/sysdeps/unix/sysv/linux/mmap_call.h @@ -0,0 +1,22 @@ +/* Generic definition of MMAP_CALL and MMAP_CALL_INTERNAL. + Copyright (C) 2017-2022 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#define MMAP_CALL(__nr, __addr, __len, __prot, __flags, __fd, __offset) \ + INLINE_SYSCALL_CALL (__nr, __addr, __len, __prot, __flags, __fd, __offset) +#define MMAP_CALL_INTERNAL(__nr, __addr, __len, __prot, __flags, __fd, __offset) \ + INTERNAL_SYSCALL_CALL (__nr, __addr, __len, __prot, __flags, __fd, __offset) diff --git a/sysdeps/unix/sysv/linux/mmap_internal.h b/sysdeps/unix/sysv/linux/mmap_internal.h index 841b731391..aebf97d064 100644 --- a/sysdeps/unix/sysv/linux/mmap_internal.h +++ b/sysdeps/unix/sysv/linux/mmap_internal.h @@ -42,10 +42,6 @@ static uint64_t page_unit; /* Do not accept offset not multiple of page size. */ #define MMAP_OFF_LOW_MASK (MMAP2_PAGE_UNIT - 1) -/* An architecture may override this. */ -#ifndef MMAP_CALL -# define MMAP_CALL(__nr, __addr, __len, __prot, __flags, __fd, __offset) \ - INLINE_SYSCALL_CALL (__nr, __addr, __len, __prot, __flags, __fd, __offset) -#endif +#include #endif /* MMAP_INTERNAL_LINUX_H */ diff --git a/sysdeps/unix/sysv/linux/s390/mmap_internal.h b/sysdeps/unix/sysv/linux/s390/mmap_call.h similarity index 78% rename from sysdeps/unix/sysv/linux/s390/mmap_internal.h rename to sysdeps/unix/sysv/linux/s390/mmap_call.h index cc76ac9735..f169b8bab9 100644 --- a/sysdeps/unix/sysv/linux/s390/mmap_internal.h +++ b/sysdeps/unix/sysv/linux/s390/mmap_call.h @@ -16,9 +16,6 @@ License along with the GNU C Library; if not, see . */ -#ifndef MMAP_S390_INTERNAL_H -# define MMAP_S390_INTERNAL_H - #define MMAP_CALL(__nr, __addr, __len, __prot, __flags, __fd, __offset) \ ({ \ long int __args[6] = { (long int) (__addr), (long int) (__len), \ @@ -26,7 +23,10 @@ (long int) (__fd), (long int) (__offset) }; \ INLINE_SYSCALL_CALL (__nr, __args); \ }) - -#include_next - -#endif +#define MMAP_CALL_INTERNAL(__nr, __addr, __len, __prot, __flags, __fd, __offset) \ + ({ \ + long int __args[6] = { (long int) (__addr), (long int) (__len), \ + (long int) (__prot), (long int) (__flags), \ + (long int) (__fd), (long int) (__offset) }; \ + INTERNAL_SYSCALL_CALL (__nr, __args); \ + })