diff -urN -X dontdiff linux/arch/alpha/config.in 2326-p2-kcore/arch/alpha/config.in
--- linux/arch/alpha/config.in	Fri Nov  5 08:56:05 1999
+++ 2326-p2-kcore/arch/alpha/config.in	Fri Nov  5 09:03:04 1999
@@ -172,6 +172,11 @@
 bool 'System V IPC' CONFIG_SYSVIPC
 bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT
 bool 'Sysctl support' CONFIG_SYSCTL
+if [ "$CONFIG_PROC_FS" = "y" ]; then
+   choice 'Kernel core (/proc/kcore) format' \
+	"ELF		CONFIG_KCORE_ELF	\
+	 A.OUT		CONFIG_KCORE_AOUT" ELF
+fi
 tristate 'Kernel support for a.out (ECOFF) binaries' CONFIG_BINFMT_AOUT
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
diff -urN -X dontdiff linux/arch/alpha/defconfig 2326-p2-kcore/arch/alpha/defconfig
--- linux/arch/alpha/defconfig	Tue Aug 31 18:50:39 1999
+++ 2326-p2-kcore/arch/alpha/defconfig	Fri Nov  5 09:06:23 1999
@@ -47,6 +47,8 @@
 CONFIG_NET=y
 CONFIG_SYSVIPC=y
 # CONFIG_BSD_PROCESS_ACCT is not set
+CONFIG_KCORE_ELF=y
+# CONFIG_KCORE_AOUT is not set
 CONFIG_SYSCTL=y
 CONFIG_BINFMT_AOUT=y
 CONFIG_BINFMT_ELF=y
diff -urN -X dontdiff linux/arch/arm/config.in 2326-p2-kcore/arch/arm/config.in
--- linux/arch/arm/config.in	Thu Oct 28 18:45:51 1999
+++ 2326-p2-kcore/arch/arm/config.in	Fri Nov  5 09:04:57 1999
@@ -144,6 +144,11 @@
 bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT
 bool 'Sysctl support' CONFIG_SYSCTL
 tristate 'Math emulation' CONFIG_NWFPE
+if [ "$CONFIG_PROC_FS" = "y" ]; then
+   choice 'Kernel core (/proc/kcore) format' \
+	"ELF		CONFIG_KCORE_ELF	\
+	 A.OUT		CONFIG_KCORE_AOUT" ELF
+fi
 tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
diff -urN -X dontdiff linux/arch/arm/defconfig 2326-p2-kcore/arch/arm/defconfig
--- linux/arch/arm/defconfig	Thu Oct 21 00:29:08 1999
+++ 2326-p2-kcore/arch/arm/defconfig	Fri Nov  5 09:06:00 1999
@@ -49,6 +49,8 @@
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
 CONFIG_NWFPE=y
+CONFIG_KCORE_ELF=y
+# CONFIG_KCORE_AOUT is not set
 CONFIG_BINFMT_AOUT=y
 CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
diff -urN -X dontdiff linux/arch/m68k/config.in 2326-p2-kcore/arch/m68k/config.in
--- linux/arch/m68k/config.in	Thu Oct  7 18:17:08 1999
+++ 2326-p2-kcore/arch/m68k/config.in	Fri Nov  5 09:46:45 1999
@@ -70,6 +70,11 @@
 bool 'System V IPC' CONFIG_SYSVIPC
 bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT
 bool 'Sysctl support' CONFIG_SYSCTL
+if [ "$CONFIG_PROC_FS" = "y" ]; then
+   choice 'Kernel core (/proc/kcore) format' \
+	"ELF		CONFIG_KCORE_ELF	\
+	 A.OUT		CONFIG_KCORE_AOUT" ELF
+fi
 tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
diff -urN -X dontdiff linux/arch/m68k/defconfig 2326-p2-kcore/arch/m68k/defconfig
--- linux/arch/m68k/defconfig	Thu Feb 25 18:46:46 1999
+++ 2326-p2-kcore/arch/m68k/defconfig	Fri Nov  5 09:48:55 1999
@@ -38,6 +38,8 @@
 CONFIG_NET=y
 CONFIG_SYSVIPC=y
 CONFIG_SYSCTL=y
