From patchwork Mon Jan 6 16:26:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arjun Shankar X-Patchwork-Id: 104189 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5EF593858C2B for ; Mon, 6 Jan 2025 16:38:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5EF593858C2B Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Yn+QN+cO 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 371623858D28 for ; Mon, 6 Jan 2025 16:33:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 371623858D28 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 371623858D28 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=1736181188; cv=none; b=ZFgnboUalK/3zFeIxT56nw34HhOtxpiA6aK3hIInyQF1rVrKCbM4VfH28CnH5kdSrm/jo0EUTFPAxHVRAIaXdresEsT48Ote22Y/j2dxpavWffUttPC4gstXqDqA7we3tdurcUHc9OyQ0h20uVPYwwrkEzOQZXqnyvAZfR2arIY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736181188; c=relaxed/simple; bh=K4xxr2C6zb9f8BTZGUvPZRZtFXu0fLx4VaZNUazYfrE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=tH0OMW4Y7bLrmGKlrcBrH744OLuKr6AIuQKjdAiFb8dXPaUqOzAq2Sr0TVLDcZJOfHVKahtCKFOYqKyf+7y8Lj7f+f9MQrH3Ajq5tpg2mvuQPdb8imul/8akv+9gbPBYNlfbSsA1w+i5bZ3ijSQykC+rBJ4FyniHptPOsKU7Mic= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 371623858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736181188; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sZSJHG6Z7Cm0GJ3bb3iBNBr3D1p4icqYWMXMQMtNE48=; b=Yn+QN+cOFe6/f1z744Wv4YvbxOJUCTq8FYtFUdwb5uH42QZ0+7AKz2TAi8KwG3C1zNAmfu r8Z+qZGjwzPjI4p/yDKpn6afFXF8GU+zyfWOnPxIP3y2FhcdduNNit6Ez5QYwRzamLRooe nI49lBygn4MyOv5aKt1wDERwldV8H5U= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-478-1gNrk8YWP96jvaUWFDx8Ow-1; Mon, 06 Jan 2025 11:33:07 -0500 X-MC-Unique: 1gNrk8YWP96jvaUWFDx8Ow-1 X-Mimecast-MFC-AGG-ID: 1gNrk8YWP96jvaUWFDx8Ow Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-467bbc77b05so315145601cf.0 for ; Mon, 06 Jan 2025 08:33:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736181186; x=1736785986; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sZSJHG6Z7Cm0GJ3bb3iBNBr3D1p4icqYWMXMQMtNE48=; b=K2xJu8JSbcnrdLBT525OW5ivSfneB8AXRgw9MjaD6NX9pm+GwTfJoYFX8DRCbGBagU 5flhM/0XDB+c/z2NvJE62KtDGvdXwA1UgYaqyYSkIXR1Iz/2h8+rXDc+hCdjZ9bnl7Rr uvNO50AbBLYCkZrLivMJujM25E8u8Rf41B2hWxeBwAs7mWFwzNyNF0GArdEfCQI3Qgel aqNYUmXVuFIHZ4XnC/XbsP+8nABsoaEUZ3UC80fKEWBZtTIE5JFpyDoLfDDtSKlUyhQf IGuHtqUZitlJuPIII5E2S2WnJ5jI2VkcU4v/wfftU7jrXKqMf7UXd/6tXohLsIVLgbJJ VKpA== X-Gm-Message-State: AOJu0YxncdsMF9Q9x2nHxUu28L9MTUCcLVjmYxeazlE7L436bO6jXfh0 1ilol0vlRYI201q250sSsZsJsE1Vps4r7xV2zqs2KXRuZ27j3tCaVNnEVEaJ30wRhJKiQ4DjiQq /zTbLf9pqVCrlUBanWGVdcIF/CpK+rAvij7T/KCV/XZnrFTSphjEXHIL4Jx5ZPaOXY0qQorZWmk RZB0tLlUSmkecoWafIqRx5pZXkWV0QXlt3qTidsA== X-Gm-Gg: ASbGncsQHh79Z+YdunpXxN4xXf7uPOd4UI2F8BnftF4ioO4r24OM792SPmkI5cPgivY k8PD7ANfbPhf6WZvYq34zpyQA5DrJne/eYmKe0KnFclT2JqzFzNMtvGFht9EIjQc5xurfd4I7ij QWxaQHhrl2bAg4Qjzo1rjBzn/cKucQHErcVl/GzmrcB2kOqVsA9f19cMieIFPDFzeG0kbMfq+MC 68XUivj+bF2BSkSl4rKVRS2xfGvyWd6B01aClKY+co/M8KFa+eSbZioMu3AUoioLOFfSJmo5H7S j6O8ZVdFg5geaq/qybSkXI38 X-Received: by 2002:a05:622a:11ca:b0:466:a6e5:6f0f with SMTP id d75a77b69052e-46a4a8c5ae1mr1120148111cf.4.1736181185822; Mon, 06 Jan 2025 08:33:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IEfkr/IvBfJKqJZvLn3Xr815CilpIoxHKVt4G7lezwpRQuDYTld80ZLqJhGM+lITKaIJOPd7A== X-Received: by 2002:a05:622a:11ca:b0:466:a6e5:6f0f with SMTP id d75a77b69052e-46a4a8c5ae1mr1120147531cf.4.1736181185329; Mon, 06 Jan 2025 08:33:05 -0800 (PST) Received: from x1carbon9g.redhat.com (ip-94-112-226-240.bb.vodafone.cz. [94.112.226.240]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-46a3e67e361sm176664841cf.31.2025.01.06.08.33.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2025 08:33:04 -0800 (PST) From: Arjun Shankar To: libc-alpha@sourceware.org Cc: Arjun Shankar Subject: [PATCH v2 1/5] manual: Document faccessat Date: Mon, 6 Jan 2025 17:26:06 +0100 Message-ID: <20250106163257.705106-2-arjun@redhat.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250106163257.705106-1-arjun@redhat.com> References: <20250106163257.705106-1-arjun@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: yzjLpySdrtSvhsnYzkxviv5jmx05FhbDO8HoX_9Ii4U_1736181186 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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~patchwork=sourceware.org@sourceware.org This commit adds a note that the Descriptor-Relative Access section does not list all flags, then documents `faccessat' along with the AT_EACCESS flag specific to this function. Reviewed-by: Florian Weimer --- manual/filesys.texi | 53 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 7 deletions(-) diff --git a/manual/filesys.texi b/manual/filesys.texi index aabb68385b..407c26bd76 100644 --- a/manual/filesys.texi +++ b/manual/filesys.texi @@ -310,12 +310,17 @@ This is a GNU extension. The flags argument in @code{@dots{}at} functions can be a combination of the following flags, defined in @file{fcntl.h}. Not all such functions support all flags, and some (such as @code{openat}) do not accept a -flags argument at all. - -In the flag descriptions below, the @dfn{effective final path component} -refers to the final component (basename) of the full path constructed -from the descriptor and file name arguments, using file name lookup, as -described above. +flags argument at all. Although the flags specific to each function have +distinct values from each other, some flags (relevant to different +functions) might share the same value and therefore are not guaranteed to +have unique values. + +A non-exhaustive list of common flags and their descriptions follows. Flags +specific to a function are described alongside the function itself. In +these flag descriptions, the @dfn{effective final path component} refers to +the final component (basename) of the full path constructed from the +descriptor and file name arguments, using file name lookup, as described +above. @vtable @code @item AT_EMPTY_PATH @@ -2980,6 +2985,41 @@ Flag meaning test for execute/search permission. Flag meaning test for existence of the file. @end deftypevr +@deftypefun int faccessat (int @var{filedes}, const char *@var{filename}, int @var{how}, int @var{flags}) +@standards{POSIX.1-2008, unistd.h} +@comment Unaudited and therefore marked AC-Unsafe and AS-Unsafe by default +@safety{@mtsafe{}@asunsafe{@asucorrupt{}}@acunsafe{@acucorrupt{}}} +This function is a descriptor-relative version of the @code{access} +function above. @xref{Descriptor-Relative Access}. The @var{flags} +argument can contain a combination of the flags @code{AT_EACCESS} described +below, @code{AT_EMPTY_PATH}, and @code{AT_SYMLINK_NOFOLLOW}. + +@vtable @code +@item AT_EACCESS +This flag when passed to the @code{faccessat} function causes it to perform +access checks using effective user and group IDs instead of real IDs, which +is the default and matches the @code{access} function. +@end vtable + +Compared to @code{access}, the following additional error conditions can +occur: + +@table @code +@item EBADF +The @var{filedes} argument is not a valid file descriptor. + +@item EINVAL +The @var{flags} argument is not valid for this function. + +@item ENOTDIR +The descriptor @var{filedes} is not associated with a directory, and +@var{filename} is a relative file name. +@end table + +This function may not work correctly on older kernels missing the +@code{faccessat2} system call. +@end deftypefun + @node File Times @subsection File Times @@ -3760,7 +3800,6 @@ creation always works like @code{open} with @code{O_EXCL}. The @code{mkdtemp} function comes from OpenBSD. @c FIXME these are undocumented: -@c faccessat @c fchmodat @c fchownat @c futimesat