All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fixing sendfile on 64bit architectures
@ 2004-05-19  9:49 Andi Kleen
  2004-05-19 12:21 ` Arnd Bergmann
  2004-05-19 18:17 ` David Mosberger
  0 siblings, 2 replies; 20+ messages in thread
From: Andi Kleen @ 2004-05-19  9:49 UTC (permalink / raw)
  To: linux-arch; +Cc: akpm



sys_sendfile has a hardcoded 2GB limit. 64bit architectures should probably
always use sys_sendfile64() in their native system tables, because
for them sizeof(off_t) == sizeof(loff_t).  This patch does
this. It seemed easier to just change the 64bit entry tables instead of 
fixing up all the emulation layers to do 2GB checks on their own.

I changed all 64bit architectures except for parisc64, which seemed to 
already have a sendfile64.

-Andi



diff -u linux/include/asm-x86_64/unistd.h-o linux/include/asm-x86_64/unistd.h
--- linux/include/asm-x86_64/unistd.h-o	2004-05-19 11:42:07.000000000 +0200
+++ linux/include/asm-x86_64/unistd.h	2004-05-19 11:42:15.000000000 +0200
@@ -98,7 +98,7 @@
 __SYSCALL(__NR_getpid, sys_getpid)
 
 #define __NR_sendfile                           40
-__SYSCALL(__NR_sendfile, sys_sendfile)
+__SYSCALL(__NR_sendfile, sys_sendfile64)
 #define __NR_socket                             41
 __SYSCALL(__NR_socket, sys_socket)
 #define __NR_connect                            42
diff -u linux/arch/sparc64/kernel/systbls.S-o linux/arch/sparc64/kernel/systbls.S
--- linux/arch/sparc64/kernel/systbls.S-o	2004-04-06 13:12:04.000000000 +0200
+++ linux/arch/sparc64/kernel/systbls.S	2004-05-19 11:45:58.000000000 +0200
@@ -88,7 +88,7 @@
 /*20*/	.word sys_getpid, sys_capget, sys_capset, sys_setuid, sys_getuid
 /*25*/	.word sys_nis_syscall, sys_ptrace, sys_alarm, sys_sigaltstack, sys_nis_syscall
 /*30*/	.word sys_utime, sys_nis_syscall, sys_nis_syscall, sys_access, sys_nice
-	.word sys_nis_syscall, sys_sync, sys_kill, sys_newstat, sys_sendfile
+	.word sys_nis_syscall, sys_sync, sys_kill, sys_newstat, sys_sendfile64
 /*40*/	.word sys_newlstat, sys_dup, sys_pipe, sys_times, sys_nis_syscall
 	.word sys_umount, sys_setgid, sys_getgid, sys_signal, sys_geteuid
 /*50*/	.word sys_getegid, sys_acct, sys_memory_ordering, sys_nis_syscall, sys_ioctl
diff -u linux/arch/ia64/kernel/entry.S-o linux/arch/ia64/kernel/entry.S
--- linux/arch/ia64/kernel/entry.S-o	2004-05-19 11:33:01.000000000 +0200
+++ linux/arch/ia64/kernel/entry.S	2004-05-19 11:42:26.000000000 +0200
@@ -1437,7 +1437,7 @@
 	data8 sys_getcwd
 	data8 sys_capget			// 1185
 	data8 sys_capset
-	data8 sys_sendfile
+	data8 sys_sendfile64
 	data8 sys_ni_syscall		// sys_getpmsg (STREAMS)
 	data8 sys_ni_syscall		// sys_putpmsg (STREAMS)
 	data8 sys_socket			// 1190
diff -u linux/arch/alpha/kernel/systbls.S-o linux/arch/alpha/kernel/systbls.S
--- linux/arch/alpha/kernel/systbls.S-o	1970-01-01 01:12:51.000000000 +0100
+++ linux/arch/alpha/kernel/systbls.S	2004-05-19 11:43:52.000000000 +0200
@@ -389,7 +389,7 @@
 	.quad sys_getcwd
 	.quad sys_capget
 	.quad sys_capset
-	.quad sys_sendfile			/* 370 */
+	.quad sys_sendfile64			/* 370 */
 	.quad sys_setresgid
 	.quad sys_getresgid
 	.quad sys_ni_syscall			/* sys_dipc */
diff -u linux/arch/mips/kernel/scall64-64.S-o linux/arch/mips/kernel/scall64-64.S
--- linux/arch/mips/kernel/scall64-64.S-o	1970-01-01 01:12:51.000000000 +0100
+++ linux/arch/mips/kernel/scall64-64.S	2004-05-19 11:44:22.000000000 +0200
@@ -244,7 +244,7 @@
 	PTR	sys_setitimer
 	PTR	sys_alarm
 	PTR	sys_getpid
-	PTR	sys_sendfile
+	PTR	sys_sendfile64
 	PTR	sys_socket			/* 5040 */
 	PTR	sys_connect
 	PTR	sys_accept
diff -u linux/arch/ppc64/kernel/misc.S-o linux/arch/ppc64/kernel/misc.S
--- linux/arch/ppc64/kernel/misc.S-o	2004-05-19 11:32:12.000000000 +0200
+++ linux/arch/ppc64/kernel/misc.S	2004-05-19 11:43:33.000000000 +0200
@@ -1061,7 +1061,7 @@
 	.llong .sys_capget
 	.llong .sys_capset
 	.llong .sys_sigaltstack	        /* 185 */
-	.llong .sys_sendfile
+	.llong .sys_sendfile64
 	.llong .sys_ni_syscall		/* reserved for streams1 */
 	.llong .sys_ni_syscall		/* reserved for streams2 */
 	.llong .sys_vfork

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] fixing sendfile on 64bit architectures
  2004-05-19  9:49 Andi Kleen
@ 2004-05-19 12:21 ` Arnd Bergmann
  2004-05-19 18:17 ` David Mosberger
  1 sibling, 0 replies; 20+ messages in thread
From: Arnd Bergmann @ 2004-05-19 12:21 UTC (permalink / raw)
  To: Andi Kleen; +Cc: linux-arch, akpm

