Skip to content

Commit

Permalink
ZTS: small fix for SEEK_DATA/SEEK_HOLE tests (#16413)
Browse files Browse the repository at this point in the history
Some libc's like uClibc lag the proper definition of SEEK_DATA
and SEEK_HOLE. Since we have only two files in ZTS which use
these definitons, let's define them by hand:

```
#ifndef SEEK_DATA
#define SEEK_DATA 3
#endif
#ifndef SEEK_HOLE
#define SEEK_HOLE 4
#endif
```

There should be no failures, because:
- FreeBSD has support for SEEK_DATA/SEEK_HOLE since FreeBSD 8
- Linux has it since Linux 3.1
- the libc will submit the parameters unchanged to the kernel

Signed-off-by: Tino Reichardt <[email protected]>
Reviewed-by: Tony Hutter <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
  • Loading branch information
mcmilk authored Aug 7, 2024
1 parent cbcb522 commit bd949b1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/zfs-tests/cmd/mmap_seek.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@
#include <linux/fs.h>
#endif

/* some older uClibc's lack the defines, so we'll manually define them */
#ifdef __UCLIBC__
#ifndef SEEK_DATA
#define SEEK_DATA 3
#endif
#ifndef SEEK_HOLE
#define SEEK_HOLE 4
#endif
#endif

static void
seek_data(int fd, off_t offset, off_t expected)
{
Expand Down
7 changes: 7 additions & 0 deletions tests/zfs-tests/tests/functional/cp_files/seekflood.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@
#include <sys/stat.h>
#include <sys/wait.h>

/* some older uClibc's lack the defines, so we'll manually define them */
#ifdef __UCLIBC__
#ifndef SEEK_DATA
#define SEEK_DATA 3
#endif
#endif

#define DATASIZE (4096)
char data[DATASIZE];

Expand Down

0 comments on commit bd949b1

Please sign in to comment.