mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] [PATCH] add SEEK_DATA and SEEK_HOLE to <unistd.h>
@ 2021-12-17  7:59 Érico Nogueira
  2021-12-17  8:04 ` Érico Nogueira
  0 siblings, 1 reply; 2+ messages in thread
From: Érico Nogueira @ 2021-12-17  7:59 UTC (permalink / raw)
  To: musl; +Cc: Érico Nogueira

these are linux specific constants. glibc exposes them behind
_GNU_SOURCE, but, since SEEK_* is reserved for the implementation, we
can simply define them. furthermore, since they can't be used with
fseek() and other functions that deal with FILE, we don't add them to
<stdio.h>.
---
 include/unistd.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/unistd.h b/include/unistd.h
index ee2dbe8a..212263a7 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -14,6 +14,8 @@ extern "C" {
 #define SEEK_SET 0
 #define SEEK_CUR 1
 #define SEEK_END 2
+#define SEEK_DATA 3
+#define SEEK_HOLE 4
 
 #if __cplusplus >= 201103L
 #define NULL nullptr
-- 
2.34.1


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

* Re: [musl] [PATCH] add SEEK_DATA and SEEK_HOLE to <unistd.h>
  2021-12-17  7:59 [musl] [PATCH] add SEEK_DATA and SEEK_HOLE to <unistd.h> Érico Nogueira
@ 2021-12-17  8:04 ` Érico Nogueira
  0 siblings, 0 replies; 2+ messages in thread
From: Érico Nogueira @ 2021-12-17  8:04 UTC (permalink / raw)
  To: musl

On Fri Dec 17, 2021 at 4:59 AM -03, Érico Nogueira wrote:
> these are linux specific constants. glibc exposes them behind
> _GNU_SOURCE, but, since SEEK_* is reserved for the implementation, we
> can simply define them. furthermore, since they can't be used with
> fseek() and other functions that deal with FILE, we don't add them to
> <stdio.h>.

Since we are now adding these flags to headers, it might make sense to
revisit [1], which I came across while looking for patches related to
SEEK_* constants.

If all we need is to restrict acceptable whence values, I can try to
make a patch.

[1] https://inbox.vuxu.org/musl/20191024140649.GO16318@brightrain.aerifal.cx/

> ---
> include/unistd.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/include/unistd.h b/include/unistd.h
> index ee2dbe8a..212263a7 100644
> --- a/include/unistd.h
> +++ b/include/unistd.h
> @@ -14,6 +14,8 @@ extern "C" {
> #define SEEK_SET 0
> #define SEEK_CUR 1
> #define SEEK_END 2
> +#define SEEK_DATA 3
> +#define SEEK_HOLE 4
>  
> #if __cplusplus >= 201103L
> #define NULL nullptr
> --
> 2.34.1


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

end of thread, other threads:[~2021-12-17  8:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-17  7:59 [musl] [PATCH] add SEEK_DATA and SEEK_HOLE to <unistd.h> Érico Nogueira
2021-12-17  8:04 ` Érico Nogueira

Code repositories for project(s) associated with this inbox:

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).