[-- Attachment #1: Type: text/plain, Size: 855 bytes --]

On Wednesday 19 May 2004 11:49, Andi Kleen wrote:

> I changed all 64bit architectures except for parisc64, which seemed to 
> already have a sendfile64.

And it looks like you missed s390.

===== arch/s390/kernel/syscalls.S 1.11 vs edited =====
--- 1.11/arch/s390/kernel/syscalls.S	Thu Apr 29 11:41:09 2004
+++ edited/arch/s390/kernel/syscalls.S	Wed May 19 14:15:36 2004
@@ -195,7 +195,7 @@
 SYSCALL(sys_capget,sys_capget,sys32_capget_wrapper)
 SYSCALL(sys_capset,sys_capset,sys32_capset_wrapper)		/* 185 */
 SYSCALL(sys_sigaltstack_glue,sys_sigaltstack_glue,sys32_sigaltstack_glue)
-SYSCALL(sys_sendfile,sys_sendfile,sys32_sendfile_wrapper)
+SYSCALL(sys_sendfile,sys_sendfile64,sys32_sendfile_wrapper)
 NI_SYSCALL							/* streams1 */
 NI_SYSCALL							/* streams2 */
 SYSCALL(sys_vfork_glue,sys_vfork_glue,sys_vfork_glue)		/* 190 */

[-- Attachment #2: signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] fixing sendfile on 64bit architectures
  2004-05-19  9:49 Andi Kleen
  2004-05-19 12:21 ` Arnd Bergmann
@ 2004-05-19 18:17 ` David Mosberger
  2004-05-19 19:01   ` Andi Kleen
  1 sibling, 1 reply; 20+ messages in thread
From: David Mosberger @ 2004-05-19 18:17 UTC (permalink / raw)
  To: Andi Kleen; +Cc: linux-arch, akpm

>>>>> On Wed, 19 May 2004 11:49:40 +0200, Andi Kleen <ak@suse.de> said:

  Andi> sys_sendfile has a hardcoded 2GB limit. 64bit architectures
  Andi> should probably always use sys_sendfile64() in their native
  Andi> system tables, because for them sizeof(off_t) ==
  Andi> sizeof(loff_t).  This patch does this. It seemed easier to
  Andi> just change the 64bit entry tables instead of fixing up all
  Andi> the emulation layers to do 2GB checks on their own.

Argh, I had that fixed at one point (I think it was prior to
sys_sendfile64()) but it appears that got lost somewhere along the
line.  Thanks for (re-)catching this.

  Andi> I changed all 64bit architectures except for parisc64, which
  Andi> seemed to already have a sendfile64.

The patch looks fine to me.  My only minor quibble is that it would be
nice if sys_sendfile() wasn't defined at all when it isn't needed and,
in that case, do_sendfile() should be inlined (unit-at-a-time
compilation will take care of the inlining if sys_sendfile() isn't
defined when not needed, so that part doesn't require extra code).

I don't like adding yet another "#ifdef __ia64 && ..." though.  It
would be nice if there was a cleaner way to get rid of unwanted
syscall-stubs in generic code.  How would people feel about replacing
the current #ifdef mess with "#ifdef SYS_NEED_foo" instead?  By my
count, that would get rid of about a dozen of those ugly #ifdefs.  For
example, in fs/stat.c we could have:

#ifdef SYS_NEED_OLD_STAT

instead of:

#if !defined(__alpha__) && !defined(__sparc__) && !defined(__ia64__) \
  && !defined(CONFIG_ARCH_S390) && !defined(__hppa__) \
  && !defined(__arm__) && !defined(CONFIG_V850) && !defined(__powerpc64__) \
  && !defined(__mips__)

	--david

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] fixing sendfile on 64bit architectures
  2004-05-19 18:17 ` David Mosberger
@ 2004-05-19 19:01   ` Andi Kleen
  2004-05-19 19:13     ` David Mosberger
  0 siblings, 1 reply; 20+ messages in thread
From: Andi Kleen @ 2004-05-19 19:01 UTC (permalink / raw)
  To: davidm; +Cc: davidm, linux-arch, akpm

On Wed, 19 May 2004 11:17:44 -0700
David Mosberger <davidm@napali.hpl.hp.com> wrote:


> 
> The patch looks fine to me.  My only minor quibble is that it would be
> nice if sys_sendfile() wasn't defined at all when it isn't needed and,
> in that case, do_sendfile() should be inlined (unit-at-a-time
> compilation will take care of the inlining if sys_sendfile() isn't
> defined when not needed, so that part doesn't require extra code).

And I thought IA64 didn't care about code size... ;-)

> 
> I don't like adding yet another "#ifdef __ia64 && ..." though.  It
> would be nice if there was a cleaner way to get rid of unwanted
> syscall-stubs in generic code.  How would people feel about replacing
> the current #ifdef mess with "#ifdef SYS_NEED_foo" instead?  By my
> count, that would get rid of about a dozen of those ugly #ifdefs.  For
> example, in fs/stat.c we could have:
> 
> #ifdef SYS_NEED_OLD_STAT
> 
> instead of:
> 
> #if !defined(__alpha__) && !defined(__sparc__) && !defined(__ia64__) \
>   && !defined(CONFIG_ARCH_S390) && !defined(__hppa__) \
>   && !defined(__arm__) && !defined(CONFIG_V850) && !defined(__powerpc64__) \
>   && !defined(__mips__)

How about just putting it into an a extra file and using lib-y in the Makefile?

Then it will be only linked when someone references it.

-Andi

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] fixing sendfile on 64bit architectures
  2004-05-19 19:01   ` Andi Kleen
@ 2004-05-19 19:13     ` David Mosberger
  0 siblings, 0 replies; 20+ messages in thread
From: David Mosberger @ 2004-05-19 19:13 UTC (permalink / raw)
  To: Andi Kleen; +Cc: davidm, davidm, linux-arch, akpm

>>>>> On Wed, 19 May 2004 21:01:56 +0200, Andi Kleen <ak@suse.de> said:

  Andi> How about just putting it into an a extra file and using lib-y
  Andi> in the Makefile?

  Andi> Then it will be only linked when someone references it.

That may work in some cases, but usually the stubs depend on other
functions which are static only.  Moreover, putting them in separate
files prevents inlining.

	--david

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] fixing sendfile on 64bit architectures
@ 2004-05-19 19:26 Arnd Bergmann
  2004-05-20  6:19 ` David Mosberger
  0 siblings, 1 reply; 20+ messages in thread
From: Arnd Bergmann @ 2004-05-19 19:26 UTC (permalink / raw)
  To: davidm; +Cc: Andi Kleen, linux-arch, akpm


David Mosberger <davidm@napali.hpl.hp.com> schrieb am 19.05.2004,
20:17:44:

> The patch looks fine to me.  My only minor quibble is that it would be
> nice if sys_sendfile() wasn't defined at all when it isn't needed and,
> in that case, do_sendfile() should be inlined (unit-at-a-time
> compilation will take care of the inlining if sys_sendfile() isn't
> defined when not needed, so that part doesn't require extra code).

Note that we practically always need sys_sendfile anyway for calling
from sys32_sendfile. The only exception I can see is (CONFIG_64BIT &&
!CONFIG_COMPAT).
[OT: This reminds me that I have a bunch of mostly-finished compat_sys_*
consolidation patches on my disk that need to be completed. 
compat_sys_sendfile() could of course use do_sendfile() instead of
sys_sendfile().]

> I don't like adding yet another "#ifdef __ia64 && ..." though.  It
> would be nice if there was a cleaner way to get rid of unwanted
> syscall-stubs in generic code.  How would people feel about replacing
> the current #ifdef mess with "#ifdef SYS_NEED_foo" instead?  By my
> count, that would get rid of about a dozen of those ugly #ifdefs.  For
> example, in fs/stat.c we could have:
> 
> #ifdef SYS_NEED_OLD_STAT
> 
> instead of:
> 
> #if !defined(__alpha__) && !defined(__sparc__) && !defined(__ia64__) \
>   && !defined(CONFIG_ARCH_S390) && !defined(__hppa__) \
>   && !defined(__arm__) && !defined(CONFIG_V850) && !defined(__powerpc64__) \
>   && !defined(__mips__)

Seconded. While it may not be that drastic in case of sys_sendfile,
such constructions are always ugly and I suspect many of them would
turn out to be incorrect after closer inspection.

       Arnd <><

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] fixing sendfile on 64bit architectures
  2004-05-20  6:19 ` David Mosberger
@ 2004-05-20  6:41   ` David S. Miller
       [not found]     ` <16556.65456.624986.552865@napali.hpl.hp.com>
  0 siblings, 1 reply; 20+ messages in thread
From: David S. Miller @ 2004-05-20  6:41 UTC (permalink / raw)
  To: davidm; +Cc: davidm, arnd, ak, linux-arch, akpm

On Wed, 19 May 2004 23:19:55 -0700
David Mosberger <davidm@napali.hpl.hp.com> wrote:

> How about the attached?  I decided to use __ARCH_OMIT_foo instead
> of SYS_NEED_foo since that keeps the extra code in those platforms
> that want to drop the code.

This looks OK to me.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] fixing sendfile on 64bit architectures
       [not found]       ` <20040520120645.3accf048.akpm@osdl.org>
@ 2004-05-20 19:26         ` David Mosberger
  2004-05-20 19:35           ` Christoph Hellwig
  0 siblings, 1 reply; 20+ messages in thread
From: David Mosberger @ 2004-05-20 19:26 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

Andrew,

Below is a patch that tries to sanitize the dropping of unneeded
system-call stubs in generic code.  In some instances, it would be
possible to move the optional system-call stubs into a library routine
which would avoid the need for #ifdefs, but in many cases, doing so
would require making several functions global (and possibly exporting
additional data-structures in header-files).  Furthermore, it would
inhibit (automatic) inlining in the cases in the cases where the stubs
are needed.  For these reasons, the patch keeps the #ifdef-approach.

This has been tested on ia64 and there were no objections from the
arch-maintainers (and one positive response).  The patch should be
safe but arch-maintainers may want to take a second look to see if
additional __ARCH_OMIT_foo macros should be turned on for their
architecture (I'm quite sure that's the case, but I wanted to play it
safe and only preserved the status-quo in that regard).

Thanks,

	--david

===== fs/namespace.c 1.56 vs edited =====
--- 1.56/fs/namespace.c	Fri Apr 16 08:39:38 2004
+++ edited/fs/namespace.c	Wed May 19 22:48:45 2004
@@ -22,6 +22,7 @@
 #include <linux/security.h>
 #include <linux/mount.h>
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
 
 extern int __init init_rootfs(void);
 
@@ -406,6 +407,8 @@
 	return retval;
 }
 
+#ifndef __ARCH_OMIT_SYS_OLDUMOUNT
+
 /*
  *	The 2.0 compatible umount. No flags. 
  */
@@ -414,6 +417,8 @@
 {
 	return sys_umount(name,0);
 }
+
+#endif
 
 static int mount_is_safe(struct nameidata *nd)
 {
===== fs/open.c 1.61 vs edited =====
--- 1.61/fs/open.c	Mon Apr 12 10:54:51 2004
+++ edited/fs/open.c	Wed May 19 22:14:35 2004
@@ -23,6 +23,8 @@
 #include <linux/fs.h>
 #include <linux/pagemap.h>
 
+#include <asm/unistd.h>
+
 int vfs_statfs(struct super_block *sb, struct kstatfs *buf)
 {
 	int retval = -ENODEV;
@@ -335,7 +337,7 @@
 }
 #endif
 
-#if !(defined(__alpha__) || defined(__ia64__))
+#ifndef __ARCH_OMIT_SYS_UTIME
 
 /*
  * sys_utime() can be implemented in user-level using sys_utimes().
===== fs/read_write.c 1.38 vs edited =====
--- 1.38/fs/read_write.c	Sun Apr 18 10:51:24 2004
+++ edited/fs/read_write.c	Wed May 19 23:03:29 2004
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
 
 struct file_operations generic_ro_fops = {
 	.llseek		= generic_file_llseek,
@@ -145,7 +146,7 @@
 }
 EXPORT_SYMBOL_GPL(sys_lseek);
 
-#if !defined(__alpha__)
+#ifndef __ARCH_OMIT_SYS_LLSEEK
 asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high,
 			   unsigned long offset_low, loff_t __user * result,
 			   unsigned int origin)
===== fs/readdir.c 1.27 vs edited =====
--- 1.27/fs/readdir.c	Wed Mar 31 11:12:11 2004
+++ edited/fs/readdir.c	Wed May 19 21:20:38 2004
@@ -52,7 +52,7 @@
 #define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
 #define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1))
 
-#ifndef __ia64__
+#ifndef __ARCH_OMIT_OLD_READDIR
 
 struct old_linux_dirent {
 	unsigned long	d_ino;
@@ -115,7 +115,7 @@
 	return error;
 }
 
-#endif /* !__ia64__ */
+#endif /* !__ARCH_OMIT_OLD_READDIR */
 
 /*
  * New, all-improved, singing, dancing, iBCS2-compliant getdents()
===== fs/stat.c 1.32 vs edited =====
--- 1.32/fs/stat.c	Wed Apr 14 18:37:52 2004
+++ edited/fs/stat.c	Wed May 19 21:52:21 2004
@@ -16,6 +16,7 @@
 #include <linux/security.h>
 
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
 
 void generic_fillattr(struct inode *inode, struct kstat *stat)
 {
@@ -105,10 +106,7 @@
 
 EXPORT_SYMBOL(vfs_fstat);
 
-#if !defined(__alpha__) && !defined(__sparc__) && !defined(__ia64__) \
-  && !defined(CONFIG_ARCH_S390) && !defined(__hppa__) \
-  && !defined(__arm__) && !defined(CONFIG_V850) && !defined(__powerpc64__) \
-  && !defined(__mips__)
+#ifndef __ARCH_OMIT_OLD_STAT
 
 /*
  * For backward compatibility?  Maybe this should be moved
@@ -178,7 +176,7 @@
 	return error;
 }
 
-#endif
+#endif /* !__ARCH_OMIT_OLD_STAT */
 
 static int cp_new_stat(struct kstat *stat, struct stat __user *statbuf)
 {
@@ -284,7 +282,7 @@
 
 
 /* ---------- LFS-64 ----------- */
-#if !defined(__ia64__) && !defined(__mips64) && !defined(__x86_64__) && !defined(CONFIG_ARCH_S390X)
+#ifndef __ARCH_OMIT_STAT64
 
 static long cp_new_stat64(struct kstat *stat, struct stat64 __user *statbuf)
 {
@@ -352,7 +350,7 @@
 	return error;
 }
 
-#endif /* LFS-64 */
+#endif /* !__ARCH_OMIT_STAT64 */
 
 void inode_add_bytes(struct inode *inode, loff_t bytes)
 {
===== include/asm-alpha/signal.h 1.7 vs edited =====
--- 1.7/include/asm-alpha/signal.h	Sun Sep 21 14:50:25 2003
+++ edited/include/asm-alpha/signal.h	Wed May 19 21:42:00 2004
@@ -187,7 +187,6 @@
 #include <asm/sigcontext.h>
 
 #define ptrace_signal_deliver(regs, cookie) do { } while (0)
-#define HAVE_ARCH_SYS_PAUSE
 
 #endif
 
===== include/asm-alpha/unistd.h 1.27 vs edited =====
--- 1.27/include/asm-alpha/unistd.h	Mon May 10 21:27:30 2004
+++ edited/include/asm-alpha/unistd.h	Wed May 19 22:54:53 2004
@@ -558,6 +558,20 @@
 
 #endif /* __LIBRARY__ && __GNUC__ */
 
+#ifdef __KERNEL__
+#define __ARCH_OMIT_SYS_UTIME
+#define __ARCH_OMIT_OLD_STAT
+#define __ARCH_OMIT_SYS_WAITPID
+#define __ARCH_OMIT_SYS_SGETMASK
+#define __ARCH_OMIT_SYS_SIGNAL
+#define __ARCH_OMIT_SYS_PAUSE
+#define __ARCH_OMIT_SYS_TIME
+#define __ARCH_OMIT_SYS_ALARM
+#define __ARCH_OMIT_SYS_LLSEEK
+#define __ARCH_OMIT_SYS_NICE
+#define __ARCH_OMIT_SYS_SIGPROCMASK
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
===== include/asm-arm/unistd.h 1.23 vs edited =====
--- 1.23/include/asm-arm/unistd.h	Sat Feb 28 01:40:59 2004
+++ edited/include/asm-arm/unistd.h	Wed May 19 21:41:23 2004
@@ -448,6 +448,14 @@
   __syscall_return(type,__res);						\
 }
 
+#ifdef __KERNEL__
+#define __ARCH_OMIT_OLD_STAT
+#define __ARCH_OMIT_SYS_WAITPID
+#define __ARCH_OMIT_SYS_SGETMASK
+#define __ARCH_OMIT_SYS_SIGNAL
+#define __ARCH_OMIT_SYS_PAUSE
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
===== include/asm-ia64/signal.h 1.12 vs edited =====
--- 1.12/include/asm-ia64/signal.h	Fri Jan 23 10:52:25 2004
+++ edited/include/asm-ia64/signal.h	Wed May 19 21:42:14 2004
@@ -176,7 +176,6 @@
 #  include <asm/sigcontext.h>
 
 #define ptrace_signal_deliver(regs, cookie) do { } while (0)
-#define HAVE_ARCH_SYS_PAUSE
 
 #endif /* __KERNEL__ */
 
===== include/asm-ia64/unistd.h 1.41 vs edited =====
--- 1.41/include/asm-ia64/unistd.h	Mon May 10 23:44:41 2004
+++ edited/include/asm-ia64/unistd.h	Wed May 19 23:08:22 2004
@@ -4,7 +4,7 @@
 /*
  * IA-64 Linux syscall numbers and inline-functions.
  *
- * Copyright (C) 1998-2003 Hewlett-Packard Co
+ * Copyright (C) 1998-2004 Hewlett-Packard Co
  *	David Mosberger-Tang <davidm@hpl.hp.com>
  */
 
@@ -257,8 +257,36 @@
 #define __NR_mq_timedreceive		1265
 #define __NR_mq_notify			1266
 #define __NR_mq_getsetattr		1267
+#define __NR_kexec_load			1268
 
 #ifdef __KERNEL__
+
+#include <linux/config.h>
+
+#define __ARCH_OMIT_IPC_PARSE_VERSION
+#define __ARCH_OMIT_OLD_READDIR
+#define __ARCH_OMIT_OLD_STAT
+#define __ARCH_OMIT_STAT64
+#define __ARCH_OMIT_SYS_ALARM
+#define __ARCH_OMIT_SYS_GETHOSTNAME
+#define __ARCH_OMIT_SYS_PAUSE
+#define __ARCH_OMIT_SYS_SGETMASK
+#define __ARCH_OMIT_SYS_SIGNAL
+#define __ARCH_OMIT_SYS_TIME
+#define __ARCH_OMIT_SYS_UTIME
+#define __ARCH_OMIT_SYS_WAITPID
+#define __ARCH_OMIT_SYS_SOCKETCALL
+
+#ifndef CONFIG_IA32_SUPPORT
+# define __ARCH_OMIT_SYS_FADVISE64
+# define __ARCH_OMIT_SYS_GETPGRP
+# define __ARCH_OMIT_SYS_LLSEEK
+# define __ARCH_OMIT_SYS_NICE
+# define __ARCH_OMIT_SYS_OLD_GETRLIMIT
+# define __ARCH_OMIT_SYS_OLDUMOUNT
+# define __ARCH_OMIT_SYS_SIGPENDING
+# define __ARCH_OMIT_SYS_SIGPROCMASK
+#endif
 
 #define NR_syscalls			256 /* length of syscall table */
 
===== include/asm-mips/unistd.h 1.12 vs edited =====
--- 1.12/include/asm-mips/unistd.h	Wed Apr 21 14:35:59 2004
+++ edited/include/asm-mips/unistd.h	Wed May 19 21:36:41 2004
@@ -1045,6 +1045,14 @@
 
 #endif /* (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64) */
 
+#ifdef __KERNEL__
+#define __ARCH_OMIT_OLD_STAT
+#define __ARCH_OMIT_SYS_SIGNAL
+# ifdef __mips64
+#  define __ARCH_OMIT_STAT64
+# endif
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
===== include/asm-parisc/unistd.h 1.14 vs edited =====
--- 1.14/include/asm-parisc/unistd.h	Mon Mar 15 22:50:11 2004
+++ edited/include/asm-parisc/unistd.h	Wed May 19 21:31:07 2004
@@ -836,6 +836,10 @@
     return K_INLINE_SYSCALL(name, 6, arg1, arg2, arg3, arg4, arg5, arg6);	\
 }
 
+#ifdef __KERNEL__
+#define __ARCH_OMIT_OLD_STAT
+#define __ARCH_OMIT_IPC_PARSE_VERSION
+#endif
 
 #ifdef __KERNEL_SYSCALLS__
 
===== include/asm-ppc64/unistd.h 1.31 vs edited =====
--- 1.31/include/asm-ppc64/unistd.h	Wed Apr 21 14:35:59 2004
+++ edited/include/asm-ppc64/unistd.h	Wed May 19 21:24:30 2004
@@ -418,6 +418,8 @@
 #include <linux/compiler.h>
 #include <linux/linkage.h>
 
+#define __ARCH_OMIT_OLD_STAT
+
 unsigned long sys_mmap(unsigned long addr, size_t len, unsigned long prot,
 		       unsigned long flags, unsigned long fd, off_t offset);
 struct pt_regs;
===== include/asm-s390/unistd.h 1.26 vs edited =====
--- 1.26/include/asm-s390/unistd.h	Mon May 10 21:27:30 2004
+++ edited/include/asm-s390/unistd.h	Wed May 19 21:34:44 2004
@@ -512,6 +512,15 @@
 	__syscall_return(type,__res);			     \
 }
 
+#ifdef __KERNEL__
+#define __ARCH_OMIT_OLD_STAT
+#define __ARCH_OMIT_SYS_WAITPID
+#define __ARCH_OMIT_SYS_SGETMASK
+# ifdef CONFIG_ARCH_S390X
+#   define __ARCH_OMIT_STAT64
+# endif
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/config.h>
===== include/asm-sparc/unistd.h 1.32 vs edited =====
--- 1.32/include/asm-sparc/unistd.h	Wed Apr 21 14:36:00 2004
+++ edited/include/asm-sparc/unistd.h	Wed May 19 21:21:49 2004
@@ -431,6 +431,11 @@
 errno = -__res; \
 return -1; \
 }
+
+#ifdef __KERNEL__
+#define __ARCH_OMIT_OLD_STAT
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
===== include/asm-sparc64/signal.h 1.11 vs edited =====
--- 1.11/include/asm-sparc64/signal.h	Thu Feb 26 22:27:45 2004
+++ edited/include/asm-sparc64/signal.h	Wed May 19 21:42:34 2004
@@ -253,8 +253,6 @@
 struct pt_regs;
 extern void ptrace_signal_deliver(struct pt_regs *regs, void *cookie);
 
-#define HAVE_ARCH_SYS_PAUSE
-
 #endif /* !(__KERNEL__) */
 
 #endif /* !(__ASSEMBLY__) */
===== include/asm-sparc64/unistd.h 1.30 vs edited =====
--- 1.30/include/asm-sparc64/unistd.h	Wed Apr 21 14:36:00 2004
+++ edited/include/asm-sparc64/unistd.h	Wed May 19 21:42:40 2004
@@ -474,6 +474,10 @@
 #define   _SC_JOB_CONTROL         6
 #define   _SC_SAVED_IDS           7
 #define   _SC_VERSION             8
+
+#define __ARCH_OMIT_OLD_STAT
+#define __ARCH_OMIT_SYS_PAUSE
+
 #endif
 
 /*
===== include/asm-v850/unistd.h 1.9 vs edited =====
--- 1.9/include/asm-v850/unistd.h	Sat Feb 28 01:41:01 2004
+++ edited/include/asm-v850/unistd.h	Wed May 19 22:47:06 2004
@@ -386,6 +386,11 @@
 }
 		
 
+#ifdef __KERNEL__
+#define __ARCH_OMIT_OLD_STAT
+#define __ARCH_OMIT_SYS_OLD_GETRLIMIT
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
===== include/asm-x86_64/unistd.h 1.24 vs edited =====
--- 1.24/include/asm-x86_64/unistd.h	Wed Apr 21 14:36:00 2004
+++ edited/include/asm-x86_64/unistd.h	Wed May 19 21:30:57 2004
@@ -569,6 +569,11 @@
 	return (type) (res); \
 } while (0)
 
+#ifdef __KERNEL__
+#define __ARCH_OMIT_STAT64
+#define __ARCH_OMIT_IPC_PARSE_VERSION
+#endif
+
 #ifndef __KERNEL_SYSCALLS__
 
 #define __syscall "syscall"
===== ipc/util.c 1.17 vs edited =====
--- 1.17/ipc/util.c	Mon Apr 12 10:54:15 2004
+++ edited/ipc/util.c	Wed May 19 21:53:04 2004
@@ -25,6 +25,8 @@
 #include <linux/rcupdate.h>
 #include <linux/workqueue.h>
 
+#include <asm/unistd.h>
+
 #include "util.h"
 
 /**
@@ -507,7 +509,8 @@
 	return 0;
 }
 
-#if !defined(__ia64__) && !defined(__x86_64__) && !defined(__hppa__)
+#ifndef __ARCH_OMIT_IPC_PARSE_VERSION
+
 
 /**
  *	ipc_parse_version	-	IPC call version
@@ -528,4 +531,4 @@
 	}
 }
 
-#endif /* __ia64__ */
+#endif /* !__ARCH_OMIT_IPC_PARSE_VERSION */
===== kernel/exit.c 1.132 vs edited =====
--- 1.132/kernel/exit.c	Tue Apr 13 08:46:49 2004
+++ edited/kernel/exit.c	Wed May 19 22:19:33 2004
@@ -24,6 +24,7 @@
 #include <linux/proc_fs.h>
 
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
 #include <asm/pgtable.h>
 #include <asm/mmu_context.h>
 
@@ -1157,8 +1158,7 @@
 	return retval;
 }
 
-#if !defined(__alpha__) && !defined(__ia64__) && \
-    !defined(__arm__) && !defined(__s390__)
+#ifndef __ARCH_OMIT_SYS_WAITPID
 
 /*
  * sys_waitpid() remains for compatibility. waitpid() should be
===== kernel/sched.c 1.218 vs edited =====
--- 1.218/kernel/sched.c	Thu Apr 29 14:00:38 2004
+++ edited/kernel/sched.c	Wed May 19 23:03:52 2004
@@ -40,6 +40,8 @@
 #include <linux/percpu.h>
 #include <linux/kthread.h>
 
+#include <asm/unistd.h>
+
 #ifdef CONFIG_NUMA
 #define cpu_to_node_mask(cpu) node_to_cpumask(cpu_to_node(cpu))
 #else
@@ -2015,7 +2017,7 @@
 
 EXPORT_SYMBOL(set_user_nice);
 
-#ifndef __alpha__
+#ifndef __ARCH_OMIT_SYS_NICE
 
 /*
  * sys_nice - change the priority of the current process.
===== kernel/signal.c 1.108 vs edited =====
--- 1.108/kernel/signal.c	Wed Apr 21 14:36:02 2004
+++ edited/kernel/signal.c	Wed May 19 23:07:51 2004
@@ -23,6 +23,7 @@
 #include <linux/ptrace.h>
 #include <asm/param.h>
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
 #include <asm/siginfo.h>
 
 /*
@@ -2412,14 +2413,19 @@
 	return error;
 }
 
+#ifndef __ARCH_OMIT_SYS_SIGPENDING
+
 asmlinkage long
 sys_sigpending(old_sigset_t __user *set)
 {
 	return do_sigpending(set, sizeof(*set));
 }
 
-#if !defined(__alpha__)
-/* Alpha has its own versions with special arguments.  */
+#endif
+
+#ifndef __ARCH_OMIT_SYS_SIGPROCMASK
+/* Some platforms have their own version with special arguments others
+   support only sys_rt_sigprocmask.  */
 
 asmlinkage long
 sys_sigprocmask(int how, old_sigset_t __user *set, old_sigset_t __user *oset)
@@ -2501,8 +2507,8 @@
 #endif /* __sparc__ */
 #endif
 
-#if !defined(__alpha__) && !defined(__ia64__) && \
-    !defined(__arm__) && !defined(__s390__)
+#ifndef __ARCH_OMIT_SYS_SGETMASK
+
 /*
  * For backwards compatibility.  Functionality superseded by sigprocmask.
  */
@@ -2528,10 +2534,9 @@
 
 	return old;
 }
-#endif /* !defined(__alpha__) */
+#endif /* !__ARCH_OMIT_SGETMASK */
 
-#if !defined(__alpha__) && !defined(__ia64__) && !defined(__mips__) && \
-    !defined(__arm__)
+#ifndef __ARCH_OMIT_SYS_SIGNAL
 /*
  * For backwards compatibility.  Functionality superseded by sigaction.
  */
@@ -2548,9 +2553,9 @@
 
 	return ret ? ret : (unsigned long)old_sa.sa.sa_handler;
 }
-#endif /* !alpha && !__ia64__ && !defined(__mips__) && !defined(__arm__) */
+#endif /* !__ARCH_OMIT_SYS_SIGNAL */
 
-#ifndef HAVE_ARCH_SYS_PAUSE
+#ifndef __ARCH_OMIT_SYS_PAUSE
 
 asmlinkage long
 sys_pause(void)
@@ -2560,7 +2565,7 @@
 	return -ERESTARTNOHAND;
 }
 
-#endif /* HAVE_ARCH_SYS_PAUSE */
+#endif
 
 void __init signals_init(void)
 {
===== kernel/sys.c 1.59 vs edited =====
--- 1.59/kernel/sys.c	Wed Apr 21 14:36:02 2004
+++ edited/kernel/sys.c	Wed May 19 22:47:11 2004
@@ -1056,12 +1056,16 @@
 	}
 }
 
+#ifndef __ARCH_OMIT_SYS_GETPGRP
+
 asmlinkage long sys_getpgrp(void)
 {
 	/* SMP - assuming writes are word atomic this is fine */
 	return process_group(current);
 }
 
+#endif
+
 asmlinkage long sys_getsid(pid_t pid)
 {
 	if (!pid) {
@@ -1402,6 +1406,8 @@
 	return errno;
 }
 
+#ifndef __ARCH_OMIT_SYS_GETHOSTNAME
+
 asmlinkage long sys_gethostname(char __user *name, int len)
 {
 	int i, errno;
@@ -1419,6 +1425,8 @@
 	return errno;
 }
 
+#endif
+
 /*
  * Only setdomainname; getdomainname can be implemented by calling
  * uname()
@@ -1453,7 +1461,7 @@
 			? -EFAULT : 0;
 }
 
-#if defined(COMPAT_RLIM_OLD_INFINITY) || !(defined(CONFIG_IA64) || defined(CONFIG_V850))
+#ifndef __ARCH_OMIT_SYS_OLD_GETRLIMIT
 
 /*
  *	Back compatibility for getrlimit. Needed for some apps.
===== kernel/time.c 1.20 vs edited =====
--- 1.20/kernel/time.c	Wed Apr 21 14:36:02 2004
+++ edited/kernel/time.c	Wed May 19 22:13:09 2004
@@ -29,6 +29,7 @@
 #include <linux/errno.h>
 #include <linux/smp_lock.h>
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
 
 /* 
  * The timezone where the local system is located.  Used as a default by some
@@ -38,7 +39,7 @@
 
 EXPORT_SYMBOL(sys_tz);
 
-#if !defined(__alpha__) && !defined(__ia64__)
+#ifndef __ARCH_OMIT_SYS_TIME
 
 /*
  * sys_time() can be implemented in user-level using
@@ -84,7 +85,7 @@
 	return 0;
 }
 
-#endif
+#endif /* !__ARCH_OMIT_SYS_TIME */
 
 asmlinkage long sys_gettimeofday(struct timeval __user *tv, struct timezone __user *tz)
 {
===== kernel/timer.c 1.79 vs edited =====
--- 1.79/kernel/timer.c	Thu Apr 29 14:00:38 2004
+++ edited/kernel/timer.c	Wed May 19 22:11:22 2004
@@ -33,6 +33,7 @@
 #include <linux/cpu.h>
 
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
 #include <asm/div64.h>
 #include <asm/timex.h>
 
@@ -918,7 +919,7 @@
 	update_times();
 }
 
-#if !defined(__alpha__) && !defined(__ia64__)
+#ifndef __ARCH_OMIT_SYS_ALARM
 
 /*
  * For backwards compatibility?  This can be done in libc so Alpha
===== mm/fadvise.c 1.13 vs edited =====
--- 1.13/mm/fadvise.c	Fri Apr 30 21:28:49 2004
+++ edited/mm/fadvise.c	Wed May 19 22:25:16 2004
@@ -16,6 +16,8 @@
 #include <linux/pagevec.h>
 #include <linux/fadvise.h>
 
+#include <asm/unistd.h>
+
 /*
  * POSIX_FADV_WILLNEED could set PG_Referenced, and POSIX_FADV_NOREUSE could
  * deactivate the pages and clear PG_Referenced.
@@ -98,8 +100,11 @@
 	return ret;
 }
 
+#ifndef __ARCH_OMIT_SYS_FADVISE64
+
 asmlinkage long sys_fadvise64(int fd, loff_t offset, size_t len, int advice)
 {
 	return sys_fadvise64_64(fd, offset, len, advice);
 }
 
+#endif
===== net/socket.c 1.77 vs edited =====
--- 1.77/net/socket.c	Sat May  8 16:00:54 2004
+++ edited/net/socket.c	Wed May 19 22:59:20 2004
@@ -87,6 +87,8 @@
 #endif	/* CONFIG_NET_RADIO */
 
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
+
 #include <net/compat.h>
 
 #include <net/sock.h>
@@ -1817,6 +1819,8 @@
 	return err;
 }
 
+#ifndef __ARCH_OMIT_SYS_SOCKETCALL
+
 /* Argument list sizes for sys_socketcall */
 #define AL(x) ((x) * sizeof(unsigned long))
 static unsigned char nargs[18]={AL(0),AL(3),AL(3),AL(3),AL(2),AL(3),
@@ -1909,6 +1913,8 @@
 	}
 	return err;
 }
+
+#endif /* !__ARCH_OMIT_SYS_SOCKETCALL */
 
 /*
  *	This function is called by a protocol handler that wants to

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] fixing sendfile on 64bit architectures
  2004-05-20 19:26         ` David Mosberger
