From 94e77119e22496ec5e99a3b6e6b65b59a0392832 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Thu, 14 Aug 2003 10:06:03 -0700 Subject: [PATCH] [PATCH] sys_fadvise64_64 Alas, both POSIX and I got the fadvise() interface wrong. It needs to take a 64-bit length, not a 32-bit one. Because fadvise(POSIX_FADV_DONTNEED) on a 4TB file will require 1000 syscalls. Silly. There are glibc's in the wild which use the existing syscall, so we must make a new one. --- arch/i386/kernel/entry.S | 3 ++- include/asm-i386/unistd.h | 3 ++- mm/fadvise.c | 8 +++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S index 11fd358d27583..b832e3ed10d75 100644 --- a/arch/i386/kernel/entry.S +++ b/arch/i386/kernel/entry.S @@ -878,5 +878,6 @@ ENTRY(sys_call_table) .long sys_fstatfs64 .long sys_tgkill /* 270 */ .long sys_utimes - + .long sys_fadvise64_64 + nr_syscalls=(.-sys_call_table)/4 diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h index 5d123438d5265..f54d2da2e79d1 100644 --- a/include/asm-i386/unistd.h +++ b/include/asm-i386/unistd.h @@ -277,8 +277,9 @@ #define __NR_fstatfs64 269 #define __NR_tgkill 270 #define __NR_utimes 271 +#define __NR_fadvise64_64 272 -#define NR_syscalls 272 +#define NR_syscalls 273 /* user-visible error numbers are in the range -1 - -124: see */ diff --git a/mm/fadvise.c b/mm/fadvise.c index 8f1899604ac46..da7a5f31b941b 100644 --- a/mm/fadvise.c +++ b/mm/fadvise.c @@ -20,7 +20,7 @@ * POSIX_FADV_WILLNEED could set PG_Referenced, and POSIX_FADV_NOREUSE could * deactivate the pages and clear PG_Referenced. */ -long sys_fadvise64(int fd, loff_t offset, size_t len, int advice) +long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice) { struct file *file = fget(fd); struct inode *inode; @@ -79,3 +79,9 @@ out: fput(file); return ret; } + +long sys_fadvise64(int fd, loff_t offset, size_t len, int advice) +{ + return sys_fadvise64_64(fd, offset, len, advice); +} + -- 2.53.0