[v2,4/5] manual: Document unlinkat

Message ID 20250106163257.705106-5-arjun@redhat.com (mailing list archive)
State New
Headers
Series manual: Document several *at file system interface functions |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
linaro-tcwg-bot/tcwg_glibc_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_glibc_check--master-arm success Test passed

Commit Message

Arjun Shankar Jan. 6, 2025, 4:26 p.m. UTC
  ---
 manual/filesys.texi | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)
  

Comments

Florian Weimer Jan. 8, 2025, 8:40 a.m. UTC | #1
* Arjun Shankar:

> ---
>  manual/filesys.texi | 35 ++++++++++++++++++++++++++++++++++-
>  1 file changed, 34 insertions(+), 1 deletion(-)
>
> diff --git a/manual/filesys.texi b/manual/filesys.texi
> index 776b98fe7f..ba2f13ef96 100644
> --- a/manual/filesys.texi
> +++ b/manual/filesys.texi
> @@ -1695,6 +1695,40 @@ file system and can't be modified.
>  @end table
>  @end deftypefun
>  
> +@deftypefun int unlinkat (int @var{filedes}, const char *@var{filename}, 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{unlink}
> +function above.  @xref{Descriptor-Relative Access}.  The @var{flags}
> +argument may either be @code{0} or contain the flag @code{AT_REMOVEDIR}:
> +
> +@table @code
> +@item AT_REMOVEDIR
> +This flag causes @code{unlinkat} to perform an @code{rmdir} operation on
> +@code{filename} instead of performing the equivalent of @code{unlink}.
> +@end table
> +
> +Compared to @code{unlink}, the following additional error conditions can
> +occur:
> +
> +@table @code
> +@item EBADF
> +The @var{filedes} argument is not a valid file descriptor.

Usual comment about AT_FDCWD.

> +@item EINVAL
> +The @var{flags} argument is not valid for this function.
> +
> +@item EISDIR
> +@var{filename} is a directory but the @var{AT_REMOVEDIR} was not passed in
> +@code{flags}.

Please do not start a sentence with @var.  Perhapse use “The effective
final path component is a directory”?

> +@item ENOTDIR
> +The descriptor @var{filedes} is not associated with a directory, and
> +@var{filename} is a relative file name.

I think AT_FDCWD is permitted as well.  But also consider the earlier
comment that we should document EBADF/EINVAL/ENOTDIR in the generic
section.

Thanks,
Florian
  

Patch

diff --git a/manual/filesys.texi b/manual/filesys.texi
index 776b98fe7f..ba2f13ef96 100644
--- a/manual/filesys.texi
+++ b/manual/filesys.texi
@@ -1695,6 +1695,40 @@  file system and can't be modified.
 @end table
 @end deftypefun
 
+@deftypefun int unlinkat (int @var{filedes}, const char *@var{filename}, 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{unlink}
+function above.  @xref{Descriptor-Relative Access}.  The @var{flags}
+argument may either be @code{0} or contain the flag @code{AT_REMOVEDIR}:
+
+@table @code
+@item AT_REMOVEDIR
+This flag causes @code{unlinkat} to perform an @code{rmdir} operation on
+@code{filename} instead of performing the equivalent of @code{unlink}.
+@end table
+
+Compared to @code{unlink}, 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 EISDIR
+@var{filename} is a directory but the @var{AT_REMOVEDIR} was not passed in
+@code{flags}.
+
+@item ENOTDIR
+The descriptor @var{filedes} is not associated with a directory, and
+@var{filename} is a relative file name.
+@end table
+@end deftypefun
+
 @deftypefun int rmdir (const char *@var{filename})
 @standards{POSIX.1, unistd.h}
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
@@ -3855,6 +3889,5 @@  The @code{mkdtemp} function comes from OpenBSD.
 @c renameat2
 @c scandirat
 @c symlinkat
-@c unlinkat
 @c utimensat
 @c mknodat