@ 2004-05-20 19:35           ` Christoph Hellwig
  2004-05-20 20:17             ` David Mosberger
  0 siblings, 1 reply; 20+ messages in thread
From: Christoph Hellwig @ 2004-05-20 19:35 UTC (permalink / raw)
  To: davidm; +Cc: Andrew Morton, linux-kernel

On Thu, May 20, 2004 at 12:26:43PM -0700, David Mosberger wrote:
> Andrew,
> 
> Below is a patch that tries to sanitize the dropping of unneeded
> system-call stubs in generic code.  In some instances, it would be
> possible to move the optional system-call stubs into a library routine
> which would avoid the need for #ifdefs, but in many cases, doing so
> would require making several functions global (and possibly exporting
> additional data-structures in header-files).  Furthermore, it would
> inhibit (automatic) inlining in the cases in the cases where the stubs
> are needed.  For these reasons, the patch keeps the #ifdef-approach.
> 
> This has been tested on ia64 and there were no objections from the
> arch-maintainers (and one positive response).  The patch should be
> safe but arch-maintainers may want to take a second look to see if
> additional __ARCH_OMIT_foo macros should be turned on for their
> architecture (I'm quite sure that's the case, but I wanted to play it
> safe and only preserved the status-quo in that regard).

IMHO this is exactly the wrong way around.  It should be __ARCH_WANT_*
or something like that so new architectures don't carry the old garbage
around by default.  There's far too many new architectures keeping old
syscalls by accident.


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] fixing sendfile on 64bit architectures
  2004-05-20 19:35           ` Christoph Hellwig
@ 2004-05-20 20:17             ` David Mosberger
  2004-05-20 21:56               ` Andrew Morton
  0 siblings, 1 reply; 20+ messages in thread
From: David Mosberger @ 2004-05-20 20:17 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: davidm, Andrew Morton, linux-kernel

>>>>> On Thu, 20 May 2004 20:35:32 +0100, Christoph Hellwig <hch@infradead.org> said:

  Christoph> IMHO this is exactly the wrong way around.  It should be
  Christoph> __ARCH_WANT_* or something like that so new architectures
  Christoph> don't carry the old garbage around by default.  There's
  Christoph> far too many new architectures keeping old syscalls by
  Christoph> accident.

Feel free to do that.  I was trying not to break anything and I'm
_certain_ I would have gotten it wrong if I had reversed the sense.

I think the current patch is an improvement, so unless someone comes
up with something better, I'd like to see it applied.

	--david

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] fixing sendfile on 64bit architectures
  2004-05-20 20:17             ` David Mosberger
