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 6B55F3959E52 for ; Tue, 3 May 2022 18:30:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6B55F3959E52 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-586--jRYiwOaN7mo3gWVjiYu9Q-1; Tue, 03 May 2022 14:30:46 -0400 X-MC-Unique: -jRYiwOaN7mo3gWVjiYu9Q-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BF7F6805F46; Tue, 3 May 2022 18:30:45 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.193.113]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E3BAC40CFD19; Tue, 3 May 2022 18:30:44 +0000 (UTC) From: Florian Weimer To: Stefan Liebler Cc: Subject: Re: [PATCH 2/5] Linux: Define MMAP_CALL_INTERNAL References: <74b7baf4b2b0ff4264b87dac0850eb8ef6aa04ee.1651518694.git.fweimer@redhat.com> Date: Tue, 03 May 2022 20:30:43 +0200 In-Reply-To: <74b7baf4b2b0ff4264b87dac0850eb8ef6aa04ee.1651518694.git.fweimer@redhat.com> (Florian Weimer via Libc-alpha's message of "Mon, 02 May 2022 21:15:37 +0200") Message-ID: <87wnf2eaek.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-11.1 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: Tue, 03 May 2022 18:30:51 -0000 * Florian Weimer via 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, > . > --- > 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); \ > + }) Stefan, would you be able to review this patch? It's mostly an S390 change, after all. Thanks, Florian