mailing list of musl libc
 help / color / mirror / Atom feed
* [musl] [patch] posix_fallocate.3: add note about error codes for musl.
@ 2020-09-13  8:06 Érico Rolim
  2020-09-13 14:18 ` Rich Felker
  0 siblings, 1 reply; 5+ messages in thread
From: Érico Rolim @ 2020-09-13  8:06 UTC (permalink / raw)
  To: mtk.manpages; +Cc: linux-man, musl, ericonr

As can be seen in

https://git.musl-libc.org/cgit/musl/tree/src/fcntl/posix_fallocate.c?id=73cc775bee53300c7cf759f37580220b18ac13d3

musl returns the syscall's errors directly, which means it doesn't
perform the same emulation as glibc, and, more relevant to this change,
it can return more errors than the ones currently listed in ERRORS.
---
 man3/posix_fallocate.3 | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/man3/posix_fallocate.3 b/man3/posix_fallocate.3
index 58338d673..2e440b3e1 100644
--- a/man3/posix_fallocate.3
+++ b/man3/posix_fallocate.3
@@ -101,6 +101,10 @@ referred to by
 .B ESPIPE
 .I fd
 refers to a pipe.
+.TP
+Libraries that don't perform the emulation shown in NOTES, such as musl libc,
+may also return the error codes listed in
+.BR fallocate (2).
 .SH VERSIONS
 .BR posix_fallocate ()
 is available since glibc 2.1.94.
-- 
2.28.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [musl] [patch] posix_fallocate.3: add note about error codes for musl.
  2020-09-13  8:06 [musl] [patch] posix_fallocate.3: add note about error codes for musl Érico Rolim
@ 2020-09-13 14:18 ` Rich Felker
  2020-09-13 15:49   ` [musl] [PATCH v2] posix_fallocate.3: add EOPNOTSUPP error code Érico Rolim
  0 siblings, 1 reply; 5+ messages in thread
From: Rich Felker @ 2020-09-13 14:18 UTC (permalink / raw)
  To: Érico Rolim; +Cc: mtk.manpages, linux-man, musl, ericonr

On Sun, Sep 13, 2020 at 05:06:25AM -0300, Érico Rolim wrote:
> As can be seen in
> 
> https://git.musl-libc.org/cgit/musl/tree/src/fcntl/posix_fallocate.c?id=73cc775bee53300c7cf759f37580220b18ac13d3
> 
> musl returns the syscall's errors directly, which means it doesn't
> perform the same emulation as glibc, and, more relevant to this change,
> it can return more errors than the ones currently listed in ERRORS.
> ---
>  man3/posix_fallocate.3 | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/man3/posix_fallocate.3 b/man3/posix_fallocate.3
> index 58338d673..2e440b3e1 100644
> --- a/man3/posix_fallocate.3
> +++ b/man3/posix_fallocate.3
> @@ -101,6 +101,10 @@ referred to by
>  .B ESPIPE
>  .I fd
>  refers to a pipe.
> +.TP
> +Libraries that don't perform the emulation shown in NOTES, such as musl libc,
> +may also return the error codes listed in
> +.BR fallocate (2).
>  .SH VERSIONS
>  .BR posix_fallocate ()
>  is available since glibc 2.1.94.
> -- 
> 2.28.0

I think this should be documented the other way around -- adding
EOPNOTSUPP to the list of errors, with a note that applications may
not see the error due to emulation by glibc, but should be prepared to
handle it. The emulation glibc does is highly unsafe (can corrupt the
file -- see https://sourceware.org/bugzilla/show_bug.cgi?id=15661) and
the only reason it wasn't removed was that software had come to rely
on it being there, in part due to lack of documentation otherwise. If
that's fixed, it's possible that glibc could eventually fix this bug
with a new symbol version.

Rich

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [musl] [PATCH v2] posix_fallocate.3: add EOPNOTSUPP error code.
  2020-09-13 14:18 ` Rich Felker
@ 2020-09-13 15:49   ` Érico Rolim
  2020-10-26 23:21     ` [musl] Re: [PATCH v3] " Érico Rolim
  0 siblings, 1 reply; 5+ messages in thread
From: Érico Rolim @ 2020-09-13 15:49 UTC (permalink / raw)
  To: mtk.manpages; +Cc: linux-man, musl, ericonr

As can be seen in

https://git.musl-libc.org/cgit/musl/tree/src/fcntl/posix_fallocate.c?id=73cc775bee53300c7cf759f37580220b18ac13d3

musl libc returns the syscall's errors directly, which means it doesn't
perform the same emulation as glibc, and can return EOPNOTSUPP to an
application, which isnt't listed in ERRORS.
---

This patch replaces "[patch] posix_fallocate.3: add note about error
codes for musl." from
https://lore.kernel.org/linux-man/CAFDeuWPmWWHatxnZ9HsYN2fp3gagHOKCsKmVDj0F6us9XWKwFQ@mail.gmail.com/T/#t