@ 2004-05-20 21:56               ` Andrew Morton
  2004-05-20 22:00                 ` David Mosberger
                                   ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Andrew Morton @ 2004-05-20 21:56 UTC (permalink / raw)
  To: davidm; +Cc: hch, linux-kernel

David Mosberger <davidm@napali.hpl.hp.com> wrote:
>
> >>>>> On Thu, 20 May 2004 20:35:32 +0100, Christoph Hellwig <hch@infradead.org> said:
> 
>   Christoph> IMHO this is exactly the wrong way around.  It should be
>   Christoph> __ARCH_WANT_* or something like that so new architectures
>   Christoph> don't carry the old garbage around by default.  There's
>   Christoph> far too many new architectures keeping old syscalls by
>   Christoph> accident.
> 
> Feel free to do that.  I was trying not to break anything and I'm
> _certain_ I would have gotten it wrong if I had reversed the sense.
> 
> I think the current patch is an improvement, so unless someone comes
> up with something better, I'd like to see it applied.

I do agree that ARCH_WANT_FOO is easier to understand and more idiomatic.

An alternative might be to remove all the ifdefs, build with
-ffunction-sections and let the linker drop any unreferenced code...

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] fixing sendfile on 64bit architectures
  2004-05-20 21:56               ` Andrew Morton
@ 2004-05-20 22:00                 ` David Mosberger
  2004-05-20 22:09                 ` David Mosberger
  2004-05-20 22:10                 ` Jesse Barnes
  2 siblings, 0 replies; 20+ messages in thread
From: David Mosberger @ 2004-05-20 22:00 UTC (permalink / raw)
  To: Andrew Morton; +Cc: davidm, hch, linux-kernel

>>>>> On Thu, 20 May 2004 14:56:58 -0700, Andrew Morton <akpm@osdl.org> said:

  >> I think the current patch is an improvement, so unless someone
  >> comes up with something better, I'd like to see it applied.

  Andrew> I do agree that ARCH_WANT_FOO is easier to understand and
  Andrew> more idiomatic.

That is true.  Actually, now that I have ARCH_OMIT, it's pretty easy
to write a script to do the complement, so the risk of introducing
errors is quite small.  Let me see what this looks like.

  Andrew> An alternative might be to remove all the ifdefs, build with
  Andrew> -ffunction-sections and let the linker drop any unreferenced
  Andrew> code...

Yeah, that might be an option.  -ffunction-sections does bad things to
link-time, though, and I'm not sure I like the idea of having a
bazillion of tiny little sections.

	--david

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] fixing sendfile on 64bit architectures
  2004-05-20 21:56               ` Andrew Morton
  2004-05-20 22:00                 ` David Mosberger
