diff options
Diffstat (limited to 'arch/s390/kernel/compat_linux.c')
-rw-r--r-- | arch/s390/kernel/compat_linux.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c index 614056222875..18610cea03a2 100644 --- a/arch/s390/kernel/compat_linux.c +++ b/arch/s390/kernel/compat_linux.c | |||
@@ -58,6 +58,7 @@ | |||
58 | #include <linux/compat.h> | 58 | #include <linux/compat.h> |
59 | #include <linux/vfs.h> | 59 | #include <linux/vfs.h> |
60 | #include <linux/ptrace.h> | 60 | #include <linux/ptrace.h> |
61 | #include <linux/fadvise.h> | ||
61 | 62 | ||
62 | #include <asm/types.h> | 63 | #include <asm/types.h> |
63 | #include <asm/ipc.h> | 64 | #include <asm/ipc.h> |
@@ -1043,3 +1044,40 @@ sys32_timer_create(clockid_t which_clock, struct compat_sigevent *se32, | |||
1043 | 1044 | ||
1044 | return ret; | 1045 | return ret; |
1045 | } | 1046 | } |
1047 | |||
1048 | /* | ||
1049 | * 31 bit emulation wrapper functions for sys_fadvise64/fadvise64_64. | ||
1050 | * These need to rewrite the advise values for POSIX_FADV_{DONTNEED,NOREUSE} | ||
1051 | * because the 31 bit values differ from the 64 bit values. | ||
1052 | */ | ||
1053 | |||
1054 | asmlinkage long | ||
1055 | sys32_fadvise64(int fd, loff_t offset, size_t len, int advise) | ||
1056 | { | ||
1057 | if (advise == 4) | ||
1058 | advise = POSIX_FADV_DONTNEED; | ||
1059 | else if (advise == 5) | ||
1060 | advise = POSIX_FADV_NOREUSE; | ||
1061 | return sys_fadvise64(fd, offset, len, advise); | ||
1062 | } | ||
1063 | |||
1064 | struct fadvise64_64_args { | ||
1065 | int fd; | ||
1066 | long long offset; | ||
1067 | long long len; | ||
1068 | int advice; | ||
1069 | }; | ||
1070 | |||
1071 | asmlinkage long | ||
1072 | sys32_fadvise64_64(struct fadvise64_64_args __user *args) | ||
1073 | { | ||
1074 | struct fadvise64_64_args a; | ||
1075 | |||
1076 | if ( copy_from_user(&a, args, sizeof(a)) ) | ||
1077 | return -EFAULT; | ||
1078 | if (a.advice == 4) | ||
1079 | a.advice = POSIX_FADV_DONTNEED; | ||
1080 | else if (a.advice == 5) | ||
1081 | a.advice = POSIX_FADV_NOREUSE; | ||
1082 | return sys_fadvise64_64(a.fd, a.offset, a.len, a.advice); | ||
1083 | } | ||