LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] remove PAGE_SIZE from headers_install
@ 2007-07-14 20:57 Olaf Hering
2007-07-14 21:04 ` Mike Frysinger
2007-07-14 21:12 ` H. Peter Anvin
0 siblings, 2 replies; 16+ messages in thread
From: Olaf Hering @ 2007-07-14 20:57 UTC (permalink / raw)
To: Andrew Morton, linux-kernel
Declare PAGE_SIZE as getpagesize() for userspace.
PAGE_SIZE is used in resource.h and shm.h
define PAGE_SIZE in asm-generic/page.h
guard get_order() with _ARCH_HAS_GET_ORDER for ia64 and xtensa
include asm-generic/page.h in asm/page.h
make asm/page.h nearly empty by moving the #ifdef guards up
remove unneeded page.h export from frv
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
include/asm-alpha/page.h | 3 ++-
include/asm-arm/page.h | 4 ++--
include/asm-arm26/page.h | 2 --
include/asm-avr32/page.h | 2 ++
include/asm-blackfin/page.h | 6 +++---
include/asm-cris/page.h | 3 ++-
include/asm-frv/Kbuild | 1 -
include/asm-frv/page.h | 3 ++-
include/asm-generic/Kbuild | 1 +
include/asm-generic/page.h | 6 ++++++
include/asm-h8300/page.h | 3 ++-
include/asm-i386/page.h | 5 +++--
include/asm-ia64/page.h | 6 +++++-
include/asm-m32r/page.h | 6 ++++--
include/asm-m68k/page.h | 4 ++--
include/asm-m68knommu/page.h | 4 ++--
include/asm-mips/page.h | 3 ++-
include/asm-parisc/page.h | 3 ++-
include/asm-powerpc/page.h | 4 +++-
include/asm-ppc/page.h | 2 +-
include/asm-s390/page.h | 10 +++++-----
include/asm-sh/page.h | 8 +++++---
include/asm-sh64/page.h | 7 ++++---
include/asm-sparc/page.h | 13 +++++++------
include/asm-sparc64/page.h | 3 ++-
include/asm-v850/page.h | 13 +++++++------
include/asm-x86_64/page.h | 5 +++--
include/asm-xtensa/page.h | 15 +++++++++------
28 files changed, 88 insertions(+), 57 deletions(-)
--- a/include/asm-alpha/page.h
+++ b/include/asm-alpha/page.h
@@ -94,7 +94,8 @@ typedef unsigned long pgprot_t;
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
#include <asm-generic/memory_model.h>
+#endif /* __KERNEL__ */
+
#include <asm-generic/page.h>
-#endif /* __KERNEL__ */
#endif /* _ALPHA_PAGE_H */
--- a/include/asm-arm/page.h
+++ b/include/asm-arm/page.h
@@ -190,8 +190,8 @@ typedef unsigned long pgprot_t;
#define ARCH_SLAB_MINALIGN 8
#endif
-#include <asm-generic/page.h>
-
#endif /* __KERNEL__ */
+#include <asm-generic/page.h>
+
#endif
--- a/include/asm-arm26/page.h
+++ b/include/asm-arm26/page.h
@@ -68,7 +68,6 @@ typedef unsigned long pgprot_t;
#endif /* STRICT_MM_TYPECHECKS */
#endif /* !__ASSEMBLY__ */
-#endif /* __KERNEL__ */
/* PAGE_SHIFT determines the page size. This is configurable. */
#if defined(CONFIG_PAGESIZE_16)
@@ -85,7 +84,6 @@ typedef unsigned long pgprot_t;
/* to align the pointer to the (next) page boundary */
#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
-#ifdef __KERNEL__
#ifndef __ASSEMBLY__
#include <asm/memory.h>
--- a/include/asm-avr32/page.h
+++ b/include/asm-avr32/page.h
@@ -109,4 +109,6 @@ static inline int get_order(unsigned lon
#endif /* __KERNEL__ */
+#include <asm-generic/page.h>
+
#endif /* __ASM_AVR32_PAGE_H */
--- a/include/asm-blackfin/page.h
+++ b/include/asm-blackfin/page.h
@@ -1,5 +1,6 @@
#ifndef _BLACKFIN_PAGE_H
#define _BLACKFIN_PAGE_H
+#ifdef __KERNEL__
/* PAGE_SHIFT determines the page size */
@@ -11,7 +12,6 @@
#endif
#define PAGE_MASK (~(PAGE_SIZE-1))
-#ifdef __KERNEL__
#include <asm/setup.h>
@@ -85,9 +85,9 @@ extern unsigned long memory_end;
#define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
((void *)(kaddr) < (void *)memory_end))
-#include <asm-generic/page.h>
-
#endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */
+#include <asm-generic/page.h>
+
#endif /* _BLACKFIN_PAGE_H */
--- a/include/asm-cris/page.h
+++ b/include/asm-cris/page.h
@@ -74,9 +74,10 @@ typedef struct { unsigned long pgprot; }
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
#include <asm-generic/memory_model.h>
-#include <asm-generic/page.h>
#endif /* __KERNEL__ */
+#include <asm-generic/page.h>
+
#endif /* _CRIS_PAGE_H */
--- a/include/asm-frv/Kbuild
+++ b/include/asm-frv/Kbuild
@@ -4,4 +4,3 @@ header-y += registers.h
unifdef-y += termios.h
unifdef-y += ptrace.h
-unifdef-y += page.h
--- a/include/asm-frv/page.h
+++ b/include/asm-frv/page.h
@@ -81,8 +81,9 @@ extern unsigned long max_pfn;
#endif
#include <asm-generic/memory_model.h>
-#include <asm-generic/page.h>
#endif /* __KERNEL__ */
+#include <asm-generic/page.h>
+
#endif /* _ASM_PAGE_H */
--- a/include/asm-generic/Kbuild
+++ b/include/asm-generic/Kbuild
@@ -8,5 +8,6 @@ header-y += poll.h
header-y += signal.h
header-y += statfs.h
+unifdef-y += page.h
unifdef-y += resource.h
unifdef-y += siginfo.h
--- a/include/asm-generic/page.h
+++ b/include/asm-generic/page.h
@@ -6,6 +6,7 @@
#include <linux/compiler.h>
+#ifndef _ARCH_HAS_GET_ORDER
/* Pure 2^n version of get_order */
static __inline__ __attribute_const__ int get_order(unsigned long size)
{
@@ -19,8 +20,13 @@ static __inline__ __attribute_const__ in
} while (size);
return order;
}
+#endif
#endif /* __ASSEMBLY__ */
+#else
+
+#define PAGE_SIZE (getpagesize())
+
#endif /* __KERNEL__ */
#endif /* _ASM_GENERIC_PAGE_H */
--- a/include/asm-h8300/page.h
+++ b/include/asm-h8300/page.h
@@ -76,8 +76,9 @@ extern unsigned long memory_end;
#endif /* __ASSEMBLY__ */
#include <asm-generic/memory_model.h>
-#include <asm-generic/page.h>
#endif /* __KERNEL__ */
+#include <asm-generic/page.h>
+
#endif /* _H8300_PAGE_H */
--- a/include/asm-i386/page.h
+++ b/include/asm-i386/page.h
@@ -1,6 +1,7 @@
#ifndef _I386_PAGE_H
#define _I386_PAGE_H
+#ifdef __KERNEL__
/* PAGE_SHIFT determines the page size */
#define PAGE_SHIFT 12
#define PAGE_SIZE (1UL << PAGE_SHIFT)
@@ -9,7 +10,6 @@
#define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1))
#define LARGE_PAGE_SIZE (1UL << PMD_SHIFT)
-#ifdef __KERNEL__
#ifndef __ASSEMBLY__
#ifdef CONFIG_X86_USE_3DNOW
@@ -198,9 +198,10 @@ extern int page_is_ram(unsigned long pag
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
#include <asm-generic/memory_model.h>
-#include <asm-generic/page.h>
#define __HAVE_ARCH_GATE_AREA 1
#endif /* __KERNEL__ */
+#include <asm-generic/page.h>
+
#endif /* _I386_PAGE_H */
--- a/include/asm-ia64/page.h
+++ b/include/asm-ia64/page.h
@@ -1,5 +1,6 @@
#ifndef _ASM_IA64_PAGE_H
#define _ASM_IA64_PAGE_H
+# ifdef __KERNEL__
/*
* Pagetable related stuff.
*
@@ -7,7 +8,6 @@
* David Mosberger-Tang <davidm@hpl.hp.com>
*/
-# ifdef __KERNEL__
#include <asm/intrinsics.h>
#include <asm/types.h>
@@ -160,6 +160,7 @@ typedef union ia64_va {
extern unsigned int hpage_shift;
#endif
+#define _ARCH_HAS_GET_ORDER 1
static __inline__ int
get_order (unsigned long size)
{
@@ -227,4 +228,7 @@ get_order (unsigned long size)
? VM_EXEC : 0))
# endif /* __KERNEL__ */
+
+#include <asm-generic/page.h>
+
#endif /* _ASM_IA64_PAGE_H */
--- a/include/asm-m32r/page.h
+++ b/include/asm-m32r/page.h
@@ -1,12 +1,12 @@
#ifndef _ASM_M32R_PAGE_H
#define _ASM_M32R_PAGE_H
+#ifdef __KERNEL__
/* PAGE_SHIFT determines the page size */
#define PAGE_SHIFT 12
#define PAGE_SIZE (1UL << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE-1))
-#ifdef __KERNEL__
#ifndef __ASSEMBLY__
extern void clear_page(void *to);
@@ -84,7 +84,9 @@ typedef struct { unsigned long pgprot; }
#define devmem_is_allowed(x) 1
#include <asm-generic/memory_model.h>
-#include <asm-generic/page.h>
#endif /* __KERNEL__ */
+
+#include <asm-generic/page.h>
+
#endif /* _ASM_M32R_PAGE_H */
--- a/include/asm-m68k/page.h
+++ b/include/asm-m68k/page.h
@@ -228,8 +228,8 @@ static inline __attribute_const__ int __
#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
-#include <asm-generic/page.h>
-
#endif /* __KERNEL__ */
+#include <asm-generic/page.h>
+
#endif /* _M68K_PAGE_H */
--- a/include/asm-m68knommu/page.h
+++ b/include/asm-m68knommu/page.h
@@ -75,8 +75,8 @@ extern unsigned long memory_end;
#endif /* __ASSEMBLY__ */
-#include <asm-generic/page.h>
-
#endif /* __KERNEL__ */
+#include <asm-generic/page.h>
+
#endif /* _M68KNOMMU_PAGE_H */
--- a/include/asm-mips/page.h
+++ b/include/asm-mips/page.h
@@ -188,8 +188,9 @@ typedef struct { unsigned long pgprot; }
#define CAC_ADDR(addr) ((addr) - UNCAC_BASE + PAGE_OFFSET)
#include <asm-generic/memory_model.h>
-#include <asm-generic/page.h>
#endif /* defined (__KERNEL__) */
+#include <asm-generic/page.h>
+
#endif /* _ASM_PAGE_H */
--- a/include/asm-parisc/page.h
+++ b/include/asm-parisc/page.h
@@ -171,8 +171,9 @@ extern int npmem_ranges;
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
#include <asm-generic/memory_model.h>
-#include <asm-generic/page.h>
#endif /* __KERNEL__ */
+#include <asm-generic/page.h>
+
#endif /* _PARISC_PAGE_H */
--- a/include/asm-powerpc/page.h
+++ b/include/asm-powerpc/page.h
@@ -1,6 +1,7 @@
#ifndef _ASM_POWERPC_PAGE_H
#define _ASM_POWERPC_PAGE_H
+#ifdef __KERNEL__
/*
* Copyright (C) 2001,2005 IBM Corporation.
*
@@ -10,7 +11,6 @@
* 2 of the License, or (at your option) any later version.
*/
-#ifdef __KERNEL__
#include <asm/asm-compat.h>
#include <asm/kdump.h>
@@ -197,4 +197,6 @@ extern const char *arch_vma_name(struct
#endif /* __KERNEL__ */
+#include <asm-generic/page.h>
+
#endif /* _ASM_POWERPC_PAGE_H */
--- a/include/asm-ppc/page.h
+++ b/include/asm-ppc/page.h
@@ -1,5 +1,6 @@
#ifndef _PPC_PAGE_H
#define _PPC_PAGE_H
+#ifdef __KERNEL__
#include <asm/asm-compat.h>
@@ -13,7 +14,6 @@
*/
#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1))
-#ifdef __KERNEL__
/* This must match what is in arch/ppc/Makefile */
#define PAGE_OFFSET CONFIG_KERNEL_START
--- a/include/asm-s390/page.h
+++ b/include/asm-s390/page.h
@@ -1,3 +1,6 @@
+#ifndef _S390_PAGE_H
+#define _S390_PAGE_H
+#ifdef __KERNEL__
/*
* include/asm-s390/page.h
*
@@ -6,9 +9,6 @@
* Author(s): Hartmut Penner (hp@de.ibm.com)
*/
-#ifndef _S390_PAGE_H
-#define _S390_PAGE_H
-
#include <asm/types.h>
/* PAGE_SHIFT determines the page size */
@@ -18,7 +18,6 @@
#define PAGE_DEFAULT_ACC 0
#define PAGE_DEFAULT_KEY (PAGE_DEFAULT_ACC << 4)
-#ifdef __KERNEL__
#include <asm/setup.h>
#ifndef __ASSEMBLY__
@@ -164,8 +163,9 @@ static inline int pfn_valid(unsigned lon
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
#include <asm-generic/memory_model.h>
-#include <asm-generic/page.h>
#endif /* __KERNEL__ */
+#include <asm-generic/page.h>
+
#endif /* _S390_PAGE_H */
--- a/include/asm-sh/page.h
+++ b/include/asm-sh/page.h
@@ -1,6 +1,8 @@
#ifndef __ASM_SH_PAGE_H
#define __ASM_SH_PAGE_H
+#ifdef __KERNEL__
+
/*
* Copyright (C) 1999 Niibe Yutaka
*/
@@ -13,8 +15,6 @@
[ P4 control ] 0xE0000000
*/
-#ifdef __KERNEL__
-
/* PAGE_SHIFT determines the page size */
#if defined(CONFIG_PAGE_SIZE_4KB)
# define PAGE_SHIFT 12
@@ -141,7 +141,6 @@ typedef struct { unsigned long pgd; } pg
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
#include <asm-generic/memory_model.h>
-#include <asm-generic/page.h>
/* vDSO support */
#ifdef CONFIG_VSYSCALL
@@ -149,4 +148,7 @@ typedef struct { unsigned long pgd; } pg
#endif
#endif /* __KERNEL__ */
+
+#include <asm-generic/page.h>
+
#endif /* __ASM_SH_PAGE_H */
--- a/include/asm-sh64/page.h
+++ b/include/asm-sh64/page.h
@@ -1,6 +1,6 @@
#ifndef __ASM_SH64_PAGE_H
#define __ASM_SH64_PAGE_H
-
+#ifdef __KERNEL__
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -43,7 +43,6 @@
#define ARCH_HAS_SETCLEAR_HUGE_PTE
#endif
-#ifdef __KERNEL__
#ifndef __ASSEMBLY__
extern struct page *mem_map;
@@ -113,7 +112,9 @@ typedef struct { unsigned long pgprot; }
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
#include <asm-generic/memory_model.h>
-#include <asm-generic/page.h>
#endif /* __KERNEL__ */
+
+#include <asm-generic/page.h>
+
#endif /* __ASM_SH64_PAGE_H */
--- a/include/asm-sparc/page.h
+++ b/include/asm-sparc/page.h
@@ -1,3 +1,8 @@
+#ifndef _SPARC_PAGE_H
+#define _SPARC_PAGE_H
+
+#ifdef __KERNEL__
+
/* $Id: page.h,v 1.55 2000/10/30 21:01:41 davem Exp $
* page.h: Various defines and such for MMU operations on the Sparc for
* the Linux kernel.
@@ -5,11 +10,6 @@
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
*/
-#ifndef _SPARC_PAGE_H
-#define _SPARC_PAGE_H
-
-#ifdef __KERNEL__
-
#ifdef CONFIG_SUN4
#define PAGE_SHIFT 13
#else
@@ -161,8 +161,9 @@ extern unsigned long pfn_base;
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
#include <asm-generic/memory_model.h>
-#include <asm-generic/page.h>
#endif /* __KERNEL__ */
+#include <asm-generic/page.h>
+
#endif /* _SPARC_PAGE_H */
--- a/include/asm-sparc64/page.h
+++ b/include/asm-sparc64/page.h
@@ -141,7 +141,8 @@ typedef unsigned long pgprot_t;
#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
+#endif /* __KERNEL__ */
+
#include <asm-generic/page.h>
-#endif /* __KERNEL__ */
#endif /* _SPARC64_PAGE_H */
--- a/include/asm-v850/page.h
+++ b/include/asm-v850/page.h
@@ -1,3 +1,8 @@
+#ifndef __V850_PAGE_H__
+#define __V850_PAGE_H__
+
+#ifdef __KERNEL__
+
/*
* include/asm-v850/page.h -- VM ops
*
@@ -11,11 +16,6 @@
* Written by Miles Bader <miles@gnu.org>
*/
-#ifndef __V850_PAGE_H__
-#define __V850_PAGE_H__
-
-#ifdef __KERNEL__
-
#include <asm/machdep.h>
@@ -124,8 +124,9 @@ typedef unsigned long pgprot_t;
#include <asm-generic/memory_model.h>
-#include <asm-generic/page.h>
#endif /* KERNEL */
+#include <asm-generic/page.h>
+
#endif /* __V850_PAGE_H__ */
--- a/include/asm-x86_64/page.h
+++ b/include/asm-x86_64/page.h
@@ -1,5 +1,6 @@
#ifndef _X86_64_PAGE_H
#define _X86_64_PAGE_H
+#ifdef __KERNEL__
#include <linux/const.h>
@@ -37,7 +38,6 @@
#define HPAGE_MASK (~(HPAGE_SIZE - 1))
#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
-#ifdef __KERNEL__
#ifndef __ASSEMBLY__
extern unsigned long end_pfn;
@@ -135,8 +135,9 @@ extern unsigned long __phys_addr(unsigne
#define __HAVE_ARCH_GATE_AREA 1
#include <asm-generic/memory_model.h>
-#include <asm-generic/page.h>
#endif /* __KERNEL__ */
+#include <asm-generic/page.h>
+
#endif /* _X86_64_PAGE_H */
--- a/include/asm-xtensa/page.h
+++ b/include/asm-xtensa/page.h
@@ -1,3 +1,8 @@
+#ifndef _XTENSA_PAGE_H
+#define _XTENSA_PAGE_H
+
+#ifdef __KERNEL__
+
/*
* linux/include/asm-xtensa/page.h
*
@@ -8,11 +13,6 @@
* Copyright (C) 2001 - 2005 Tensilica Inc.
*/
-#ifndef _XTENSA_PAGE_H
-#define _XTENSA_PAGE_H
-
-#ifdef __KERNEL__
-
#include <asm/processor.h>
#define XCHAL_KSEG_CACHED_VADDR 0xd0000000
@@ -59,7 +59,7 @@ typedef struct { unsigned long pgprot; }
/*
* Pure 2^n version of get_order
*/
-
+#define _ARCH_HAS_GET_ORDER 1
static inline int get_order(unsigned long size)
{
int order;
@@ -133,4 +133,7 @@ void copy_user_page(void *to,void* from,
#include <asm-generic/memory_model.h>
#endif /* __KERNEL__ */
+
+#include <asm-generic/page.h>
+
#endif /* _XTENSA_PAGE_H */
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] remove PAGE_SIZE from headers_install
2007-07-14 20:57 [PATCH] remove PAGE_SIZE from headers_install Olaf Hering
@ 2007-07-14 21:04 ` Mike Frysinger
2007-07-15 6:27 ` Olaf Hering
2007-07-15 7:51 ` Olaf Hering
2007-07-14 21:12 ` H. Peter Anvin
1 sibling, 2 replies; 16+ messages in thread
From: Mike Frysinger @ 2007-07-14 21:04 UTC (permalink / raw)
To: Olaf Hering; +Cc: Andrew Morton, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 811 bytes --]
On 7/14/07, Olaf Hering <olaf@aepfle.de> wrote:
> Declare PAGE_SIZE as getpagesize() for userspace.
> PAGE_SIZE is used in resource.h and shm.h
>
> define PAGE_SIZE in asm-generic/page.h
> guard get_order() with _ARCH_HAS_GET_ORDER for ia64 and xtensa
> include asm-generic/page.h in asm/page.h
> make asm/page.h nearly empty by moving the #ifdef guards up
> remove unneeded page.h export from frv
imo, asm/page.h should just go away for userspace. the attached patch
is what i've been using in Gentoo ... but somethings (like an arch or
two in glibc) still assume asm/page.h is OK. in general though,
considering asm/page.h has become so unreliable lately (a large number
of arches ifdef the whole thing out), most packages out there have
updated already to use the userspace interface from unistd.h.
-mike
[-- Attachment #2: 10_all_remove-page-user-headers.patch --]
[-- Type: application/octet-stream, Size: 2974 bytes --]
Most arches stub these headers anyways, so lets just plain punt them
diff --git a/include/asm-generic/Kbuild.asm b/include/asm-generic/Kbuild.asm
index a37e95f..8731ae4 100644
--- a/include/asm-generic/Kbuild.asm
+++ b/include/asm-generic/Kbuild.asm
@@ -27,9 +27,6 @@ unifdef-y += termbits.h
unifdef-y += termios.h
unifdef-y += types.h
unifdef-y += unistd.h
-unifdef-y += user.h
# These probably shouldn't be exported
unifdef-y += shmparam.h
-unifdef-y += elf.h
-unifdef-y += page.h
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index e81e301..43bc871 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -15,7 +15,6 @@ header-y += usb/
header-y += affs_hardblocks.h
header-y += aio_abi.h
-header-y += a.out.h
header-y += arcfb.h
header-y += atmapi.h
header-y += atmbr2684.h
@@ -54,8 +53,6 @@ header-y += dqblk_v1.h
header-y += dqblk_v2.h
header-y += dqblk_xfs.h
header-y += efs_fs_sb.h
-header-y += elf-fdpic.h
-header-y += elf.h
header-y += elf-em.h
header-y += fadvise.h
header-y += fd.h
@@ -162,6 +159,7 @@ unifdef-y += acct.h
unifdef-y += adb.h
unifdef-y += adfs_fs.h
unifdef-y += agpgart.h
+unifdef-y += a.out.h
unifdef-y += apm_bios.h
unifdef-y += atalk.h
unifdef-y += atmarp.h
@@ -185,7 +183,6 @@ unifdef-y += cyclades.h
unifdef-y += dccp.h
unifdef-y += dirent.h
unifdef-y += dlm.h
-unifdef-y += elfcore.h
unifdef-y += errno.h
unifdef-y += errqueue.h
unifdef-y += ethtool.h
@@ -328,7 +325,6 @@ unifdef-y += uinput.h
unifdef-y += uio.h
unifdef-y += unistd.h
unifdef-y += usbdevice_fs.h
-unifdef-y += user.h
unifdef-y += utsname.h
unifdef-y += videodev2.h
unifdef-y += videodev.h
diff --git a/include/linux/a.out.h b/include/linux/a.out.h
index f913cc3..98210e6 100644
--- a/include/linux/a.out.h
+++ b/include/linux/a.out.h
@@ -128,12 +128,20 @@ enum machine_type {
#endif
#ifdef linux
+#ifdef __KERNEL__
#include <asm/page.h>
+#else
+#include <unistd.h>
+#endif
#if defined(__i386__) || defined(__mc68000__)
#define SEGMENT_SIZE 1024
#else
#ifndef SEGMENT_SIZE
+#ifdef __KERNEL__
#define SEGMENT_SIZE PAGE_SIZE
+#else
+#define SEGMENT_SIZE getpagesize()
+#endif
#endif
#endif
#endif
diff --git a/include/linux/shm.h b/include/linux/shm.h
index ad2e3af..b95ce87 100644
--- a/include/linux/shm.h
+++ b/include/linux/shm.h
@@ -3,7 +3,11 @@
#include <linux/ipc.h>
#include <linux/errno.h>
+#ifdef __KERNEL__
#include <asm/page.h>
+#else
+#include <unistd.h>
+#endif
/*
* SHMMAX, SHMMNI and SHMALL are upper limits are defaults which can
@@ -13,7 +17,11 @@
#define SHMMAX 0x2000000 /* max shared seg size (bytes) */
#define SHMMIN 1 /* min shared seg size (bytes) */
#define SHMMNI 4096 /* max num of segs system wide */
+#ifdef __KERNEL__
#define SHMALL (SHMMAX/PAGE_SIZE*(SHMMNI/16)) /* max shm system wide (pages) */
+#else
+#define SHMALL (SHMMAX/getpagesize()*(SHMMNI/16))
+#endif
#define SHMSEG SHMMNI /* max shared segs per process */
#include <asm/shmparam.h>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] remove PAGE_SIZE from headers_install
2007-07-14 20:57 [PATCH] remove PAGE_SIZE from headers_install Olaf Hering
2007-07-14 21:04 ` Mike Frysinger
@ 2007-07-14 21:12 ` H. Peter Anvin
2007-07-14 21:34 ` Olaf Hering
1 sibling, 1 reply; 16+ messages in thread
From: H. Peter Anvin @ 2007-07-14 21:12 UTC (permalink / raw)
To: Olaf Hering; +Cc: Andrew Morton, linux-kernel
Olaf Hering wrote:
> Declare PAGE_SIZE as getpagesize() for userspace.
> PAGE_SIZE is used in resource.h and shm.h
I would think it would be better to not define it at all. Several
architectures already don't have PAGE_SIZE visible to userspace in any way.
-hpa
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] remove PAGE_SIZE from headers_install
2007-07-14 21:12 ` H. Peter Anvin
@ 2007-07-14 21:34 ` Olaf Hering
2007-07-14 22:59 ` Mike Frysinger
2007-07-15 8:01 ` David Woodhouse
0 siblings, 2 replies; 16+ messages in thread
From: Olaf Hering @ 2007-07-14 21:34 UTC (permalink / raw)
To: H. Peter Anvin; +Cc: Andrew Morton, linux-kernel
On Sat, Jul 14, H. Peter Anvin wrote:
> Olaf Hering wrote:
> > Declare PAGE_SIZE as getpagesize() for userspace.
> > PAGE_SIZE is used in resource.h and shm.h
>
> I would think it would be better to not define it at all. Several
> architectures already don't have PAGE_SIZE visible to userspace in any way.
i386 has it, so everyone uses it.
asm/user.h uses it for NBPG, which appears in gdb configure scripts.
Maybe it doesnt trigger there because the sysconf SC_* macros match.
other places where asm/page.h is used:
util-linux configure scripts, strace, xorg-11, and alot more.
Have to check if they really need it.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] remove PAGE_SIZE from headers_install
2007-07-14 21:34 ` Olaf Hering
@ 2007-07-14 22:59 ` Mike Frysinger
2007-07-15 8:01 ` David Woodhouse
1 sibling, 0 replies; 16+ messages in thread
From: Mike Frysinger @ 2007-07-14 22:59 UTC (permalink / raw)
To: Olaf Hering; +Cc: H. Peter Anvin, Andrew Morton, linux-kernel
On 7/14/07, Olaf Hering <olaf@aepfle.de> wrote:
> On Sat, Jul 14, H. Peter Anvin wrote:
> > Olaf Hering wrote:
> > > Declare PAGE_SIZE as getpagesize() for userspace.
> > > PAGE_SIZE is used in resource.h and shm.h
> >
> > I would think it would be better to not define it at all. Several
> > architectures already don't have PAGE_SIZE visible to userspace in any way.
>
> i386 has it, so everyone uses it.
not anymore ... it's broken too many other architectures so anything
that matters has switched off of it
> asm/user.h uses it for NBPG, which appears in gdb configure scripts.
> Maybe it doesnt trigger there because the sysconf SC_* macros match.
the sourceware tree (binutils/gdb/etc...) bend over backwards to get a
usable definition so not having NBPG available is fine ... there's one
thing left which needs fixing and i have a patch that i need to commit
for that
> other places where asm/page.h is used:
> util-linux configure scripts, strace, xorg-11, and alot more.
> Have to check if they really need it.
those three packages you quote here i know have been fixed in the
latest versions
-mike
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] remove PAGE_SIZE from headers_install
2007-07-14 21:04 ` Mike Frysinger
@ 2007-07-15 6:27 ` Olaf Hering
2007-07-15 7:20 ` Mike Frysinger
2007-07-15 7:51 ` Olaf Hering
1 sibling, 1 reply; 16+ messages in thread
From: Olaf Hering @ 2007-07-15 6:27 UTC (permalink / raw)
To: Mike Frysinger; +Cc: Andrew Morton, linux-kernel
On Sat, Jul 14, Mike Frysinger wrote:
> imo, asm/page.h should just go away for userspace. the attached patch
> is what i've been using in Gentoo ... but somethings (like an arch or
> two in glibc) still assume asm/page.h is OK. in general though,
> considering asm/page.h has become so unreliable lately (a large number
> of arches ifdef the whole thing out), most packages out there have
> updated already to use the userspace interface from unistd.h.
You need that signed-off thing, and dont forget to send it to
stable@kernel.org
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] remove PAGE_SIZE from headers_install
2007-07-15 6:27 ` Olaf Hering
@ 2007-07-15 7:20 ` Mike Frysinger
2007-07-15 10:10 ` David Woodhouse
2007-08-04 10:04 ` Olaf Hering
0 siblings, 2 replies; 16+ messages in thread
From: Mike Frysinger @ 2007-07-15 7:20 UTC (permalink / raw)
To: Olaf Hering; +Cc: Andrew Morton, linux-kernel
On 7/15/07, Olaf Hering <olaf@aepfle.de> wrote:
> On Sat, Jul 14, Mike Frysinger wrote:
> > imo, asm/page.h should just go away for userspace. the attached patch
> > is what i've been using in Gentoo ... but somethings (like an arch or
> > two in glibc) still assume asm/page.h is OK. in general though,
> > considering asm/page.h has become so unreliable lately (a large number
> > of arches ifdef the whole thing out), most packages out there have
> > updated already to use the userspace interface from unistd.h.
>
> You need that signed-off thing, and dont forget to send it to
> stable@kernel.org
i honestly didnt think people would consider it for inclusion as it
was since i ripped out a lot more headers than just asm/page.h ;)
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-mike
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] remove PAGE_SIZE from headers_install
2007-07-14 21:04 ` Mike Frysinger
2007-07-15 6:27 ` Olaf Hering
@ 2007-07-15 7:51 ` Olaf Hering
1 sibling, 0 replies; 16+ messages in thread
From: Olaf Hering @ 2007-07-15 7:51 UTC (permalink / raw)
To: Mike Frysinger; +Cc: Andrew Morton, linux-kernel
On Sat, Jul 14, Mike Frysinger wrote:
> On 7/14/07, Olaf Hering <olaf@aepfle.de> wrote:
> >Declare PAGE_SIZE as getpagesize() for userspace.
> >PAGE_SIZE is used in resource.h and shm.h
> >
> >define PAGE_SIZE in asm-generic/page.h
> >guard get_order() with _ARCH_HAS_GET_ORDER for ia64 and xtensa
> >include asm-generic/page.h in asm/page.h
> >make asm/page.h nearly empty by moving the #ifdef guards up
> >remove unneeded page.h export from frv
>
> imo, asm/page.h should just go away for userspace. the attached patch
> is what i've been using in Gentoo ... but somethings (like an arch or
> two in glibc) still assume asm/page.h is OK. in general though,
> considering asm/page.h has become so unreliable lately (a large number
> of arches ifdef the whole thing out), most packages out there have
> updated already to use the userspace interface from unistd.h.
> -mike
nothing appears to use linux/shm.h and linux/resource.h
strace-4.5.15 uses linux/a.out.h in #ifdef LINUXSPARC
glibc uses asm/elf.h in sys/procfs.h, also in alpha and powerpc.
kexec-tools use linux/elf.h
psmisc and ltrace use linux/user.h
glibc (for sh) and mono-debugger use asm/user.h
And alot of asm/page.h users.
Thats the upstream status today. What you do at home doesnt really
matter.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] remove PAGE_SIZE from headers_install
2007-07-14 21:34 ` Olaf Hering
2007-07-14 22:59 ` Mike Frysinger
@ 2007-07-15 8:01 ` David Woodhouse
1 sibling, 0 replies; 16+ messages in thread
From: David Woodhouse @ 2007-07-15 8:01 UTC (permalink / raw)
To: Olaf Hering; +Cc: H. Peter Anvin, Andrew Morton, linux-kernel
On Sat, 2007-07-14 at 23:34 +0200, Olaf Hering wrote:
> > I would think it would be better to not define it at all. Several
> > architectures already don't have PAGE_SIZE visible to userspace in
> > any way.
>
> i386 has it, so everyone uses it.
PowerPC lacks it, so nothing we ship in Fedora relies upon it.
Just kill it. Probably by leaving <asm/page.h> empty for now; we can
remove it completely later.
--
dwmw2
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] remove PAGE_SIZE from headers_install
2007-07-15 7:20 ` Mike Frysinger
@ 2007-07-15 10:10 ` David Woodhouse
2007-08-04 10:04 ` Olaf Hering
1 sibling, 0 replies; 16+ messages in thread
From: David Woodhouse @ 2007-07-15 10:10 UTC (permalink / raw)
To: Mike Frysinger; +Cc: Olaf Hering, Andrew Morton, linux-kernel
On Sun, 2007-07-15 at 02:20 -0500, Mike Frysinger wrote:
> i honestly didnt think people would consider it for inclusion as it
> was since i ripped out a lot more headers than just asm/page.h ;)
So split it up into individual patches. It all looks good to me.
--
dwmw2
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] remove PAGE_SIZE from headers_install
2007-07-15 7:20 ` Mike Frysinger
2007-07-15 10:10 ` David Woodhouse
@ 2007-08-04 10:04 ` Olaf Hering
1 sibling, 0 replies; 16+ messages in thread
From: Olaf Hering @ 2007-08-04 10:04 UTC (permalink / raw)
To: Mike Frysinger; +Cc: Andrew Morton, linux-kernel
On Sun, Jul 15, Mike Frysinger wrote:
> On 7/15/07, Olaf Hering <olaf@aepfle.de> wrote:
> >On Sat, Jul 14, Mike Frysinger wrote:
> >> imo, asm/page.h should just go away for userspace. the attached patch
> >> is what i've been using in Gentoo ... but somethings (like an arch or
> >> two in glibc) still assume asm/page.h is OK. in general though,
> >> considering asm/page.h has become so unreliable lately (a large number
> >> of arches ifdef the whole thing out), most packages out there have
> >> updated already to use the userspace interface from unistd.h.
> >
> >You need that signed-off thing, and dont forget to send it to
> >stable@kernel.org
>
> i honestly didnt think people would consider it for inclusion as it
> was since i ripped out a lot more headers than just asm/page.h ;)
Did you clean it up and submit it already for 2.6.23?
Should someone else do it for you?
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] remove PAGE_SIZE from headers_install
2007-07-15 3:43 ` David Miller
@ 2007-07-15 4:49 ` Albert Cahalan
0 siblings, 0 replies; 16+ messages in thread
From: Albert Cahalan @ 2007-07-15 4:49 UTC (permalink / raw)
To: David Miller; +Cc: olaf, hpa, akpm, linux-kernel
On 7/14/07, David Miller <davem@davemloft.net> wrote:
> From: "Albert Cahalan" <acahalan@gmail.com>
> Date: Sat, 14 Jul 2007 22:48:57 -0400
>
> > A real constant-value PAGE_SIZE is useful and doable.
>
> It's bogus to use it. The kernel can get recompiled
> to arbitrary page sizes on some architectures, so a constat
> page size assumption cannot work.
Sure it can work. The ABI specifies limits on such things.
Probably the most appropriate size is the one specified
for alignment of ELF sections.
If I remember right, it's 64 K for the PowerPC ABI. This allows
for 64 K pages, even though many chips offer 4 K pages.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] remove PAGE_SIZE from headers_install
2007-07-15 2:48 Albert Cahalan
2007-07-15 3:19 ` H. Peter Anvin
@ 2007-07-15 3:43 ` David Miller
2007-07-15 4:49 ` Albert Cahalan
1 sibling, 1 reply; 16+ messages in thread
From: David Miller @ 2007-07-15 3:43 UTC (permalink / raw)
To: acahalan; +Cc: olaf, hpa, akpm, linux-kernel
From: "Albert Cahalan" <acahalan@gmail.com>
Date: Sat, 14 Jul 2007 22:48:57 -0400
> A real constant-value PAGE_SIZE is useful and doable.
It's bogus to use it. The kernel can get recompiled
to arbitrary page sizes on some architectures, so a constat
page size assumption cannot work.
> It's useful because a getpagesize() can't be used for numerous
> things, such as setting the size of an array.
Use dynamically allocated memory for the array then.
This isn't programming 101.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] remove PAGE_SIZE from headers_install
2007-07-15 2:48 Albert Cahalan
@ 2007-07-15 3:19 ` H. Peter Anvin
2007-07-15 3:43 ` David Miller
1 sibling, 0 replies; 16+ messages in thread
From: H. Peter Anvin @ 2007-07-15 3:19 UTC (permalink / raw)
To: Albert Cahalan; +Cc: olaf, akpm, linux-kernel
Albert Cahalan wrote:
>
> A real constant-value PAGE_SIZE is useful and doable.
>
> It's useful because a getpagesize() can't be used for numerous
> things, such as setting the size of an array.
>
> It's doable, even on architectures that support multiple page
> sizes, because ABIs specify alignment requirements. There are
> two alignments of interest here:
>
> a. the smallest that mmap() will ever naturally return on any
> correct implementation of the architecture's ABI ("naturally"
> meaning that MAP_FIXED was not used)
>
> b. the smallest that mprotect() will tolerate on all
> correct implementations of the architecture
>
> Pick either to be the Linux definition of PAGE_SIZE.
>
If you specify it to be one of these, people will mis-use it for the
other. This is a bad idea.
-hpa
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] remove PAGE_SIZE from headers_install
@ 2007-07-15 2:48 Albert Cahalan
2007-07-15 3:19 ` H. Peter Anvin
2007-07-15 3:43 ` David Miller
0 siblings, 2 replies; 16+ messages in thread
From: Albert Cahalan @ 2007-07-15 2:48 UTC (permalink / raw)
To: olaf, hpa, akpm, linux-kernel
Olaf Hering writes:
> On Sat, Jul 14, H. Peter Anvin wrote:
>> Olaf Hering wrote:
>>> Declare PAGE_SIZE as getpagesize() for userspace.
>>> PAGE_SIZE is used in resource.h and shm.h
>>
>> I would think it would be better to not define it at all.
>> Several architectures already don't have PAGE_SIZE visible
>> to userspace in any way.
>
> i386 has it, so everyone uses it.
Since i386 was the first architecture and is still probably the
most common architecture (x86_64 being 30% AFAIK), i386 sets the
standard for the Linux API. Several architectures are broken and
thus suffering from incompatibility.
A real constant-value PAGE_SIZE is useful and doable.
It's useful because a getpagesize() can't be used for numerous
things, such as setting the size of an array.
It's doable, even on architectures that support multiple page
sizes, because ABIs specify alignment requirements. There are
two alignments of interest here:
a. the smallest that mmap() will ever naturally return on any
correct implementation of the architecture's ABI ("naturally"
meaning that MAP_FIXED was not used)
b. the smallest that mprotect() will tolerate on all
correct implementations of the architecture
Pick either to be the Linux definition of PAGE_SIZE.
For example, if an architecture is specified to have a page size
of at least 4 K but no more than 64 K, then mprotect() will only
tolerate 64 K on all correct implementations of the architecture.
The ABI might allow mmap() to naturally return 4 K aligned data,
but might instead require 64 K alignment. Assuming 4 K, then the
mmap() value doesn't match the mprotect() value. Either one will
do as the value of PAGE_SIZE, as long as this is standardized in
the way that breaks the least code.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] remove PAGE_SIZE from headers_install
@ 2007-07-14 21:40 Mikael Pettersson
0 siblings, 0 replies; 16+ messages in thread
From: Mikael Pettersson @ 2007-07-14 21:40 UTC (permalink / raw)
To: hpa, olaf; +Cc: akpm, linux-kernel
On Sat, 14 Jul 2007 14:12:57 -0700, H. Peter Anvin wrote:
> Olaf Hering wrote:
> > Declare PAGE_SIZE as getpagesize() for userspace.
> > PAGE_SIZE is used in resource.h and shm.h
>
> I would think it would be better to not define it at all. Several
> architectures already don't have PAGE_SIZE visible to userspace in any way.
Furthermore, the kernel should /not/ export a would-be kernel
interface by defining it in terms of a non-kernel interface.
getpagesize() belongs to libc, and might not exist at all or
have that form.
Linux is not Solaris. There can be many different libcs in a system.
/Mikael
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2007-08-04 10:04 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-14 20:57 [PATCH] remove PAGE_SIZE from headers_install Olaf Hering
2007-07-14 21:04 ` Mike Frysinger
2007-07-15 6:27 ` Olaf Hering
2007-07-15 7:20 ` Mike Frysinger
2007-07-15 10:10 ` David Woodhouse
2007-08-04 10:04 ` Olaf Hering
2007-07-15 7:51 ` Olaf Hering
2007-07-14 21:12 ` H. Peter Anvin
2007-07-14 21:34 ` Olaf Hering
2007-07-14 22:59 ` Mike Frysinger
2007-07-15 8:01 ` David Woodhouse
2007-07-14 21:40 Mikael Pettersson
2007-07-15 2:48 Albert Cahalan
2007-07-15 3:19 ` H. Peter Anvin
2007-07-15 3:43 ` David Miller
2007-07-15 4:49 ` Albert Cahalan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).