@ 2004-05-20 22:09                 ` David Mosberger
  2004-05-20 23:30                   ` Andrew Morton
  2004-05-20 22:10                 ` Jesse Barnes
  2 siblings, 1 reply; 20+ messages in thread
From: David Mosberger @ 2004-05-20 22:09 UTC (permalink / raw)
  To: Andrew Morton; +Cc: davidm, hch, linux-kernel

>>>>> On Thu, 20 May 2004 14:56:58 -0700, Andrew Morton <akpm@osdl.org> said:

  Andrew> I do agree that ARCH_WANT_FOO is easier to understand and
  Andrew> more idiomatic.

Here is what the reversed-sense patch looks like (mostly autogenerated
via a script).  There are several platforms which do not drop any
syscalls.  If it's expected to stay that way, then it might make sense
to add asm-generic/unistd.h to collect the necessary #defines in a
single place.

	--david

Below is a patch that tries to sanitize the dropping of unneeded
system-call stubs in generic code.  In some instances, it would be
possible to move the optional system-call stubs into a library routine
which would avoid the need for #ifdefs, but in many cases, doing so
would require making several functions global (and possibly exporting
additional data-structures in header-files).  Furthermore, it would
inhibit (automatic) inlining in the cases in the cases where the stubs
are needed.  For these reasons, the patch keeps the #ifdef-approach.

This has been tested on ia64 and there were no objections from the
arch-maintainers (and one positive response).  The patch should be
safe but arch-maintainers may want to take a second look to see if
some __ARCH_WANT_foo macros should be removed for their architecture
(I'm quite sure that's the case, but I wanted to play it safe and only
preserved the status-quo in that regard).

===== fs/namespace.c 1.56 vs edited =====
--- 1.56/fs/namespace.c	Fri Apr 16 08:39:38 2004
+++ edited/fs/namespace.c	Thu May 20 14:56:37 2004
@@ -22,6 +22,7 @@
 #include <linux/security.h>
 #include <linux/mount.h>
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
 
 extern int __init init_rootfs(void);
 
@@ -406,6 +407,8 @@
 	return retval;
 }
 
+#ifdef __ARCH_WANT_SYS_OLDUMOUNT
+
 /*
  *	The 2.0 compatible umount. No flags. 
  */
@@ -414,6 +417,8 @@
 {
 	return sys_umount(name,0);
 }
+
+#endif
 
 static int mount_is_safe(struct nameidata *nd)
 {
===== fs/open.c 1.61 vs edited =====
--- 1.61/fs/open.c	Mon Apr 12 10:54:51 2004
+++ edited/fs/open.c	Thu May 20 14:56:37 2004
@@ -23,6 +23,8 @@
 #include <linux/fs.h>
 #include <linux/pagemap.h>
 
+#include <asm/unistd.h>
+
 int vfs_statfs(struct super_block *sb, struct kstatfs *buf)
 {
 	int retval = -ENODEV;
@@ -335,7 +337,7 @@
 }
 #endif
 
-#if !(defined(__alpha__) || defined(__ia64__))
+#ifdef __ARCH_WANT_SYS_UTIME
 
 /*
  * sys_utime() can be implemented in user-level using sys_utimes().
===== fs/read_write.c 1.38 vs edited =====
--- 1.38/fs/read_write.c	Sun Apr 18 10:51:24 2004
+++ edited/fs/read_write.c	Thu May 20 14:56:37 2004
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
 
 struct file_operations generic_ro_fops = {
 	.llseek		= generic_file_llseek,
@@ -145,7 +146,7 @@
 }
 EXPORT_SYMBOL_GPL(sys_lseek);
 
-#if !defined(__alpha__)
+#ifdef __ARCH_WANT_SYS_LLSEEK
 asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high,
 			   unsigned long offset_low, loff_t __user * result,
 			   unsigned int origin)
===== fs/readdir.c 1.27 vs edited =====
--- 1.27/fs/readdir.c	Wed Mar 31 11:12:11 2004
+++ edited/fs/readdir.c	Thu May 20 14:56:37 2004
@@ -52,7 +52,7 @@
 #define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
 #define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1))
 
-#ifndef __ia64__
+#ifdef __ARCH_WANT_OLD_READDIR
 
 struct old_linux_dirent {
 	unsigned long	d_ino;
@@ -115,7 +115,7 @@
 	return error;
 }
 
-#endif /* !__ia64__ */
+#endif /* __ARCH_WANT_OLD_READDIR */
 
 /*
  * New, all-improved, singing, dancing, iBCS2-compliant getdents()
===== fs/stat.c 1.32 vs edited =====
--- 1.32/fs/stat.c	Wed Apr 14 18:37:52 2004
+++ edited/fs/stat.c	Thu May 20 14:56:37 2004
@@ -16,6 +16,7 @@
 #include <linux/security.h>
 
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
 
 void generic_fillattr(struct inode *inode, struct kstat *stat)
 {
@@ -105,10 +106,7 @@
 
 EXPORT_SYMBOL(vfs_fstat);
 
-#if !defined(__alpha__) && !defined(__sparc__) && !defined(__ia64__) \
-  && !defined(CONFIG_ARCH_S390) && !defined(__hppa__) \
-  && !defined(__arm__) && !defined(CONFIG_V850) && !defined(__powerpc64__) \
-  && !defined(__mips__)
+#ifdef __ARCH_WANT_OLD_STAT
 
 /*
  * For backward compatibility?  Maybe this should be moved
@@ -178,7 +176,7 @@
 	return error;
 }
 
-#endif
+#endif /* __ARCH_WANT_OLD_STAT */
 
 static int cp_new_stat(struct kstat *stat, struct stat __user *statbuf)
 {
@@ -284,7 +282,7 @@
 
 
 /* ---------- LFS-64 ----------- */
-#if !defined(__ia64__) && !defined(__mips64) && !defined(__x86_64__) && !defined(CONFIG_ARCH_S390X)
+#ifdef __ARCH_WANT_STAT64
 
 static long cp_new_stat64(struct kstat *stat, struct stat64 __user *statbuf)
 {
@@ -352,7 +350,7 @@
 	return error;
 }
 
-#endif /* LFS-64 */
+#endif /* __ARCH_WANT_STAT64 */
 
 void inode_add_bytes(struct inode *inode, loff_t bytes)
 {
===== include/asm-alpha/signal.h 1.7 vs edited =====
--- 1.7/include/asm-alpha/signal.h	Sun Sep 21 14:50:25 2003
+++ edited/include/asm-alpha/signal.h	Thu May 20 14:56:37 2004
@@ -187,7 +187,6 @@
 #include <asm/sigcontext.h>
 
 #define ptrace_signal_deliver(regs, cookie) do { } while (0)
-#define HAVE_ARCH_SYS_PAUSE
 
 #endif
 
===== include/asm-alpha/unistd.h 1.27 vs edited =====
--- 1.27/include/asm-alpha/unistd.h	Mon May 10 21:27:30 2004
+++ edited/include/asm-alpha/unistd.h	Thu May 20 14:34:36 2004
@@ -558,6 +558,19 @@
 
 #endif /* __LIBRARY__ && __GNUC__ */
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
===== include/asm-arm/unistd.h 1.23 vs edited =====
--- 1.23/include/asm-arm/unistd.h	Sat Feb 28 01:40:59 2004
+++ edited/include/asm-arm/unistd.h	Thu May 20 14:34:50 2004
@@ -448,6 +448,25 @@
   __syscall_return(type,__res);						\
 }
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
===== include/asm-arm26/unistd.h 1.2 vs edited =====
--- 1.2/include/asm-arm26/unistd.h	Wed Feb 25 02:31:13 2004
+++ edited/include/asm-arm26/unistd.h	Thu May 20 14:35:09 2004
@@ -375,6 +375,30 @@
   __syscall_return(type,__res);								\
 }
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
===== include/asm-cris/unistd.h 1.14 vs edited =====
--- 1.14/include/asm-cris/unistd.h	Sat Feb 28 01:40:59 2004
+++ edited/include/asm-cris/unistd.h	Thu May 20 14:35:47 2004
@@ -279,7 +279,29 @@
 #define NR_syscalls 270
 
 
-
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#endif
 
 #ifdef __KERNEL_SYSCALLS__
 
===== include/asm-h8300/unistd.h 1.6 vs edited =====
--- 1.6/include/asm-h8300/unistd.h	Mon Mar 15 22:50:10 2004
+++ edited/include/asm-h8300/unistd.h	Thu May 20 14:36:20 2004
@@ -446,6 +446,30 @@
 }
 		
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
===== include/asm-i386/unistd.h 1.35 vs edited =====
--- 1.35/include/asm-i386/unistd.h	Wed Apr 21 14:35:58 2004
+++ edited/include/asm-i386/unistd.h	Thu May 20 14:36:43 2004
@@ -380,6 +380,30 @@
 __syscall_return(type,__res); \
 }
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
===== include/asm-ia64/signal.h 1.12 vs edited =====
--- 1.12/include/asm-ia64/signal.h	Fri Jan 23 10:52:25 2004
+++ edited/include/asm-ia64/signal.h	Thu May 20 14:56:52 2004
@@ -176,7 +176,6 @@
 #  include <asm/sigcontext.h>
 
 #define ptrace_signal_deliver(regs, cookie) do { } while (0)
-#define HAVE_ARCH_SYS_PAUSE
 
 #endif /* __KERNEL__ */
 
===== include/asm-ia64/unistd.h 1.42 vs edited =====
--- 1.42/include/asm-ia64/unistd.h	Thu May 20 14:05:34 2004
+++ edited/include/asm-ia64/unistd.h	Thu May 20 14:37:10 2004
@@ -261,7 +261,20 @@
 
 #ifdef __KERNEL__
 
+#include <linux/config.h>
+
 #define NR_syscalls			256 /* length of syscall table */
+
+#ifdef CONFIG_IA32_SUPPORT
+# define __ARCH_WANT_SYS_FADVISE64
+# define __ARCH_WANT_SYS_GETPGRP
+# define __ARCH_WANT_SYS_LLSEEK
+# define __ARCH_WANT_SYS_NICE
+# define __ARCH_WANT_SYS_OLD_GETRLIMIT
+# define __ARCH_WANT_SYS_OLDUMOUNT
+# define __ARCH_WANT_SYS_SIGPENDING
+# define __ARCH_WANT_SYS_SIGPROCMASK
+#endif
 
 #if !defined(__ASSEMBLY__) && !defined(ASSEMBLER)
 
===== include/asm-m68k/unistd.h 1.13 vs edited =====
--- 1.13/include/asm-m68k/unistd.h	Mon Mar 15 22:50:11 2004
+++ edited/include/asm-m68k/unistd.h	Thu May 20 14:37:34 2004
@@ -337,6 +337,30 @@
 __syscall_return(type,__res); \
 }
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
===== include/asm-m68knommu/unistd.h 1.6 vs edited =====
--- 1.6/include/asm-m68knommu/unistd.h	Mon Mar 15 22:50:11 2004
+++ edited/include/asm-m68knommu/unistd.h	Thu May 20 14:37:51 2004
@@ -372,6 +372,29 @@
   return (type)__res;								\
 }
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#endif
 
 #ifdef __KERNEL_SYSCALLS__
 
===== include/asm-mips/unistd.h 1.12 vs edited =====
--- 1.12/include/asm-mips/unistd.h	Wed Apr 21 14:35:59 2004
+++ edited/include/asm-mips/unistd.h	Thu May 20 14:38:30 2004
@@ -1045,6 +1045,30 @@
 
 #endif /* (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64) */
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+# ifndef __mips64
+#  define __ARCH_WANT_STAT64
+# endif
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
===== include/asm-parisc/unistd.h 1.14 vs edited =====
--- 1.14/include/asm-parisc/unistd.h	Mon Mar 15 22:50:11 2004
+++ edited/include/asm-parisc/unistd.h	Thu May 20 14:39:00 2004
@@ -836,6 +836,27 @@
     return K_INLINE_SYSCALL(name, 6, arg1, arg2, arg3, arg4, arg5, arg6);	\
 }
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#endif
 
 #ifdef __KERNEL_SYSCALLS__
 
===== include/asm-ppc/unistd.h 1.31 vs edited =====
--- 1.31/include/asm-ppc/unistd.h	Wed Apr 21 14:35:59 2004
+++ edited/include/asm-ppc/unistd.h	Thu May 20 14:39:31 2004
@@ -380,6 +380,28 @@
 #define __NR__exit __NR_exit
 #define NR_syscalls	__NR_syscalls
 
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+
 /*
  * Forking from kernel space will result in the child getting a new,
  * empty kernel stack area.  Thus the child cannot access automatic
===== include/asm-ppc64/unistd.h 1.31 vs edited =====
--- 1.31/include/asm-ppc64/unistd.h	Wed Apr 21 14:35:59 2004
+++ edited/include/asm-ppc64/unistd.h	Thu May 20 14:39:56 2004
@@ -418,6 +418,27 @@
 #include <linux/compiler.h>
 #include <linux/linkage.h>
 
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+
 unsigned long sys_mmap(unsigned long addr, size_t len, unsigned long prot,
 		       unsigned long flags, unsigned long fd, off_t offset);
 struct pt_regs;
===== include/asm-s390/unistd.h 1.26 vs edited =====
--- 1.26/include/asm-s390/unistd.h	Mon May 10 21:27:30 2004
+++ edited/include/asm-s390/unistd.h	Thu May 20 14:40:19 2004
@@ -512,6 +512,29 @@
 	__syscall_return(type,__res);			     \
 }
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+# ifndef CONFIG_ARCH_S390X
+#   define __ARCH_WANT_STAT64
+# endif
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/config.h>
===== include/asm-sh/unistd.h 1.10 vs edited =====
--- 1.10/include/asm-sh/unistd.h	Sat Feb 28 01:41:01 2004
+++ edited/include/asm-sh/unistd.h	Thu May 20 14:40:44 2004
@@ -400,6 +400,30 @@
 __syscall_return(type,__sc0); \
 }
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
===== include/asm-sparc/unistd.h 1.32 vs edited =====
--- 1.32/include/asm-sparc/unistd.h	Wed Apr 21 14:36:00 2004
+++ edited/include/asm-sparc/unistd.h	Thu May 20 14:41:01 2004
@@ -431,6 +431,30 @@
 errno = -__res; \
 return -1; \
 }
+
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
===== include/asm-sparc64/signal.h 1.11 vs edited =====
--- 1.11/include/asm-sparc64/signal.h	Thu Feb 26 22:27:45 2004
+++ edited/include/asm-sparc64/signal.h	Thu May 20 14:56:37 2004
@@ -253,8 +253,6 @@
 struct pt_regs;
 extern void ptrace_signal_deliver(struct pt_regs *regs, void *cookie);
 
-#define HAVE_ARCH_SYS_PAUSE
-
 #endif /* !(__KERNEL__) */
 
 #endif /* !(__ASSEMBLY__) */
===== include/asm-sparc64/unistd.h 1.30 vs edited =====
--- 1.30/include/asm-sparc64/unistd.h	Wed Apr 21 14:36:00 2004
+++ edited/include/asm-sparc64/unistd.h	Thu May 20 14:41:52 2004
@@ -474,6 +474,28 @@
 #define   _SC_JOB_CONTROL         6
 #define   _SC_SAVED_IDS           7
 #define   _SC_VERSION             8
+
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
 #endif
 
 /*
===== include/asm-um/unistd.h 1.4 vs edited =====
--- 1.4/include/asm-um/unistd.h	Wed Feb 25 02:31:13 2004
+++ edited/include/asm-um/unistd.h	Thu May 20 14:42:26 2004
@@ -12,6 +12,30 @@
 
 extern int um_execve(const char *file, char *const argv[], char *const env[]);
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
===== include/asm-v850/unistd.h 1.9 vs edited =====
--- 1.9/include/asm-v850/unistd.h	Sat Feb 28 01:41:01 2004
+++ edited/include/asm-v850/unistd.h	Thu May 20 14:42:57 2004
@@ -386,6 +386,30 @@
 }
 		
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
===== include/asm-x86_64/unistd.h 1.24 vs edited =====
--- 1.24/include/asm-x86_64/unistd.h	Wed Apr 21 14:36:00 2004
+++ edited/include/asm-x86_64/unistd.h	Thu May 20 14:43:34 2004
@@ -569,6 +569,30 @@
 	return (type) (res); \
 } while (0)
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#endif
+
 #ifndef __KERNEL_SYSCALLS__
 
 #define __syscall "syscall"
===== ipc/util.c 1.17 vs edited =====
--- 1.17/ipc/util.c	Mon Apr 12 10:54:15 2004
+++ edited/ipc/util.c	Thu May 20 14:56:37 2004
@@ -25,6 +25,8 @@
 #include <linux/rcupdate.h>
 #include <linux/workqueue.h>
 
+#include <asm/unistd.h>
+
 #include "util.h"
 
 /**
@@ -507,7 +509,8 @@
 	return 0;
 }
 
-#if !defined(__ia64__) && !defined(__x86_64__) && !defined(__hppa__)
+#ifdef __ARCH_WANT_IPC_PARSE_VERSION
+
 
 /**
  *	ipc_parse_version	-	IPC call version
@@ -528,4 +531,4 @@
 	}
 }
 
-#endif /* __ia64__ */
+#endif /* __ARCH_WANT_IPC_PARSE_VERSION */
===== kernel/exit.c 1.132 vs edited =====
--- 1.132/kernel/exit.c	Tue Apr 13 08:46:49 2004
+++ edited/kernel/exit.c	Thu May 20 14:56:37 2004
@@ -24,6 +24,7 @@
 #include <linux/proc_fs.h>
 
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
 #include <asm/pgtable.h>
 #include <asm/mmu_context.h>
 
@@ -1157,8 +1158,7 @@
 	return retval;
 }
 
-#if !defined(__alpha__) && !defined(__ia64__) && \
-    !defined(__arm__) && !defined(__s390__)
+#ifdef __ARCH_WANT_SYS_WAITPID
 
 /*
  * sys_waitpid() remains for compatibility. waitpid() should be
===== kernel/sched.c 1.218 vs edited =====
--- 1.218/kernel/sched.c	Thu Apr 29 14:00:38 2004
+++ edited/kernel/sched.c	Thu May 20 14:56:37 2004
@@ -40,6 +40,8 @@
 #include <linux/percpu.h>
 #include <linux/kthread.h>
 
+#include <asm/unistd.h>
+
 #ifdef CONFIG_NUMA
 #define cpu_to_node_mask(cpu) node_to_cpumask(cpu_to_node(cpu))
 #else
@@ -2015,7 +2017,7 @@
 
 EXPORT_SYMBOL(set_user_nice);
 
-#ifndef __alpha__
+#ifdef __ARCH_WANT_SYS_NICE
 
 /*
  * sys_nice - change the priority of the current process.
===== kernel/signal.c 1.108 vs edited =====
--- 1.108/kernel/signal.c	Wed Apr 21 14:36:02 2004
+++ edited/kernel/signal.c	Thu May 20 14:56:37 2004
@@ -23,6 +23,7 @@
 #include <linux/ptrace.h>
 #include <asm/param.h>
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
 #include <asm/siginfo.h>
 
 /*
@@ -2412,14 +2413,19 @@
 	return error;
 }
 
+#ifdef __ARCH_WANT_SYS_SIGPENDING
+
 asmlinkage long
 sys_sigpending(old_sigset_t __user *set)
 {
 	return do_sigpending(set, sizeof(*set));
 }
 
-#if !defined(__alpha__)
-/* Alpha has its own versions with special arguments.  */
+#endif
+
+#ifdef __ARCH_WANT_SYS_SIGPROCMASK
+/* Some platforms have their own version with special arguments others
+   support only sys_rt_sigprocmask.  */
 
 asmlinkage long
 sys_sigprocmask(int how, old_sigset_t __user *set, old_sigset_t __user *oset)
@@ -2501,8 +2507,8 @@
 #endif /* __sparc__ */
 #endif
 
-#if !defined(__alpha__) && !defined(__ia64__) && \
-    !defined(__arm__) && !defined(__s390__)
+#ifdef __ARCH_WANT_SYS_SGETMASK
+
 /*
  * For backwards compatibility.  Functionality superseded by sigprocmask.
  */
@@ -2528,10 +2534,9 @@
 
 	return old;
 }
-#endif /* !defined(__alpha__) */
+#endif /* __ARCH_WANT_SGETMASK */
 
-#if !defined(__alpha__) && !defined(__ia64__) && !defined(__mips__) && \
-    !defined(__arm__)
+#ifdef __ARCH_WANT_SYS_SIGNAL
 /*
  * For backwards compatibility.  Functionality superseded by sigaction.
  */
@@ -2548,9 +2553,9 @@
 
 	return ret ? ret : (unsigned long)old_sa.sa.sa_handler;
 }
-#endif /* !alpha && !__ia64__ && !defined(__mips__) && !defined(__arm__) */
+#endif /* __ARCH_WANT_SYS_SIGNAL */
 
-#ifndef HAVE_ARCH_SYS_PAUSE
+#ifdef __ARCH_WANT_SYS_PAUSE
 
 asmlinkage long
 sys_pause(void)
@@ -2560,7 +2565,7 @@
 	return -ERESTARTNOHAND;
 }
 
-#endif /* HAVE_ARCH_SYS_PAUSE */
+#endif
 
 void __init signals_init(void)
 {
===== kernel/sys.c 1.59 vs edited =====
--- 1.59/kernel/sys.c	Wed Apr 21 14:36:02 2004
+++ edited/kernel/sys.c	Thu May 20 14:56:37 2004
@@ -1056,12 +1056,16 @@
 	}
 }
 
+#ifdef __ARCH_WANT_SYS_GETPGRP
+
 asmlinkage long sys_getpgrp(void)
 {
 	/* SMP - assuming writes are word atomic this is fine */
 	return process_group(current);
 }
 
+#endif
+
 asmlinkage long sys_getsid(pid_t pid)
 {
 	if (!pid) {
@@ -1402,6 +1406,8 @@
 	return errno;
 }
 
+#ifdef __ARCH_WANT_SYS_GETHOSTNAME
+
 asmlinkage long sys_gethostname(char __user *name, int len)
 {
 	int i, errno;
@@ -1419,6 +1425,8 @@
 	return errno;
 }
 
+#endif
+
 /*
  * Only setdomainname; getdomainname can be implemented by calling
  * uname()
@@ -1453,7 +1461,7 @@
 			? -EFAULT : 0;
 }
 
-#if defined(COMPAT_RLIM_OLD_INFINITY) || !(defined(CONFIG_IA64) || defined(CONFIG_V850))
+#ifdef __ARCH_WANT_SYS_OLD_GETRLIMIT
 
 /*
  *	Back compatibility for getrlimit. Needed for some apps.
===== kernel/time.c 1.20 vs edited =====
--- 1.20/kernel/time.c	Wed Apr 21 14:36:02 2004
+++ edited/kernel/time.c	Thu May 20 14:56:37 2004
@@ -29,6 +29,7 @@
 #include <linux/errno.h>
 #include <linux/smp_lock.h>
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
 
 /* 
  * The timezone where the local system is located.  Used as a default by some
@@ -38,7 +39,7 @@
 
 EXPORT_SYMBOL(sys_tz);
 
-#if !defined(__alpha__) && !defined(__ia64__)
+#ifdef __ARCH_WANT_SYS_TIME
 
 /*
  * sys_time() can be implemented in user-level using
@@ -84,7 +85,7 @@
 	return 0;
 }
 
-#endif
+#endif /* __ARCH_WANT_SYS_TIME */
 
 asmlinkage long sys_gettimeofday(struct timeval __user *tv, struct timezone __user *tz)
 {
===== kernel/timer.c 1.79 vs edited =====
--- 1.79/kernel/timer.c	Thu Apr 29 14:00:38 2004
+++ edited/kernel/timer.c	Thu May 20 14:56:37 2004
@@ -33,6 +33,7 @@
 #include <linux/cpu.h>
 
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
 #include <asm/div64.h>
 #include <asm/timex.h>
 
@@ -918,7 +919,7 @@
 	update_times();
 }
 
-#if !defined(__alpha__) && !defined(__ia64__)
+#ifdef __ARCH_WANT_SYS_ALARM
 
 /*
  * For backwards compatibility?  This can be done in libc so Alpha
===== mm/fadvise.c 1.13 vs edited =====
--- 1.13/mm/fadvise.c	Fri Apr 30 21:28:49 2004
+++ edited/mm/fadvise.c	Thu May 20 14:56:37 2004
@@ -16,6 +16,8 @@
 #include <linux/pagevec.h>
 #include <linux/fadvise.h>
 
+#include <asm/unistd.h>
+
 /*
  * POSIX_FADV_WILLNEED could set PG_Referenced, and POSIX_FADV_NOREUSE could
  * deactivate the pages and clear PG_Referenced.
@@ -98,8 +100,11 @@
 	return ret;
 }
 
+#ifdef __ARCH_WANT_SYS_FADVISE64
+
 asmlinkage long sys_fadvise64(int fd, loff_t offset, size_t len, int advice)
 {
 	return sys_fadvise64_64(fd, offset, len, advice);
 }
 
+#endif
===== net/socket.c 1.77 vs edited =====
--- 1.77/net/socket.c	Sat May  8 16:00:54 2004
+++ edited/net/socket.c	Thu May 20 14:56:37 2004
@@ -87,6 +87,8 @@
 #endif	/* CONFIG_NET_RADIO */
 
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
+
 #include <net/compat.h>
 
 #include <net/sock.h>
@@ -1817,6 +1819,8 @@
 	return err;
 }
 
+#ifdef __ARCH_WANT_SYS_SOCKETCALL
+
 /* Argument list sizes for sys_socketcall */
 #define AL(x) ((x) * sizeof(unsigned long))
 static unsigned char nargs[18]={AL(0),AL(3),AL(3),AL(3),AL(2),AL(3),
@@ -1909,6 +1913,8 @@
 	}
 	return err;
 }
+
+#endif /* __ARCH_WANT_SYS_SOCKETCALL */
 
 /*
  *	This function is called by a protocol handler that wants to

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] fixing sendfile on 64bit architectures
  2004-05-20 21:56               ` Andrew Morton
  2004-05-20 22:00                 ` David Mosberger
  2004-05-20 22:09                 ` David Mosberger