posix_fallocate(3p) doesn't list EOPNOTSUPP as an error that can be
returned to applications. Should it be noted in the man page that this
is something added/required by Linux? (I might be mistaken regarding
this assumption).

 man3/posix_fallocate.3 | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/man3/posix_fallocate.3 b/man3/posix_fallocate.3
index 58338d673..125bcc12b 100644
--- a/man3/posix_fallocate.3
+++ b/man3/posix_fallocate.3
@@ -98,6 +98,13 @@ There is not enough space left on the device
containing the file
 referred to by
 .IR fd .
 .TP
+.B EOPNOTSUPP
+The filesystem containing the file referred to by
+.IR fd
+does not support this operation.
+This error code can be returned by libc's that don't perform the
+emulation shown in NOTES, such as musl libc.
+.TP
 .B ESPIPE
 .I fd
 refers to a pipe.
-- 
2.28.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [musl] Re: [PATCH v3] posix_fallocate.3: add EOPNOTSUPP error code.
  2020-09-13 15:49   ` [musl] [PATCH v2] posix_fallocate.3: add EOPNOTSUPP error code Érico Rolim
@ 2020-10-26 23:21     ` Érico Rolim
  2020-10-27  7:02       ` Michael Kerrisk (man-pages)
  0 siblings, 1 reply; 5+ messages in thread
From: Érico Rolim @ 2020-10-26 23:21 UTC (permalink / raw)
  To: mtk.manpages; +Cc: linux-man, musl, ericonr

As can be seen in

https://git.musl-libc.org/cgit/musl/tree/src/fcntl/posix_fallocate.c?id=73cc775bee53300c7cf759f37580220b18ac13d3

musl libc returns the syscall's errors directly, which means it doesn't
perform the same emulation as glibc, and can return EOPNOTSUPP to an
application, which isnt't listed in ERRORS.
---

Made a small correction to the formatting for fd.

 man3/posix_fallocate.3 | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/man3/posix_fallocate.3 b/man3/posix_fallocate.3
index 3152dd54f..8ea37261a 100644
--- a/man3/posix_fallocate.3
+++ b/man3/posix_fallocate.3
@@ -98,6 +98,13 @@ There is not enough space left on the device
containing the file
 referred to by
 .IR fd .
 .TP
+.B EOPNOTSUPP
+The filesystem containing the file referred to by
+.I fd
+does not support this operation.
+This error code can be returned by libc's that don't perform the
+emulation shown in NOTES, such as musl libc.
+.TP
 .B ESPIPE
 .I fd
 refers to a pipe.
-- 
2.29.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [musl] Re: [PATCH v3] posix_fallocate.3: add EOPNOTSUPP error code.
  2020-10-26 23:21     ` [musl] Re: [PATCH v3] " Érico Rolim
@ 2020-10-27  7:02       ` Michael Kerrisk (man-pages)
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Kerrisk (man-pages) @ 2020-10-27  7:02 UTC (permalink / raw)
  To: Érico Rolim; +Cc: mtk.manpages, linux-man, musl, ericonr

Hello Éric,

On 10/27/20 12:21 AM, Érico Rolim wrote:
> As can be seen in
> 
> https://git.musl-libc.org/cgit/musl/tree/src/fcntl/posix_fallocate.c?id=73cc775bee53300c7cf759f37580220b18ac13d3
> 
> musl libc returns the syscall's errors directly, which means it doesn't
> perform the same emulation as glibc, and can return EOPNOTSUPP to an
> application, which isnt't listed in ERRORS.

Thanks. Patch applied.

(By the way, your mailer is wrapping text in the patch;
I manually fixed.)

Thanks,

Michael

> ---
> 
> Made a small correction to the formatting for fd.
> 
>  man3/posix_fallocate.3 | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/man3/posix_fallocate.3 b/man3/posix_fallocate.3
> index 3152dd54f..8ea37261a 100644
> --- a/man3/posix_fallocate.3
> +++ b/man3/posix_fallocate.3
> @@ -98,6 +98,13 @@ There is not enough space left on the device
> containing the file
>  referred to by
>  .IR fd .
>  .TP
> +.B EOPNOTSUPP
> +The filesystem containing the file referred to by
> +.I fd
> +does not support this operation.
> +This error code can be returned by libc's that don't perform the
> +emulation shown in NOTES, such as musl libc.
> +.TP
>  .B ESPIPE
>  .I fd
>  refers to a pipe.
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-10-27  7:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-13  8:06 [musl] [patch] posix_fallocate.3: add note about error codes for musl Érico Rolim
2020-09-13 14:18 ` Rich Felker
2020-09-13 15:49   ` [musl] [PATCH v2] posix_fallocate.3: add EOPNOTSUPP error code Érico Rolim
2020-10-26 23:21     ` [musl] Re: [PATCH v3] " Érico Rolim
2020-10-27  7:02       ` Michael Kerrisk (man-pages)

mailing list of musl libc

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/musl

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 musl musl/ http://inbox.vuxu.org/musl \
		musl@inbox.vuxu.org
	public-inbox-index musl

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.musl


code repositories for the project(s) associated with this inbox:

	https://git.vuxu.org/mirror/musl/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git