From patchwork Wed Oct 2 08:29:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 1991860 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=dr1Yztla; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XJSg133Nbz1xtn for ; Wed, 2 Oct 2024 18:30:21 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2DB7E3860C3A for ; Wed, 2 Oct 2024 08:30:19 +0000 (GMT) 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 ESMTP id 015A33858D28 for ; Wed, 2 Oct 2024 08:30:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 015A33858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 015A33858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727857803; cv=none; b=JN1/eocoS5Xs474ZemKNGdcXDn4OsTH7Ir7mWIr1e3fWHl9ZlEYdfIX02eYy4aHXXVJz9C+iHwEQUhJ4TqWFBQ70jO9bihin31M3FUjl10YYd0vSBxOv6PbZRR68uelGeL4acQscoNYc+niymTZh8OwPb/tGiV77nyLVNZFly8A= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727857803; c=relaxed/simple; bh=wyn8jUHduCpNhDyUPlshzQ72266/dX0B2zLGoaaDSUI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=KCUdjHCEHa2dbxNit1C9kFn61zzNO5WyPnfKD2JLWdgtMBwk/qZF7PgzhOo32zy8drBhlCOrN9MT3INRbPmgxVLlpoR/it8idXINUvVoemCmeMZ1kuxJZ6Qs9JJ+PyHwTKPJS+KMmXB7P733zaeoH65HOA/bPzwZpcJ8WU/g88c= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727857801; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=N6nK5CAww/0LDLNDVvDoQJUxImn28efNeyHq00b8r80=; b=dr1YztlaP7Yy/g/Kfrc2QN0M4qDVprFGL5WN5ValZkjxXEU/b473F/Yxg8xhLONFTxbRLI 2lXM1w5Deq19GbnOHhAMCUiXPRGy1zIQgXOKa0MHhoI5VF9CZAnenSn6qI7bsqun5uZPGB YWwTH6mKPNoJeZI2igyELc+TjjXY/Eo= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-312-nNiBYMPAPheqxzMjkdYqaA-1; Wed, 02 Oct 2024 04:30:00 -0400 X-MC-Unique: nNiBYMPAPheqxzMjkdYqaA-1 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (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 mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8D8321977016; Wed, 2 Oct 2024 08:29:59 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.45.224.151]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1E34F19560AD; Wed, 2 Oct 2024 08:29:57 +0000 (UTC) From: Florian Weimer To: libc-alpha@sourceware.org Cc: Paul Eggert Subject: [PATCH v2] Prepare for the addition of the header Date: Wed, 02 Oct 2024 10:29:55 +0200 Message-ID: <875xqagb5o.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-10.8 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_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org Add a stub version of . This header is similar to in that every port must define its own version. Add , which will become the installed version of this header. PAGE_SIZE_MIN and PAGE_SIZE_MAX have type long int, so that roundup (offset, PAGE_SIZE_MAX) gives the correct result if offset has type off64_t on 32-bit architectures. (With an unsigned type for PAGE_SIZE_MAX, the roundup macro does not work as expected if the first argument is wider than the second argument.) Reviewed-by: Paul Eggert --- v2: Change the type of the PAGE_SIZE_MIN, PAGE_SIZE_MAX to long int. bits/pagesize.h | 10 ++++++++++ include/sys/pagesize.h | 1 + misc/sys/pagesize.h | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+) base-commit: a652eef605a5e3513246cf75af278955df6d022b diff --git a/bits/pagesize.h b/bits/pagesize.h new file mode 100644 index 0000000000..d83561d0c1 --- /dev/null +++ b/bits/pagesize.h @@ -0,0 +1,10 @@ +#error "This file must be written based on the possible page sizes" + +/* 1 << __GLIBC_PAGE_SHIFT_MIN is the minimum possible page size. + The least significant __GLIBC_PAGE_SHIFT_MIN bits of pointers + return by mmap are guaranteed to be cleared. */ +#define __GLIBC_PAGE_SHIFT_MIN + +/* 1 << __GLIBC_PAGE_SHIFT_MAX is the maximum possible page size. + On-disk file formats must not require smaller mapping offsets. */ +#define __GLIBC_PAGE_SHIFT_MAX diff --git a/include/sys/pagesize.h b/include/sys/pagesize.h new file mode 100644 index 0000000000..2533ee7e90 --- /dev/null +++ b/include/sys/pagesize.h @@ -0,0 +1 @@ +#include diff --git a/misc/sys/pagesize.h b/misc/sys/pagesize.h new file mode 100644 index 0000000000..e806c711bd --- /dev/null +++ b/misc/sys/pagesize.h @@ -0,0 +1,32 @@ +/* Information about supported page sizes. + Copyright (C) 2024 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 + . */ + +#ifndef _SYS_PAGESIZE_H +#define _SYS_PAGESIZE_H + +#include + +/* Minimum and maximum possible page sizes, in bytes. */ +#define PAGE_SIZE_MIN (1L << __GLIBC_PAGE_SHIFT_MIN) +#define PAGE_SIZE_MAX (1L << __GLIBC_PAGE_SHIFT_MAX) + +/* Base-2 logarithm of the size limits. */ +#define PAGE_SHIFT_MIN __GLIBC_PAGE_SHIFT_MIN +#define PAGE_SHIFT_MAX __GLIBC_PAGE_SHIFT_MAX + +#endif /* _SYS_PAGESIZE_H */