@ 2004-05-20 22:10                 ` Jesse Barnes
  2004-05-20 22:25                   ` Andrew Morton
  2 siblings, 1 reply; 20+ messages in thread
From: Jesse Barnes @ 2004-05-20 22:10 UTC (permalink / raw)
  To: Andrew Morton; +Cc: davidm, hch, linux-kernel

On Thursday, May 20, 2004 5:56 pm, Andrew Morton wrote:
> An alternative might be to remove all the ifdefs, build with
> -ffunction-sections and let the linker drop any unreferenced code...

That would probably be even more confusing than the #ifdefs.  At least with 
those you know that you need to check whether the current code will be 
called...

Jesse

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] fixing sendfile on 64bit architectures
  2004-05-20 22:10                 ` Jesse Barnes
@ 2004-05-20 22:25                   ` Andrew Morton
  2004-05-20 22:32                     ` David Mosberger
  2004-05-20 22:33                     ` Jesse Barnes
  0 siblings, 2 replies; 20+ messages in thread
From: Andrew Morton @ 2004-05-20 22:25 UTC (permalink / raw)
  To: Jesse Barnes; +Cc: davidm, hch, linux-kernel

Jesse Barnes <jbarnes@engr.sgi.com> wrote:
>
> On Thursday, May 20, 2004 5:56 pm, Andrew Morton wrote:
> > An alternative might be to remove all the ifdefs, build with
> > -ffunction-sections and let the linker drop any unreferenced code...
> 
> That would probably be even more confusing than the #ifdefs.  At least with 
> those you know that you need to check whether the current code will be 
> called...
> 

Me no understand Jesse.

Removing the ifdefs and letting the linker do the job has the advantage
that the compiler gets to check more code for you.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] fixing sendfile on 64bit architectures
  2004-05-20 22:25                   ` Andrew Morton
@ 2004-05-20 22:32                     ` David Mosberger
  2004-05-20 22:33                     ` Jesse Barnes
  1 sibling, 0 replies; 20+ messages in thread
From: David Mosberger @ 2004-05-20 22:32 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Jesse Barnes, davidm, hch, linux-kernel

>>>>> On Thu, 20 May 2004 15:25:10 -0700, Andrew Morton <akpm@osdl.org> said:

  Andrew> Jesse Barnes <jbarnes@engr.sgi.com> wrote:
  >>  On Thursday, May 20, 2004 5:56 pm, Andrew Morton wrote: > An
  >> alternative might be to remove all the ifdefs, build with >
  >> -ffunction-sections and let the linker drop any unreferenced
  >> code...

  >> That would probably be even more confusing than the #ifdefs.  At
  >> least with those you know that you need to check whether the
  >> current code will be called...

  Andrew> Me no understand Jesse.

  Andrew> Removing the ifdefs and letting the linker do the job has
  Andrew> the advantage that the compiler gets to check more code for
  Andrew> you.

I think he meant that it's easier to see who (what platform) is
relying on the code.

Another disadvantage of -ffunction-sections is that the compiler won't
be able to do proper inlining.  There are several cases where you
have:

static
do_the_work ()
{
  ...
}

asmlinkage long
sys_one_variant ()
{
  do_the_work(some args...);
}

asmlinkage long
sys_other_variant ()
{
  do_the_work(other args...);
}

If only one variant is needed, GCC 3.4 will automatically inline
"do_the_work()" (since there is only one call-site), which is exactly
what you want.  You won't get that with -ffunction-sections.

	--david

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] fixing sendfile on 64bit architectures
  2004-05-20 22:25                   ` Andrew Morton
  2004-05-20 22:32                     ` David Mosberger
@ 2004-05-20 22:33                     ` Jesse Barnes
  1 sibling, 0 replies; 20+ messages in thread
From: Jesse Barnes @ 2004-05-20 22:33 UTC (permalink / raw)
  To: Andrew Morton; +Cc: davidm, hch, linux-kernel

On Thursday, May 20, 2004 6:25 pm, Andrew Morton wrote:
> Me no understand Jesse.
>
> Removing the ifdefs and letting the linker do the job has the advantage
> that the compiler gets to check more code for you.

Nevermind, I was confused about the patch.  I thought (without looking at it) 
that arch versions would be hidden in arch code, but now I see that they're 
just completely unused, so there's little chance for confusion.  I'll shut up 
now.

Jesse

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] fixing sendfile on 64bit architectures
  2004-05-20 22:09                 ` David Mosberger
@ 2004-05-20 23:30                   ` Andrew Morton
  2004-05-20 23:44                     ` David Mosberger
  0 siblings, 1 reply; 20+ messages in thread
From: Andrew Morton @ 2004-05-20 23:30 UTC (permalink / raw)
  To: davidm; +Cc: hch, linux-kernel

David Mosberger <davidm@napali.hpl.hp.com> wrote:
>
> Here is what the reversed-sense patch looks like (mostly autogenerated
> via a script).

ppc64 is happy.

x86_64 is not happy:

fs/stat.c:287: warning: `struct stat64' declared inside parameter list
fs/stat.c:287: warning: its scope is only this definition or declaration, which is probably not what you want
fs/stat.c: In function `cp_new_stat64':
fs/stat.c:289: storage size of `tmp' isn't known
fs/stat.c:291: sizeof applied to an incomplete type
fs/stat.c:289: warning: unused variable `tmp'
fs/stat.c: At top level:
fs/stat.c:322: warning: `struct stat64' declared inside parameter list
fs/stat.c: In function `sys_stat64':
fs/stat.c:328: warning: passing arg 2 of `cp_new_stat64' from incompatible pointer type
fs/stat.c: At top level:
fs/stat.c:332: warning: `struct stat64' declared inside parameter list
fs/stat.c: In function `sys_lstat64':
fs/stat.c:338: warning: passing arg 2 of `cp_new_stat64' from incompatible pointer type
fs/stat.c: At top level:
fs/stat.c:342: warning: `struct stat64' declared inside parameter list
fs/stat.c: In function `sys_fstat64':
fs/stat.c:348: warning: passing arg 2 of `cp_new_stat64' from incompatible pointer type

sparc64 is not happy:

fs/stat.c:115: warning: `struct __old_kernel_stat' declared inside parameter list
fs/stat.c:115: warning: its scope is only this definition or declaration, which is probably not what you want
fs/stat.c: In function `cp_old_stat':
fs/stat.c:118: error: storage size of `tmp' isn't known
fs/stat.c:129: error: invalid application of `sizeof' to an incomplete type
fs/stat.c:129: error: invalid application of `sizeof' to an incomplete type
fs/stat.c:129: error: invalid application of `sizeof' to an incomplete type
fs/stat.c:129: error: invalid application of `sizeof' to an incomplete type
fs/stat.c:129: error: invalid application of `sizeof' to an incomplete type
fs/stat.c:118: warning: unused variable `tmp'
fs/stat.c: At top level:
fs/stat.c:148: warning: `struct __old_kernel_stat' declared inside parameter list
fs/stat.c: In function `sys_stat':
fs/stat.c:154: warning: passing arg 2 of `cp_old_stat' from incompatible pointer type
fs/stat.c: At top level:
fs/stat.c:158: warning: `struct __old_kernel_stat' declared inside parameter list
fs/stat.c: In function `sys_lstat':
fs/stat.c:164: warning: passing arg 2 of `cp_old_stat' from incompatible pointer type
fs/stat.c: At top level:
fs/stat.c:168: warning: `struct __old_kernel_stat' declared inside parameter list
fs/stat.c: In function `sys_fstat':
fs/stat.c:174: warning: passing arg 2 of `cp_old_stat' from incompatible pointer type


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] fixing sendfile on 64bit architectures
  2004-05-20 23:30                   ` Andrew Morton
@ 2004-05-20 23:44                     ` David Mosberger
  0 siblings, 0 replies; 20+ messages in thread
From: David Mosberger @ 2004-05-20 23:44 UTC (permalink / raw)
  To: Andrew Morton; +Cc: davidm, hch, linux-kernel

>>>>> On Thu, 20 May 2004 16:30:26 -0700, Andrew Morton <akpm@osdl.org> said:

  Andrew> ppc64 is happy.

Great.

  Andrew> x86_64 is not happy:

OK, looks like I failed to remove WANT_STAT64.

  Andrew> sparc64 is not happy:

Ah, __sparc__ is defined even for sparc64, makes sense, but I didn't
account for it.

The attached patch should have these fixed.

	--david

Below is a patch that tries to sanitize the dropping of unneeded
system-call stubs in generic code.  In some instances, it would be
possible to move the optional system-call stubs into a library routine
which would avoid the need for #ifdefs, but in many cases, doing so
would require making several functions global (and possibly exporting
additional data-structures in header-files).  Furthermore, it would
inhibit (automatic) inlining in the cases in the cases where the stubs
are needed.  For these reasons, the patch keeps the #ifdef-approach.

This has been tested on ia64 and there were no objections from the
arch-maintainers (and one positive response).  The patch should be
safe but arch-maintainers may want to take a second look to see if
some __ARCH_WANT_foo macros should be removed for their architecture
(I'm quite sure that's the case, but I wanted to play it safe and only
preserved the status-quo in that regard).

===== fs/namespace.c 1.56 vs edited =====
--- 1.56/fs/namespace.c	Fri Apr 16 08:39:38 2004
+++ edited/fs/namespace.c	Thu May 20 14:56:37 2004
@@ -22,6 +22,7 @@
 #include <linux/security.h>
 #include <linux/mount.h>
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
 
 extern int __init init_rootfs(void);
 
@@ -406,6 +407,8 @@
 	return retval;
 }
 
+#ifdef __ARCH_WANT_SYS_OLDUMOUNT
+
 /*
  *	The 2.0 compatible umount. No flags. 
  */
@@ -414,6 +417,8 @@
 {
 	return sys_umount(name,0);
 }
