mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Mike Frysinger" <vapier.adi@gmail.com>
To: "Olaf Hering" <olaf@aepfle.de>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] remove PAGE_SIZE from headers_install
Date: Sat, 14 Jul 2007 17:04:36 -0400	[thread overview]
Message-ID: <8bd0f97a0707141404k16e53945s92b3cd4264ecf0aa@mail.gmail.com> (raw)
In-Reply-To: <20070714205709.GA9478@aepfle.de>

[-- 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>

  reply	other threads:[~2007-07-14 21:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-14 20:57 Olaf Hering
2007-07-14 21:04 ` Mike Frysinger [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8bd0f97a0707141404k16e53945s92b3cd4264ecf0aa@mail.gmail.com \
    --to=vapier.adi@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olaf@aepfle.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®