POSIX: lseek: support SEEK_DATA and SEEK_HOLE constants

this is queued for issue 8: https://www.austingroupbugs.net/view.php?id=415
this implementation calls the ioctl hook of the filesystem with BSD-like constants
FIOSEEKDATA and FIOSEEKHOLE. if the hook doesn't know the constants, we use the stat size
to return the last hole (as proposed in the draft spec).

Change-Id: I5d052eed87e29b70491a7ff534e244896469d03e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3385
Reviewed-by: Jérôme Duval <[email protected]>
This commit is contained in:
Jérôme Duval
2020-11-12 10:42:11 +00:00
parent fe357eb9c9
commit a9c09fcaae
3 changed files with 43 additions and 0 deletions
+3
View File
@@ -12,4 +12,7 @@
#define FIONBIO 0xbe000000
#define FIONREAD 0xbe000001
#define FIOSEEKDATA 0xbe000002
#define FIOSEEKHOLE 0xbe000003
#endif /* _SYS_IOCTL_H */
+6
View File
@@ -151,6 +151,12 @@
#ifndef SEEK_END
# define SEEK_END 2
#endif
#ifndef SEEK_DATA
# define SEEK_DATA 3
#endif
#ifndef SEEK_HOLE
# define SEEK_HOLE 4
#endif
#ifdef __cplusplus