+
+#endif
 
 static int mount_is_safe(struct nameidata *nd)
 {
===== fs/open.c 1.61 vs edited =====
--- 1.61/fs/open.c	Mon Apr 12 10:54:51 2004
+++ edited/fs/open.c	Thu May 20 14:56:37 2004
@@ -23,6 +23,8 @@
 #include <linux/fs.h>
 #include <linux/pagemap.h>
 
+#include <asm/unistd.h>
+
 int vfs_statfs(struct super_block *sb, struct kstatfs *buf)
 {
 	int retval = -ENODEV;
@@ -335,7 +337,7 @@
 }
 #endif
 
-#if !(defined(__alpha__) || defined(__ia64__))
+#ifdef __ARCH_WANT_SYS_UTIME
 
 /*
  * sys_utime() can be implemented in user-level using sys_utimes().
===== fs/read_write.c 1.38 vs edited =====
--- 1.38/fs/read_write.c	Sun Apr 18 10:51:24 2004
+++ edited/fs/read_write.c	Thu May 20 14:56:37 2004
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
 
 struct file_operations generic_ro_fops = {
 	.llseek		= generic_file_llseek,
@@ -145,7 +146,7 @@
 }
 EXPORT_SYMBOL_GPL(sys_lseek);
 
-#if !defined(__alpha__)
+#ifdef __ARCH_WANT_SYS_LLSEEK
 asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high,
 			   unsigned long offset_low, loff_t __user * result,
 			   unsigned int origin)
===== fs/readdir.c 1.27 vs edited =====
--- 1.27/fs/readdir.c	Wed Mar 31 11:12:11 2004
+++ edited/fs/readdir.c	Thu May 20 14:56:37 2004
@@ -52,7 +52,7 @@
 #define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
 #define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1))
 
-#ifndef __ia64__
+#ifdef __ARCH_WANT_OLD_READDIR
 
 struct old_linux_dirent {
 	unsigned long	d_ino;
@@ -115,7 +115,7 @@
 	return error;
 }
 
-#endif /* !__ia64__ */
+#endif /* __ARCH_WANT_OLD_READDIR */
 
 /*
  * New, all-improved, singing, dancing, iBCS2-compliant getdents()
===== fs/stat.c 1.32 vs edited =====
--- 1.32/fs/stat.c	Wed Apr 14 18:37:52 2004
+++ edited/fs/stat.c	Thu May 20 14:56:37 2004
@@ -16,6 +16,7 @@
 #include <linux/security.h>
 
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
 
 void generic_fillattr(struct inode *inode, struct kstat *stat)
 {
@@ -105,10 +106,7 @@
 
 EXPORT_SYMBOL(vfs_fstat);
 
-#if !defined(__alpha__) && !defined(__sparc__) && !defined(__ia64__) \
-  && !defined(CONFIG_ARCH_S390) && !defined(__hppa__) \
-  && !defined(__arm__) && !defined(CONFIG_V850) && !defined(__powerpc64__) \
-  && !defined(__mips__)
+#ifdef __ARCH_WANT_OLD_STAT
 
 /*
  * For backward compatibility?  Maybe this should be moved
@@ -178,7 +176,7 @@
 	return error;
 }
 
-#endif
+#endif /* __ARCH_WANT_OLD_STAT */
 
 static int cp_new_stat(struct kstat *stat, struct stat __user *statbuf)
 {
@@ -284,7 +282,7 @@
 
 
 /* ---------- LFS-64 ----------- */
-#if !defined(__ia64__) && !defined(__mips64) && !defined(__x86_64__) && !defined(CONFIG_ARCH_S390X)
+#ifdef __ARCH_WANT_STAT64
 
 static long cp_new_stat64(struct kstat *stat, struct stat64 __user *statbuf)
 {
@@ -352,7 +350,7 @@
 	return error;
 }
 
-#endif /* LFS-64 */
+#endif /* __ARCH_WANT_STAT64 */
 
 void inode_add_bytes(struct inode *inode, loff_t bytes)
 {
===== include/asm-alpha/signal.h 1.7 vs edited =====
--- 1.7/include/asm-alpha/signal.h	Sun Sep 21 14:50:25 2003
+++ edited/include/asm-alpha/signal.h	Thu May 20 14:56:37 2004
@@ -187,7 +187,6 @@
 #include <asm/sigcontext.h>
 
 #define ptrace_signal_deliver(regs, cookie) do { } while (0)
-#define HAVE_ARCH_SYS_PAUSE
 
 #endif
 
===== include/asm-alpha/unistd.h 1.27 vs edited =====
--- 1.27/include/asm-alpha/unistd.h	Mon May 10 21:27:30 2004
+++ edited/include/asm-alpha/unistd.h	Thu May 20 14:34:36 2004
@@ -558,6 +558,19 @@
 
 #endif /* __LIBRARY__ && __GNUC__ */
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
===== include/asm-arm/unistd.h 1.23 vs edited =====
--- 1.23/include/asm-arm/unistd.h	Sat Feb 28 01:40:59 2004
+++ edited/include/asm-arm/unistd.h	Thu May 20 14:34:50 2004
@@ -448,6 +448,25 @@
   __syscall_return(type,__res);						\
 }
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
===== include/asm-arm26/unistd.h 1.2 vs edited =====
--- 1.2/include/asm-arm26/unistd.h	Wed Feb 25 02:31:13 2004
+++ edited/include/asm-arm26/unistd.h	Thu May 20 14:35:09 2004
@@ -375,6 +375,30 @@
   __syscall_return(type,__res);								\
 }
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
===== include/asm-cris/unistd.h 1.14 vs edited =====
--- 1.14/include/asm-cris/unistd.h	Sat Feb 28 01:40:59 2004
+++ edited/include/asm-cris/unistd.h	Thu May 20 14:35:47 2004
@@ -279,7 +279,29 @@
 #define NR_syscalls 270
 
 
-
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#endif
 
 #ifdef __KERNEL_SYSCALLS__
 
===== include/asm-h8300/unistd.h 1.6 vs edited =====
--- 1.6/include/asm-h8300/unistd.h	Mon Mar 15 22:50:10 2004
+++ edited/include/asm-h8300/unistd.h	Thu May 20 14:36:20 2004
@@ -446,6 +446,30 @@
 }
 		
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
===== include/asm-i386/unistd.h 1.35 vs edited =====
--- 1.35/include/asm-i386/unistd.h	Wed Apr 21 14:35:58 2004
+++ edited/include/asm-i386/unistd.h	Thu May 20 14:36:43 2004
@@ -380,6 +380,30 @@
 __syscall_return(type,__res); \
 }
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
===== include/asm-ia64/signal.h 1.12 vs edited =====
--- 1.12/include/asm-ia64/signal.h	Fri Jan 23 10:52:25 2004
+++ edited/include/asm-ia64/signal.h	Thu May 20 14:56:52 2004
@@ -176,7 +176,6 @@
 #  include <asm/sigcontext.h>
 
 #define ptrace_signal_deliver(regs, cookie) do { } while (0)
-#define HAVE_ARCH_SYS_PAUSE
 
 #endif /* __KERNEL__ */
 
===== include/asm-ia64/unistd.h 1.42 vs edited =====
--- 1.42/include/asm-ia64/unistd.h	Thu May 20 14:05:34 2004
+++ edited/include/asm-ia64/unistd.h	Thu May 20 14:37:10 2004
@@ -261,7 +261,20 @@
 
 #ifdef __KERNEL__
 
+#include <linux/config.h>
+
 #define NR_syscalls			256 /* length of syscall table */
+
+#ifdef CONFIG_IA32_SUPPORT
+# define __ARCH_WANT_SYS_FADVISE64
+# define __ARCH_WANT_SYS_GETPGRP
+# define __ARCH_WANT_SYS_LLSEEK
+# define __ARCH_WANT_SYS_NICE
+# define __ARCH_WANT_SYS_OLD_GETRLIMIT
+# define __ARCH_WANT_SYS_OLDUMOUNT
+# define __ARCH_WANT_SYS_SIGPENDING
+# define __ARCH_WANT_SYS_SIGPROCMASK
+#endif
 
 #if !defined(__ASSEMBLY__) && !defined(ASSEMBLER)
 
===== include/asm-m68k/unistd.h 1.13 vs edited =====
--- 1.13/include/asm-m68k/unistd.h	Mon Mar 15 22:50:11 2004
+++ edited/include/asm-m68k/unistd.h	Thu May 20 14:37:34 2004
@@ -337,6 +337,30 @@
 __syscall_return(type,__res); \
 }
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
===== include/asm-m68knommu/unistd.h 1.6 vs edited =====
--- 1.6/include/asm-m68knommu/unistd.h	Mon Mar 15 22:50:11 2004
+++ edited/include/asm-m68knommu/unistd.h	Thu May 20 14:37:51 2004
@@ -372,6 +372,29 @@
   return (type)__res;								\
 }
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#endif
 
 #ifdef __KERNEL_SYSCALLS__
 
===== include/asm-mips/unistd.h 1.12 vs edited =====
--- 1.12/include/asm-mips/unistd.h	Wed Apr 21 14:35:59 2004
+++ edited/include/asm-mips/unistd.h	Thu May 20 14:38:30 2004
@@ -1045,6 +1045,30 @@
 
 #endif /* (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64) */
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+# ifndef __mips64
+#  define __ARCH_WANT_STAT64
+# endif
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
===== include/asm-parisc/unistd.h 1.14 vs edited =====
--- 1.14/include/asm-parisc/unistd.h	Mon Mar 15 22:50:11 2004
+++ edited/include/asm-parisc/unistd.h	Thu May 20 14:39:00 2004
@@ -836,6 +836,27 @@
     return K_INLINE_SYSCALL(name, 6, arg1, arg2, arg3, arg4, arg5, arg6);	\
 }
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#endif
 
 #ifdef __KERNEL_SYSCALLS__
 
===== include/asm-ppc/unistd.h 1.31 vs edited =====
--- 1.31/include/asm-ppc/unistd.h	Wed Apr 21 14:35:59 2004
+++ edited/include/asm-ppc/unistd.h	Thu May 20 14:39:31 2004
@@ -380,6 +380,28 @@
 #define __NR__exit __NR_exit
 #define NR_syscalls	__NR_syscalls
 
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+
 /*
  * Forking from kernel space will result in the child getting a new,
  * empty kernel stack area.  Thus the child cannot access automatic
===== include/asm-ppc64/unistd.h 1.31 vs edited =====
--- 1.31/include/asm-ppc64/unistd.h	Wed Apr 21 14:35:59 2004
+++ edited/include/asm-ppc64/unistd.h	Thu May 20 14:39:56 2004
@@ -418,6 +418,27 @@
 #include <linux/compiler.h>
 #include <linux/linkage.h>
 
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+
 unsigned long sys_mmap(unsigned long addr, size_t len, unsigned long prot,
 		       unsigned long flags, unsigned long fd, off_t offset);
 struct pt_regs;
===== include/asm-s390/unistd.h 1.26 vs edited =====
--- 1.26/include/asm-s390/unistd.h	Mon May 10 21:27:30 2004
+++ edited/include/asm-s390/unistd.h	Thu May 20 14:40:19 2004
@@ -512,6 +512,29 @@
 	__syscall_return(type,__res);			     \
 }
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+# ifndef CONFIG_ARCH_S390X
+#   define __ARCH_WANT_STAT64
+# endif
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/config.h>
===== include/asm-sh/unistd.h 1.10 vs edited =====
--- 1.10/include/asm-sh/unistd.h	Sat Feb 28 01:41:01 2004
+++ edited/include/asm-sh/unistd.h	Thu May 20 14:40:44 2004
@@ -400,6 +400,30 @@
 __syscall_return(type,__sc0); \
 }
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
===== include/asm-sparc/unistd.h 1.32 vs edited =====
--- 1.32/include/asm-sparc/unistd.h	Wed Apr 21 14:36:00 2004
+++ edited/include/asm-sparc/unistd.h	Thu May 20 14:41:01 2004
@@ -431,6 +431,30 @@
 errno = -__res; \
 return -1; \
 }
+
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
===== include/asm-sparc64/signal.h 1.11 vs edited =====
--- 1.11/include/asm-sparc64/signal.h	Thu Feb 26 22:27:45 2004
+++ edited/include/asm-sparc64/signal.h	Thu May 20 14:56:37 2004
@@ -253,8 +253,6 @@
 struct pt_regs;
 extern void ptrace_signal_deliver(struct pt_regs *regs, void *cookie);
 
-#define HAVE_ARCH_SYS_PAUSE
-
 #endif /* !(__KERNEL__) */
 
 #endif /* !(__ASSEMBLY__) */
===== include/asm-sparc64/unistd.h 1.30 vs edited =====
--- 1.30/include/asm-sparc64/unistd.h	Wed Apr 21 14:36:00 2004
+++ edited/include/asm-sparc64/unistd.h	Thu May 20 16:36:29 2004
@@ -474,6 +474,27 @@
 #define   _SC_JOB_CONTROL         6
 #define   _SC_SAVED_IDS           7
 #define   _SC_VERSION             8
