From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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) From: Florian Weimer 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 Content-Type: text/plain 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-List-Received-Date: Mon, 02 May 2022 19:15:43 -0000 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, . --- 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); \ + }) -- 2.35.1