+CONFIG_KCORE_ELF=y
+# CONFIG_KCORE_AOUT is not set
 CONFIG_BINFMT_AOUT=y
 CONFIG_BINFMT_ELF=y
 CONFIG_ZORRO=y
diff -urN -X dontdiff linux/arch/mips/config.in 2326-p2-kcore/arch/mips/config.in
--- linux/arch/mips/config.in	Thu Oct 28 18:45:51 1999
+++ 2326-p2-kcore/arch/mips/config.in	Fri Nov  5 09:07:53 1999
@@ -69,6 +69,9 @@
    bool 'Generate little endian code' CONFIG_CPU_LITTLE_ENDIAN
 fi
 
+if [ "$CONFIG_PROC_FS" = "y" ]; then
+   define_bool CONFIG_KCORE_ELF y
+fi
 define_bool CONFIG_ELF_KERNEL y
 
 if [ "$CONFIG_CPU_LITTLE_ENDIAN" = "n" ]; then
diff -urN -X dontdiff linux/arch/mips/defconfig 2326-p2-kcore/arch/mips/defconfig
--- linux/arch/mips/defconfig	Tue Jul  6 03:44:57 1999
+++ 2326-p2-kcore/arch/mips/defconfig	Fri Nov  5 09:07:13 1999
@@ -35,6 +35,8 @@
 CONFIG_PCI_QUIRKS=y
 CONFIG_PCI_OLD_PROC=y
 CONFIG_CPU_LITTLE_ENDIAN=y
+CONFIG_KCORE_ELF=y
+# CONFIG_KCORE_AOUT is not set
 CONFIG_ELF_KERNEL=y
 # CONFIG_BINFMT_AOUT is not set
 CONFIG_BINFMT_ELF=y
diff -urN -X dontdiff linux/arch/ppc/config.in 2326-p2-kcore/arch/ppc/config.in
--- linux/arch/ppc/config.in	Thu Oct 28 18:45:51 1999
+++ 2326-p2-kcore/arch/ppc/config.in	Fri Nov  5 09:03:28 1999
@@ -85,6 +85,9 @@
 bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT
 
 # only elf supported, a.out is not -- Cort
+if [ "$CONFIG_PROC_FS" = "y" ]; then
+   define_bool CONFIG_KCORE_ELF y
+fi
 define_bool CONFIG_BINFMT_ELF y
 define_bool CONFIG_KERNEL_ELF y
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
diff -urN -X dontdiff linux/arch/ppc/defconfig 2326-p2-kcore/arch/ppc/defconfig
--- linux/arch/ppc/defconfig	Mon Oct 25 18:53:37 1999
+++ 2326-p2-kcore/arch/ppc/defconfig	Fri Nov  5 09:01:40 1999
@@ -43,6 +43,8 @@
 CONFIG_SYSCTL=y
 CONFIG_SYSVIPC=y
 # CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_KCORE_AOUT is not set
+CONFIG_KCORE_ELF=y
 CONFIG_BINFMT_ELF=y
 CONFIG_KERNEL_ELF=y
 # CONFIG_BINFMT_MISC is not set
diff -urN -X dontdiff linux/arch/sh/config.in 2326-p2-kcore/arch/sh/config.in
--- linux/arch/sh/config.in	Mon Oct 18 19:16:13 1999
+++ 2326-p2-kcore/arch/sh/config.in	Fri Nov  5 09:48:05 1999
@@ -35,6 +35,12 @@
 bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT
 bool 'Sysctl support' CONFIG_SYSCTL
 
+if [ "$CONFIG_PROC_FS" = "y" ]; then
+   choice 'Kernel core (/proc/kcore) format' \
+	"ELF		CONFIG_KCORE_ELF	\
+	 A.OUT		CONFIG_KCORE_AOUT" ELF
+fi
+
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
 endmenu
diff -urN -X dontdiff linux/arch/sh/defconfig 2326-p2-kcore/arch/sh/defconfig
--- linux/arch/sh/defconfig	Mon Oct 18 19:16:13 1999
+++ 2326-p2-kcore/arch/sh/defconfig	Fri Nov  5 09:49:25 1999
@@ -27,6 +27,8 @@
 # CONFIG_SYSVIPC is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_SYSCTL is not set
+CONFIG_KCORE_ELF=y
+# CONFIG_KCORE_AOUT is not set
 CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 