+
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
 #endif
 
 /*
===== include/asm-um/unistd.h 1.4 vs edited =====
--- 1.4/include/asm-um/unistd.h	Wed Feb 25 02:31:13 2004
+++ edited/include/asm-um/unistd.h	Thu May 20 14:42:26 2004
@@ -12,6 +12,30 @@
 
 extern int um_execve(const char *file, char *const argv[], char *const env[]);
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
===== include/asm-v850/unistd.h 1.9 vs edited =====
--- 1.9/include/asm-v850/unistd.h	Sat Feb 28 01:41:01 2004
+++ edited/include/asm-v850/unistd.h	Thu May 20 14:42:57 2004
@@ -386,6 +386,30 @@
 }
 		
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_STAT64
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#endif
+
 #ifdef __KERNEL_SYSCALLS__
 
 #include <linux/compiler.h>
===== include/asm-x86_64/unistd.h 1.24 vs edited =====
--- 1.24/include/asm-x86_64/unistd.h	Wed Apr 21 14:36:00 2004
+++ edited/include/asm-x86_64/unistd.h	Thu May 20 16:35:14 2004
@@ -569,6 +569,29 @@
 	return (type) (res); \
 } while (0)
 
+#ifdef __KERNEL__
+#define __ARCH_WANT_IPC_PARSE_VERSION
+#define __ARCH_WANT_OLD_READDIR
+#define __ARCH_WANT_OLD_STAT
+#define __ARCH_WANT_SYS_ALARM
+#define __ARCH_WANT_SYS_GETHOSTNAME
+#define __ARCH_WANT_SYS_PAUSE
+#define __ARCH_WANT_SYS_SGETMASK
+#define __ARCH_WANT_SYS_SIGNAL
+#define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_SYS_UTIME
+#define __ARCH_WANT_SYS_WAITPID
+#define __ARCH_WANT_SYS_SOCKETCALL
+#define __ARCH_WANT_SYS_FADVISE64
+#define __ARCH_WANT_SYS_GETPGRP
+#define __ARCH_WANT_SYS_LLSEEK
+#define __ARCH_WANT_SYS_NICE
+#define __ARCH_WANT_SYS_OLD_GETRLIMIT
+#define __ARCH_WANT_SYS_OLDUMOUNT
+#define __ARCH_WANT_SYS_SIGPENDING
+#define __ARCH_WANT_SYS_SIGPROCMASK
+#endif
+
 #ifndef __KERNEL_SYSCALLS__
 
 #define __syscall "syscall"
===== ipc/util.c 1.17 vs edited =====
--- 1.17/ipc/util.c	Mon Apr 12 10:54:15 2004
+++ edited/ipc/util.c	Thu May 20 14:56:37 2004
@@ -25,6 +25,8 @@
 #include <linux/rcupdate.h>
 #include <linux/workqueue.h>
 
+#include <asm/unistd.h>
+
 #include "util.h"
 
 /**
@@ -507,7 +509,8 @@
 	return 0;
 }
 
-#if !defined(__ia64__) && !defined(__x86_64__) && !defined(__hppa__)
+#ifdef __ARCH_WANT_IPC_PARSE_VERSION
+
 
 /**
  *	ipc_parse_version	-	IPC call version
@@ -528,4 +531,4 @@
 	}
 }
 
-#endif /* __ia64__ */
+#endif /* __ARCH_WANT_IPC_PARSE_VERSION */
===== kernel/exit.c 1.132 vs edited =====
--- 1.132/kernel/exit.c	Tue Apr 13 08:46:49 2004
+++ edited/kernel/exit.c	Thu May 20 14:56:37 2004
@@ -24,6 +24,7 @@
 #include <linux/proc_fs.h>
 
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
 #include <asm/pgtable.h>
 #include <asm/mmu_context.h>
 
@@ -1157,8 +1158,7 @@
 	return retval;
 }
 
-#if !defined(__alpha__) && !defined(__ia64__) && \
-    !defined(__arm__) && !defined(__s390__)
+#ifdef __ARCH_WANT_SYS_WAITPID
 
 /*
  * sys_waitpid() remains for compatibility. waitpid() should be
===== kernel/sched.c 1.218 vs edited =====
--- 1.218/kernel/sched.c	Thu Apr 29 14:00:38 2004
+++ edited/kernel/sched.c	Thu May 20 14:56:37 2004
@@ -40,6 +40,8 @@
 #include <linux/percpu.h>
 #include <linux/kthread.h>
 
+#include <asm/unistd.h>
+
 #ifdef CONFIG_NUMA
 #define cpu_to_node_mask(cpu) node_to_cpumask(cpu_to_node(cpu))
 #else
@@ -2015,7 +2017,7 @@
 
 EXPORT_SYMBOL(set_user_nice);
 
-#ifndef __alpha__
+#ifdef __ARCH_WANT_SYS_NICE
 
 /*
  * sys_nice - change the priority of the current process.
===== kernel/signal.c 1.108 vs edited =====
--- 1.108/kernel/signal.c	Wed Apr 21 14:36:02 2004
+++ edited/kernel/signal.c	Thu May 20 14:56:37 2004
@@ -23,6 +23,7 @@
 #include <linux/ptrace.h>
 #include <asm/param.h>
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
 #include <asm/siginfo.h>
 
 /*
@@ -2412,14 +2413,19 @@
 	return error;
 }
 
+#ifdef __ARCH_WANT_SYS_SIGPENDING
+
 asmlinkage long
 sys_sigpending(old_sigset_t __user *set)
 {
 	return do_sigpending(set, sizeof(*set));
 }
 
-#if !defined(__alpha__)
-/* Alpha has its own versions with special arguments.  */
+#endif
+
+#ifdef __ARCH_WANT_SYS_SIGPROCMASK
+/* Some platforms have their own version with special arguments others
+   support only sys_rt_sigprocmask.  */
 
 asmlinkage long
 sys_sigprocmask(int how, old_sigset_t __user *set, old_sigset_t __user *oset)
@@ -2501,8 +2507,8 @@
 #endif /* __sparc__ */
 #endif
 
-#if !defined(__alpha__) && !defined(__ia64__) && \
-    !defined(__arm__) && !defined(__s390__)
+#ifdef __ARCH_WANT_SYS_SGETMASK
+
 /*
  * For backwards compatibility.  Functionality superseded by sigprocmask.
  */
@@ -2528,10 +2534,9 @@
 
 	return old;
 }
-#endif /* !defined(__alpha__) */
+#endif /* __ARCH_WANT_SGETMASK */
 
-#if !defined(__alpha__) && !defined(__ia64__) && !defined(__mips__) && \
-    !defined(__arm__)
+#ifdef __ARCH_WANT_SYS_SIGNAL
 /*
  * For backwards compatibility.  Functionality superseded by sigaction.
  */
@@ -2548,9 +2553,9 @@
 
 	return ret ? ret : (unsigned long)old_sa.sa.sa_handler;
 }
-#endif /* !alpha && !__ia64__ && !defined(__mips__) && !defined(__arm__) */
+#endif /* __ARCH_WANT_SYS_SIGNAL */
 
-#ifndef HAVE_ARCH_SYS_PAUSE
+#ifdef __ARCH_WANT_SYS_PAUSE
 
 asmlinkage long
 sys_pause(void)
@@ -2560,7 +2565,7 @@
 	return -ERESTARTNOHAND;
 }
 
-#endif /* HAVE_ARCH_SYS_PAUSE */
+#endif
 
 void __init signals_init(void)
 {
===== kernel/sys.c 1.59 vs edited =====
--- 1.59/kernel/sys.c	Wed Apr 21 14:36:02 2004
+++ edited/kernel/sys.c	Thu May 20 14:56:37 2004
@@ -1056,12 +1056,16 @@
 	}
 }
 
+#ifdef __ARCH_WANT_SYS_GETPGRP
+
 asmlinkage long sys_getpgrp(void)
 {
 	/* SMP - assuming writes are word atomic this is fine */
 	return process_group(current);
 }
 
+#endif
+
 asmlinkage long sys_getsid(pid_t pid)
 {
 	if (!pid) {
@@ -1402,6 +1406,8 @@
 	return errno;
 }
 
+#ifdef __ARCH_WANT_SYS_GETHOSTNAME
+
 asmlinkage long sys_gethostname(char __user *name, int len)
 {
 	int i, errno;
@@ -1419,6 +1425,8 @@
 	return errno;
 }
 
+#endif
+
 /*
  * Only setdomainname; getdomainname can be implemented by calling
  * uname()
@@ -1453,7 +1461,7 @@
 			? -EFAULT : 0;
 }
 
-#if defined(COMPAT_RLIM_OLD_INFINITY) || !(defined(CONFIG_IA64) || defined(CONFIG_V850))
+#ifdef __ARCH_WANT_SYS_OLD_GETRLIMIT
 
 /*
  *	Back compatibility for getrlimit. Needed for some apps.
===== kernel/time.c 1.20 vs edited =====
--- 1.20/kernel/time.c	Wed Apr 21 14:36:02 2004
+++ edited/kernel/time.c	Thu May 20 14:56:37 2004
@@ -29,6 +29,7 @@
 #include <linux/errno.h>
 #include <linux/smp_lock.h>
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
 
 /* 
  * The timezone where the local system is located.  Used as a default by some
@@ -38,7 +39,7 @@
 
 EXPORT_SYMBOL(sys_tz);
 
-#if !defined(__alpha__) && !defined(__ia64__)
+#ifdef __ARCH_WANT_SYS_TIME
 
 /*
  * sys_time() can be implemented in user-level using
@@ -84,7 +85,7 @@
 	return 0;
 }
 
-#endif
+#endif /* __ARCH_WANT_SYS_TIME */
 
 asmlinkage long sys_gettimeofday(struct timeval __user *tv, struct timezone __user *tz)
 {
===== kernel/timer.c 1.79 vs edited =====
--- 1.79/kernel/timer.c	Thu Apr 29 14:00:38 2004
+++ edited/kernel/timer.c	Thu May 20 14:56:37 2004
@@ -33,6 +33,7 @@
 #include <linux/cpu.h>
 
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
 #include <asm/div64.h>
 #include <asm/timex.h>
 
@@ -918,7 +919,7 @@
 	update_times();
 }
 
-#if !defined(__alpha__) && !defined(__ia64__)
+#ifdef __ARCH_WANT_SYS_ALARM
 
 /*
  * For backwards compatibility?  This can be done in libc so Alpha
===== mm/fadvise.c 1.13 vs edited =====
--- 1.13/mm/fadvise.c	Fri Apr 30 21:28:49 2004
+++ edited/mm/fadvise.c	Thu May 20 14:56:37 2004
@@ -16,6 +16,8 @@
 #include <linux/pagevec.h>
 #include <linux/fadvise.h>
 
+#include <asm/unistd.h>
+
 /*
  * POSIX_FADV_WILLNEED could set PG_Referenced, and POSIX_FADV_NOREUSE could
  * deactivate the pages and clear PG_Referenced.
@@ -98,8 +100,11 @@
 	return ret;
 }
 
+#ifdef __ARCH_WANT_SYS_FADVISE64
+
 asmlinkage long sys_fadvise64(int fd, loff_t offset, size_t len, int advice)
 {
 	return sys_fadvise64_64(fd, offset, len, advice);
 }
 
+#endif
===== net/socket.c 1.77 vs edited =====
--- 1.77/net/socket.c	Sat May  8 16:00:54 2004
+++ edited/net/socket.c	Thu May 20 14:56:37 2004
@@ -87,6 +87,8 @@
 #endif	/* CONFIG_NET_RADIO */
 
 #include <asm/uaccess.h>
+#include <asm/unistd.h>
+
 #include <net/compat.h>
 
 #include <net/sock.h>
@@ -1817,6 +1819,8 @@
 	return err;
 }
 
+#ifdef __ARCH_WANT_SYS_SOCKETCALL
+
 /* Argument list sizes for sys_socketcall */
 #define AL(x) ((x) * sizeof(unsigned long))
 static unsigned char nargs[18]={AL(0),AL(3),AL(3),AL(3),AL(2),AL(3),
@@ -1909,6 +1913,8 @@
 	}
 	return err;
 }
+
+#endif /* __ARCH_WANT_SYS_SOCKETCALL */
 
 /*
  *	This function is called by a protocol handler that wants to


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] fixing sendfile on 64bit architectures
       [not found]               ` <1Y3Ki-6x6-35@gated-at.bofh.it>
@ 2004-05-21  9:01                 ` Andi Kleen
  0 siblings, 0 replies; 20+ messages in thread
From: Andi Kleen @ 2004-05-21  9:01 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, davidm

Andrew Morton <akpm@osdl.org> writes:
>
> An alternative might be to remove all the ifdefs, build with
> -ffunction-sections and let the linker drop any unreferenced code...

I am not sure if it will handle EXPORT_SYMBOL correctly. Sometimes
we have the situation that a function is only referenced from EXPORT_SYMBOL,
but we do not want the linker to drop it because modules may use it.
(this regularly causes problems in lib-y files) 

If it did it would be great to use though. I am sure there are other
dead functions around too. Or maybe someday we could even use the 
IPA functionality in gcc 3.4 ... 

-Andi


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2004-05-21 22:35 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1Y1yE-4Lz-7@gated-at.bofh.it>
     [not found] ` <1Y1yF-4Lz-9@gated-at.bofh.it>
     [not found]   ` <1Y1yF-4Lz-11@gated-at.bofh.it>
     [not found]     ` <1Y1yF-4Lz-13@gated-at.bofh.it>
     [not found]       ` <1Y1yF-4Lz-15@gated-at.bofh.it>
     [not found]         ` <1Y1yE-4Lz-5@gated-at.bofh.it>
     [not found]           ` <1Y1yJ-4Lz-37@gated-at.bofh.it>
     [not found]             ` <1Y2l5-5rr-5@gated-at.bofh.it>
     [not found]               ` <1Y3Ki-6x6-35@gated-at.bofh.it>
2004-05-21  9:01                 ` [PATCH] fixing sendfile on 64bit architectures Andi Kleen
2004-05-19 19:26 Arnd Bergmann
2004-05-20  6:19 ` David Mosberger
2004-05-20  6:41   ` David S. Miller
     [not found]     ` <16556.65456.624986.552865@napali.hpl.hp.com>
     [not found]       ` <20040520120645.3accf048.akpm@osdl.org>
2004-05-20 19:26         ` David Mosberger
2004-05-20 19:35           ` Christoph Hellwig
2004-05-20 20:17             ` David Mosberger
2004-05-20 21:56               ` Andrew Morton
2004-05-20 22:00                 ` David Mosberger
2004-05-20 22:09                 ` David Mosberger
2004-05-20 23:30                   ` Andrew Morton
2004-05-20 23:44                     ` David Mosberger
2004-05-20 22:10                 ` Jesse Barnes
2004-05-20 22:25                   ` Andrew Morton
2004-05-20 22:32                     ` David Mosberger
2004-05-20 22:33                     ` Jesse Barnes
  -- strict thread matches above, loose matches on Subject: below --
2004-05-19  9:49 Andi Kleen
2004-05-19 12:21 ` Arnd Bergmann
2004-05-19 18:17 ` David Mosberger
2004-05-19 19:01   ` Andi Kleen
2004-05-19 19:13     ` David Mosberger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.