From patchwork Wed Jul 24 21:05:14 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: 1964489 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=L0DT7QEH; 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 4WTmkv0Vl7z1yY9 for ; Thu, 25 Jul 2024 07:05:42 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 368F13858C39 for ; Wed, 24 Jul 2024 21:05:41 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-ot1-x331.google.com (mail-ot1-x331.google.com [IPv6:2607:f8b0:4864:20::331]) by sourceware.org (Postfix) with ESMTPS id 9A1743858C48 for ; Wed, 24 Jul 2024 21:05:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9A1743858C48 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 9A1743858C48 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::331 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721855122; cv=none; b=MycjFVidPcoNJQmU0MGaC2S8xUek/dKaQ4e5G/uTPa1t7CeTxtHW/7Tu0NdFKq2NTDKNcF0NUvTMhlCsG3wSeL5r1Kr4xtEKHrBX2h5mhdf9u/Ftnbn0nCWt4PRiHM5on+xgZOwpjxJ4AaV1FHfumSmlHofrA9PV2QnikCXqQNs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721855122; c=relaxed/simple; bh=6mkFE3abS3aABAoRbXUOyIm5hORKyN/Su02jBgazStg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=DUgo9TE9Pj/pyHPuT1iulG0rZ02yOKLcdslPVXy0OpvHC050rIzFXMJYJgKRnbTXYq8MK9cyjMSqK4Ez7ITUglI9fHiQd1zlSHVpH2g44A6LKEIo8e0rYDTn74g6obpI96vrD8Dfdr9JhKO7cJ/QskC2BECRfmsYHPmBndwYy3E= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ot1-x331.google.com with SMTP id 46e09a7af769-70365f905b6so125072a34.0 for ; Wed, 24 Jul 2024 14:05:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721855119; x=1722459919; 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=hEkOYMZyreKd672O23BJnP0PqDZJ8SZHQ6anShDAXeo=; b=L0DT7QEHOn/yKa74WIPx6AI6AkKgA6NBMpAdqvXJKFS1wS6KpJ4bj1NQPTRtfdlhOL 0hN9kISnzUNmDVU54i4E3KRl4vAafLGj7t/8OBg5UnFGKsKWVh//P8y0/Nc2eyX0+9oM VU50/GlfX8nMo2LMBpwqTf4eExXSwI19F+BdKFINCyeT5N1kAqUpn3miY0bZ719ciGYq 81La5bL/J0z/GCMN0MKehkhPixUd89hZU6vAwjYeQNa8qUUvD3i55RHlJ3jktBllw7a1 bEIWGSvEkMMucxOKqE9SNsgJ0Y0Jiie347nUUHm6MN/Nbyjel3D3uof9MrR5c13GnD18 /7mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721855119; x=1722459919; 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=hEkOYMZyreKd672O23BJnP0PqDZJ8SZHQ6anShDAXeo=; b=e/sjLvaWGP9t5B3yinh+3TW1aEgdIkS/7LwpEXrvki0ajLHtImQKKUSxlv+qA5UWQ6 n8lOJWf2lmNUlUX199So42yjV8Rv7MFrJm49EfV3CelUP7ciqMZLx7woG/iIcNpxAF7+ LRB6ZFiNgG3wv97l3eFAxR+FQTDzhYHFH4nyGi/bOmVUgCZeQC11w3qQGhaKtDIZBltM Nky4Sz2T+Hu85od5L7eQtL6vhYh2jDVFbhcPxuxTLnK2n5/ZFdevXOlxmhGyeC/w9C89 B2ZjGRKJ+DBkTXsQXccOuQ2DpHmpUgCgqLerJHy0S2mNZtcYRzfUI105mUxHux9lnFDA n2Pg== X-Gm-Message-State: AOJu0Yzs+EoZqlaOWPdndQJ/pe7+uVJwlK2bhEDXP3Qi1qLn6NJ36Cf3 z9emnbxoMOqr86luGCbXrpDNovhe2PQ5gt7xuQEhAJPeJa+KhyoCLOEkCymO+0ZW8g== X-Google-Smtp-Source: AGHT+IFhhkzWCoA6imd/VJCSeY707HY2TnrRkk/aHlZBAcex0wN9mogqQ8c6SA3KjgqyQJPIVWhvWA== X-Received: by 2002:a05:6830:6482:b0:703:6d27:63e0 with SMTP id 46e09a7af769-7092e7235a1mr1350990a34.26.1721855119473; Wed, 24 Jul 2024 14:05:19 -0700 (PDT) Received: from gnu-tgl-3.localdomain ([172.58.160.33]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a1d73ee80esm2524185a.70.2024.07.24.14.05.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jul 2024 14:05:19 -0700 (PDT) Received: from gnu-tgl-3.. (localhost [IPv6:::1]) by gnu-tgl-3.localdomain (Postfix) with ESMTP id 38371C03D5 for ; Wed, 24 Jul 2024 14:05:15 -0700 (PDT) From: "H.J. Lu" To: libc-alpha@sourceware.org Subject: [PATCH v4 2/3] mremap: Update manual entry Date: Wed, 24 Jul 2024 14:05:14 -0700 Message-ID: <20240724210515.473004-3-hjl.tools@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240724210515.473004-1-hjl.tools@gmail.com> References: <20240724210515.473004-1-hjl.tools@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-3021.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, 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 | 42 +++++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/manual/llio.texi b/manual/llio.texi index 6f0a48609b..ea84196abd 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,40 @@ 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}. This flag bit is +Linux-specific. + +@end table + +The address of the resulting mapping is returned, or @code{MAP_FAILED}. +Possible error codes include: @table @code @@ -1915,7 +1943,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