From patchwork Wed Jul 17 07:59:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 1961464 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=PogGBQg0; 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 4WP7d54Tjqz1ySl for ; Wed, 17 Jul 2024 17:59:37 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D3D663858D39 for ; Wed, 17 Jul 2024 07:59:35 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-yb1-xb33.google.com (mail-yb1-xb33.google.com [IPv6:2607:f8b0:4864:20::b33]) by sourceware.org (Postfix) with ESMTPS id 5BC8B3858D39 for ; Wed, 17 Jul 2024 07:59:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5BC8B3858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5BC8B3858D39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::b33 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721203152; cv=none; b=tDjDXJe028xTgbDeyiZ0AqMQUIHInj71AYCgI0ORIp/VM+Nf4IJwOL8YELpYAHwVMFSSy1sg1Ca1Y8nQjrXIx/b70jwTbctsnYw1qfDTUtCnTqtg0kGaBAMODXLSpR2Wuft6rov8unlfxis3+pvaXKk4Ty/MBMQuN5qvPVVxa5A= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721203152; c=relaxed/simple; bh=089WUDnNwGUENRAwEwtYwh7cyUzzIuQlOMEiZT2Ir1I=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=fjgIKcfZ+u7Eii6AZWsY6KFshdPN02BPX5TQkF5JY+Tx5YbWlylMFOl7bRXt3lm1TqNBpc963yffz7xvujAk+p6U2dVlbAI3fkjIu1A7InPJKewZC4eVtF7aDMB0t6cm8wcP9fe8Sgtq18YW8CzAcgHtYeF4qUeXdlDUygr5LOk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-yb1-xb33.google.com with SMTP id 3f1490d57ef6-e03db345b0cso6024577276.1 for ; Wed, 17 Jul 2024 00:59:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721203149; x=1721807949; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=MYSTc1vRVmD9HF5t/D7rT07o8wpHENQRFWQ1vT5Le3I=; b=PogGBQg0jkZQn03+tigU8UjIaUmkc7Be1BedEGPCkVai1F3nJJ6kUCaXwZR5wHsl46 L78OmSSGIPijKSdrQ0RJlNHmxzMy0Hu6YS/QwzlbsTFkeiKDrgjIGe9XFAP3Pbwx6WY+ PEjQhSTbIGKH/jikFE/3KXmFygZYdXLb/T7tDKLFGzmhfhFxcZ1jDdD5cvSyr93govwI dVI+eP21oo2GPRFzdyIKWyIvmP5SYYIsztc4cCkAMGcjQ84yWK3UYG9nTDHwB4gQR4H/ J6DGhg1+uU0iAldzDlWEAqdTCJMzqpSU2oRXAfYE467ic4cTrSZYXZ+db0USHKfk7CVy AUJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721203149; x=1721807949; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MYSTc1vRVmD9HF5t/D7rT07o8wpHENQRFWQ1vT5Le3I=; b=AlM4EBiGCRHHU/z9sSq73xffD64uB4s0JQXh/QMVME7weXVsWhpBA6/TTk3l6zsJcV VTmxPJIranvRhbytun3Nx+DcJzTpX9IauyjCMutWUJgKHNlCO3OJ0WLaP6QJIGHgYsKZ nyWsrCGc2UDZR50VYRVvkY9lAC2Glh2ghb9Vrca22DzT4FdE0d4QXj9v44468ytxgcGO 6KViIj8LkgFJTJlIcuOeSlhsoU4FU8Sta0zSwNa33TxcPVj5Y6AL64CfmIJRVH+L58FA WdDnZRUCRc4j0SuO3XU4s+FSY1pKJqircKxuwlc04ydYtLW4NMO95YobBwzZDmL/xiGv jncg== X-Gm-Message-State: AOJu0YzBG/DIWJeE7JN085woXymJssZuunE3XSJZO4stL8ejGax52Q+m 6NU4GU4NBz8sjtQvTXi6dUdxmjXSZU2TiNCsbq0icYRVeCqO4MLFKRO2ig7ufKsZTA== X-Google-Smtp-Source: AGHT+IFaYrpX6YSH6abS7hY1Y7WOot+f/z9LCVXTBld3/uWhLyvdGXGlpe2BQc7AxO2Ds+6j8uZ1Hg== X-Received: by 2002:a05:6902:2002:b0:e03:a4ba:856f with SMTP id 3f1490d57ef6-e05ed79d4eemr1115232276.53.1721203149337; Wed, 17 Jul 2024 00:59:09 -0700 (PDT) Received: from gnu-tgl-3.localdomain ([172.58.30.168]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e05a471faf5sm1578269276.55.2024.07.17.00.59.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jul 2024 00:59:09 -0700 (PDT) Received: from gnu-tgl-3.. (localhost [IPv6:::1]) by gnu-tgl-3.localdomain (Postfix) with ESMTP id 201B6C02F4 for ; Wed, 17 Jul 2024 00:59:05 -0700 (PDT) From: "H.J. Lu" To: libc-alpha@sourceware.org Subject: [PATCH v3 2/3] mremap: Update manual entry Date: Wed, 17 Jul 2024 00:59:03 -0700 Message-ID: <20240717075904.2365688-3-hjl.tools@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240717075904.2365688-1-hjl.tools@gmail.com> References: <20240717075904.2365688-1-hjl.tools@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-3019.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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 Update mremap manual entry: 1. Change mremap to variadic. 2. Document MREMAP_FIXED and MREMAP_DONTUNMAP. Signed-off-by: H.J. Lu Reviewed-by: Adhemerval Zanella --- manual/llio.texi | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/manual/llio.texi b/manual/llio.texi index 6f0a48609b..c6f65089ee 100644 --- a/manual/llio.texi +++ b/manual/llio.texi @@ -1892,7 +1892,7 @@ There is no existing mapping in at least part of the given region. @end deftypefun -@deftypefun {void *} mremap (void *@var{address}, size_t @var{length}, size_t @var{new_length}, int @var{flag}) +@deftypefun {void *} mremap (void *@var{address}, size_t @var{length}, size_t @var{new_length}, int @var{flag}, ... /* void *@var{new_address} */) @standards{GNU, sys/mman.h} @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}} @@ -1901,12 +1901,39 @@ area. @var{address} and @var{length} must cover a region entirely mapped in the same @code{mmap} statement. A new mapping with the same characteristics will be returned with the length @var{new_length}. -One option is possible, @code{MREMAP_MAYMOVE}. If it is given in -@var{flags}, the system may remove the existing mapping and create a new -one of the desired length in another location. +Possible flags are -The address of the resulting mapping is returned, or @math{-1}. Possible -error codes include: +@table @code + +@item MREMAP_MAYMOVE +If it is given in @var{flags}, the system may remove the existing mapping +and create a new one of the desired length in another location. + +@item MREMAP_FIXED +If it is given in @var{flags}, @code{mremap} accepts a fifth argument, +@code{void *new_address}, which specifies a page-aligned address to +which the mapping must be moved. Any previous mapping at the address +range specified by @var{new_address} and @var{new_size} is unmapped. + +@code{MREMAP_FIXED} must be used together with @code{MREMAP_MAYMOVE}. + +@item MREMAP_DONTUNMAP +If it is given in @var{flags}, @code{mremap} accepts a fifth argument, +@code{void *new_address}, which specifies a page-aligned address. Any +previous mapping at the address range specified by @var{new_address} and +@var{new_size} is unmapped. If @var{new_address} is @code{NULL}, the +kernel chooses the page-aligned address at which to create the mapping. +Otherwise, the kernel takes it as a hint about where to place the mapping. +The mapping at the address range specified by @var{old_address} and +@var{old_size} isn't unmapped. + +@code{MREMAP_DONTUNMAP} must be used together with @code{MREMAP_MAYMOVE}. +@var{old_size} must be the same as @var{new_size}. + +@end table + +The address of the resulting mapping is returned, or @code{MAP_FAILED}. +Possible error codes include: @table @code @@ -1915,7 +1942,7 @@ There is no existing mapping in at least part of the original region, or the region covers two or more distinct mappings. @item EINVAL -The address given is misaligned or inappropriate. +Any arguments are inappropriate, including unknown @var{flags} values. @item EAGAIN The region has pages locked, and if extended it would exceed the