[OPW,kernel] fs: Conditionally compile obsolete syscalls
diff mbox

Message ID 20150106223101.GA28165@winterfell
State New, archived
Headers show

Commit Message

Iulia Manda Jan. 6, 2015, 10:31 p.m. UTC
With this patch old_select, old_readdir and old_getrlimit syscalls are
conditionally compiled, as they are obsolete and needed only if a specific
arch needs them.

Bloat-o-meter output:

add/remove: 0/5 grow/shrink: 1/0 up/down: 128/-607 (-479)
function                                     old     new   delta
sys_select                                    28     156    +128
sys_old_select                                88       -     -88
sys_old_readdir                               96       -     -96
sys_old_getrlimit                            114       -    -114
SYSC_select                                  140       -    -140
fillonedir                                   169       -    -169

Signed-off-by: Iulia Manda <iulia.manda21@gmail.com>
---
 fs/compat.c     |    4 ++++
 fs/readdir.c    |    6 ++----
 fs/select.c     |    2 +-
 kernel/compat.c |    4 ++--
 kernel/sys.c    |    2 +-
 kernel/sys_ni.c |    6 ++++++
 6 files changed, 16 insertions(+), 8 deletions(-)

Patch
diff mbox

diff --git a/fs/compat.c b/fs/compat.c
index a185dc0..b3d8fd1 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -836,6 +836,7 @@  COMPAT_SYSCALL_DEFINE5(mount, const char __user *, dev_name,
 	return retval;
 }
 
+#ifdef CONFIG_OBSOLETE_SYSCALLS
 struct compat_old_linux_dirent {
 	compat_ulong_t	d_ino;
 	compat_ulong_t	d_offset;
@@ -903,6 +904,7 @@  COMPAT_SYSCALL_DEFINE3(old_readdir, unsigned int, fd,
 	fdput(f);
 	return error;
 }
+#endif /* CONFIG_OBSOLETE_SYSCALLS */
 
 struct compat_linux_dirent {
 	compat_ulong_t	d_ino;
@@ -1329,6 +1331,7 @@  COMPAT_SYSCALL_DEFINE5(select, int, n, compat_ulong_t __user *, inp,
 	return ret;
 }
 
+#ifdef CONFIG_OBSOLETE_SYSCALLS
 struct compat_sel_arg_struct {
 	compat_ulong_t n;
 	compat_uptr_t inp;
@@ -1346,6 +1349,7 @@  COMPAT_SYSCALL_DEFINE1(old_select, struct compat_sel_arg_struct __user *, arg)
 	return compat_sys_select(a.n, compat_ptr(a.inp), compat_ptr(a.outp),
 				 compat_ptr(a.exp), compat_ptr(a.tvp));
 }
+#endif
 
 static long do_compat_pselect(int n, compat_ulong_t __user *inp,
 	compat_ulong_t __user *outp, compat_ulong_t __user *exp,
diff --git a/fs/readdir.c b/fs/readdir.c
index ced6791..1c16e38 100644
--- a/fs/readdir.c
+++ b/fs/readdir.c
@@ -50,6 +50,7 @@  out:
 }
 EXPORT_SYMBOL(iterate_dir);
 
+#if defined( __ARCH_WANT_OLD_READDIR) && defined(CONFIG_OBSOLETE_SYSCALLS)
 /*
  * Traditional linux readdir() handling..
  *
@@ -58,9 +59,6 @@  EXPORT_SYMBOL(iterate_dir);
  * anyway. Thus the special "fillonedir()" function for that
  * case (the low-level handlers don't need to care about this).
  */
-
-#ifdef __ARCH_WANT_OLD_READDIR
-
 struct old_linux_dirent {
 	unsigned long	d_ino;
 	unsigned long	d_offset;
@@ -128,7 +126,7 @@  SYSCALL_DEFINE3(old_readdir, unsigned int, fd,
 	return error;
 }
 
-#endif /* __ARCH_WANT_OLD_READDIR */
+#endif /* __ARCH_WANT_OLD_READDIR && CONFIG_OBSOLETE_SYSCALLS */
 
 /*
  * New, all-improved, singing, dancing, iBCS2-compliant getdents()
diff --git a/fs/select.c b/fs/select.c
index 467bb1c..4912092 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -715,7 +715,7 @@  SYSCALL_DEFINE6(pselect6, int, n, fd_set __user *, inp, fd_set __user *, outp,
 	return do_pselect(n, inp, outp, exp, tsp, up, sigsetsize);
 }
 
-#ifdef __ARCH_WANT_SYS_OLD_SELECT
+#if defined(__ARCH_WANT_SYS_OLD_SELECT) && defined(CONFIG_OBSOLETE_SYSCALLS)
 struct sel_arg_struct {
 	unsigned long n;
 	fd_set __user *inp, *outp, *exp;
diff --git a/kernel/compat.c b/kernel/compat.c
index ebb3c36..3816e27 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -459,7 +459,7 @@  COMPAT_SYSCALL_DEFINE2(setrlimit, unsigned int, resource,
 	return do_prlimit(current, resource, &r, NULL);
 }
 
-#ifdef COMPAT_RLIM_OLD_INFINITY
+#if defined(COMPAT_RLIM_OLD_INFINITY) && defined(CONFIG_OBSOLETE_SYSCALLS)
 
 COMPAT_SYSCALL_DEFINE2(old_getrlimit, unsigned int, resource,
 		       struct compat_rlimit __user *, rlim)
@@ -486,7 +486,7 @@  COMPAT_SYSCALL_DEFINE2(old_getrlimit, unsigned int, resource,
 	return ret;
 }
 
-#endif
+#endif /* COMPAT_RLIM_OLD_INFINITY && CONFIG_OBSOLETE_SYSCALLS */
 
 COMPAT_SYSCALL_DEFINE2(getrlimit, unsigned int, resource,
 		       struct compat_rlimit __user *, rlim)
diff --git a/kernel/sys.c b/kernel/sys.c
index 4afaff7..a00c662 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1290,7 +1290,7 @@  SYSCALL_DEFINE2(getrlimit, unsigned int, resource, struct rlimit __user *, rlim)
 	return ret;
 }
 
-#ifdef __ARCH_WANT_SYS_OLD_GETRLIMIT
+#if defined(__ARCH_WANT_SYS_OLD_GETRLIMIT) && defined(CONFIG_OBSOLETE_SYSCALLS)
 
 /*
  *	Back compatibility for getrlimit. Needed for some apps.
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index 5954211..512081a 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -166,6 +166,12 @@  cond_syscall(sys_fstat);
 cond_syscall(sys_stat);
 cond_syscall(sys_uname);
 cond_syscall(sys_olduname);
+cond_syscall(sys_old_select);
+cond_syscall(compat_sys_old_select);
+cond_syscall(sys_old_readdir);
+cond_syscall(compat_sys_old_readdir);
+cond_syscall(sys_old_getrlimit);
+cond_syscall(compat_sys_old_getrlimit);
 
 /* arch-specific weak syscall entries */
 cond_syscall(sys_pciconfig_read);