diff -urN -X dontdiff linux/arch/sparc/config.in 2326-p2-kcore/arch/sparc/config.in
--- linux/arch/sparc/config.in	Mon Nov  1 18:31:28 1999
+++ 2326-p2-kcore/arch/sparc/config.in	Fri Nov  5 09:04:07 1999
@@ -63,6 +63,11 @@
 bool 'System V IPC' CONFIG_SYSVIPC
 bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT
 bool 'Sysctl support' CONFIG_SYSCTL
+if [ "$CONFIG_PROC_FS" = "y" ]; then
+   choice 'Kernel core (/proc/kcore) format' \
+	"ELF		CONFIG_KCORE_ELF	\
+	 A.OUT		CONFIG_KCORE_AOUT" ELF
+fi
 tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
 tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
 tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
diff -urN -X dontdiff linux/arch/sparc/defconfig 2326-p2-kcore/arch/sparc/defconfig
--- linux/arch/sparc/defconfig	Tue Aug 31 19:23:29 1999
+++ 2326-p2-kcore/arch/sparc/defconfig	Fri Nov  5 09:06:36 1999
@@ -78,6 +78,8 @@
 CONFIG_SYSVIPC=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+CONFIG_KCORE_ELF=y
+# CONFIG_KCORE_AOUT is not set
 CONFIG_BINFMT_AOUT=y
 CONFIG_BINFMT_ELF=y
 CONFIG_BINFMT_MISC=m
diff -urN -X dontdiff linux/arch/sparc64/config.in 2326-p2-kcore/arch/sparc64/config.in
--- linux/arch/sparc64/config.in	Mon Nov  1 18:31:28 1999
+++ 2326-p2-kcore/arch/sparc64/config.in	Fri Nov  5 09:04:37 1999
@@ -47,6 +47,11 @@
 bool 'System V IPC' CONFIG_SYSVIPC
 bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT
 bool 'Sysctl support' CONFIG_SYSCTL
+if [ "$CONFIG_PROC_FS" = "y" ]; then
+   choice 'Kernel core (/proc/kcore) format' \
+	"ELF		CONFIG_KCORE_ELF	\
+	 A.OUT		CONFIG_KCORE_AOUT" ELF
+fi
 bool 'Kernel support for Linux/Sparc 32bit binary compatibility' CONFIG_SPARC32_COMPAT
 if [ "$CONFIG_SPARC32_COMPAT" != "n" ]; then
    tristate '  Kernel support for 32-bit ELF binaries' CONFIG_BINFMT_ELF32
diff -urN -X dontdiff linux/arch/sparc64/defconfig 2326-p2-kcore/arch/sparc64/defconfig
--- linux/arch/sparc64/defconfig	Thu Oct  7 20:50:23 1999
+++ 2326-p2-kcore/arch/sparc64/defconfig	Fri Nov  5 09:06:48 1999
@@ -88,6 +88,8 @@
 CONFIG_SYSVIPC=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+CONFIG_KCORE_ELF=y
+# CONFIG_KCORE_AOUT is not set
 CONFIG_SPARC32_COMPAT=y
 CONFIG_BINFMT_ELF=y
 CONFIG_BINFMT_ELF32=y
diff -urN -X dontdiff linux/fs/proc/array.c 2326-p2-kcore/fs/proc/array.c
--- linux/fs/proc/array.c	Fri Nov  5 08:56:09 1999
+++ 2326-p2-kcore/fs/proc/array.c	Fri Nov  5 09:50:08 1999
@@ -54,8 +54,6 @@
 #include <linux/kernel.h>
 #include <linux/kernel_stat.h>
 #include <linux/tty.h>
-#include <linux/user.h>
-#include <linux/a.out.h>
 #include <linux/string.h>
 #include <linux/mman.h>
 #include <linux/proc_fs.h>
diff -urN -X dontdiff linux/fs/proc/kcore.c 2326-p2-kcore/fs/proc/kcore.c
--- linux/fs/proc/kcore.c	Fri Nov  5 08:56:09 1999
+++ 2326-p2-kcore/fs/proc/kcore.c	Fri Nov  5 09:22:28 1999
@@ -330,6 +330,7 @@
 	copy_to_user(buffer,__va(*fpos),buflen);
 #endif
 	acc += buflen;
+	*fpos += buflen;
 
 	return acc;
 
