summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2014-07-28 23:46:24 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2014-07-28 23:46:24 +0000
commitbf029485c1f3cf84d2fb0c74c38a1920d071c672 (patch)
tree076d18450ebe325353e7f6b3e2ba2dd372bad7a8 /usr/src
parentd7e43513756a4a20eaec77ea57ba7b7a796d937b (diff)
downloadillumos-joyent-bf029485c1f3cf84d2fb0c74c38a1920d071c672.tar.gz
OS-3257 ltp fadvise failures
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/lib/brand/lx/lx_brand/common/fcntl.c11
-rw-r--r--usr/src/lib/brand/lx/lx_brand/sys/lx_syscall.h2
2 files changed, 8 insertions, 5 deletions
diff --git a/usr/src/lib/brand/lx/lx_brand/common/fcntl.c b/usr/src/lib/brand/lx/lx_brand/common/fcntl.c
index 1afcba09c4..cc2a8b5d51 100644
--- a/usr/src/lib/brand/lx/lx_brand/common/fcntl.c
+++ b/usr/src/lib/brand/lx/lx_brand/common/fcntl.c
@@ -406,14 +406,17 @@ lx_flock(uintptr_t p1, uintptr_t p2)
* Based on Illumos posix_fadvise which does nothing. The only difference is
* that on Linux an fd refering to a pipe or FIFO returns EINVAL.
* The Linux POSIX_FADV_* values are the same as the Illumos values.
+ * See how glibc calls fadvise64; the offeset is a 64bit value, but the length
+ * is not, whereas fadvise64_64 passes both the offset and length as 64bit
+ * values.
*/
/* ARGSUSED */
int
-lx_fadvise64(uintptr_t p1, uintptr_t p2, uintptr_t p3, uintptr_t p4)
+lx_fadvise64(uintptr_t p1, off64_t p2, uintptr_t p3, uintptr_t p4)
{
int fd = (int)p1;
int advice = (int)p4;
- off_t len = (off_t)p3;
+ int32_t len = (int32_t)p3;
struct stat64 statb;
switch (advice) {
@@ -432,7 +435,7 @@ lx_fadvise64(uintptr_t p1, uintptr_t p2, uintptr_t p3, uintptr_t p4)
if (fstat64(fd, &statb) != 0)
return (-EBADF);
if (S_ISFIFO(statb.st_mode))
- return (-EINVAL);
+ return (-ESPIPE);
return (0);
}
@@ -443,5 +446,5 @@ lx_fadvise64_64(uintptr_t p1, off64_t p2, off64_t p3, uintptr_t p4)
if (p3 < 0)
return (-EINVAL);
- return (lx_fadvise64(p1, (uintptr_t)p2, (uintptr_t)p3, p4));
+ return (lx_fadvise64(p1, p2, 0, p4));
}
diff --git a/usr/src/lib/brand/lx/lx_brand/sys/lx_syscall.h b/usr/src/lib/brand/lx/lx_brand/sys/lx_syscall.h
index ba6a51d124..50abbd2c38 100644
--- a/usr/src/lib/brand/lx/lx_brand/sys/lx_syscall.h
+++ b/usr/src/lib/brand/lx/lx_brand/sys/lx_syscall.h
@@ -77,7 +77,7 @@ extern int lx_dup2(uintptr_t, uintptr_t);
extern int lx_dup3(uintptr_t, uintptr_t, uintptr_t);
extern int lx_ioctl(uintptr_t, uintptr_t, uintptr_t);
extern int lx_vhangup(void);
-extern int lx_fadvise64(uintptr_t, uintptr_t, uintptr_t, uintptr_t);
+extern int lx_fadvise64(uintptr_t, off64_t, uintptr_t, uintptr_t);
extern int lx_fadvise64_64(uintptr_t, off64_t, off64_t, uintptr_t);
extern int lx_read(uintptr_t, uintptr_t, uintptr_t);