functional: add mntent test
[libc-test.git] / src / regression / lseek-large.c
blob6d79b2ccd5c47ee5737cb4e5d5cdf405be32ee45
1 // lseek should work with >2G offset
2 #include <stdio.h>
3 #include <sys/types.h>
4 #include <unistd.h>
5 #include <string.h>
6 #include <errno.h>
7 #include "test.h"
9 #define A(c) ((c) || (t_error(#c " failed: %s\n", strerror(errno)), 0))
11 int main(void)
13 off_t a[] = {0x7fffffff, 0x80000000, 0x80000001, 0xffffffff, 0x100000001, 0x1ffffffff, 0 };
14 off_t r;
15 FILE *f;
16 int fd;
17 int i;
19 A((f = tmpfile()) != 0);
20 A((fd = fileno(f)) != -1);
21 for (i = 0; a[i]; i++) {
22 r = lseek(fd, a[i], SEEK_SET);
23 if (r != a[i])
24 t_error("lseek(fd, 0x%llx, SEEK_SET) got 0x%llx\n", (long long)a[i], (long long)r);
26 return t_status;