Re: [RFC][PATCH] consolidate arch specific resource.h headers

2005-01-18 Thread Chris Wright
* Bill Rugolsky Jr. ([EMAIL PROTECTED]) wrote:
> On Tue, Jan 18, 2005 at 04:10:56PM -0800, Chris Wright wrote:
> > +#define INIT_RLIMITS   \
> > +{  \
> > +   { RLIM_INFINITY, RLIM_INFINITY },   \
> > +   { RLIM_INFINITY, RLIM_INFINITY },   \
> > +   { RLIM_INFINITY, RLIM_INFINITY },   \
> > +   {  _STK_LIM, _STK_LIM_MAX  },   \
> > +   { 0, RLIM_INFINITY },   \
> > +   { RLIM_INFINITY, RLIM_INFINITY },   \
> > +   { 0, 0 },   \
> > +   {  INR_OPEN, INR_OPEN  },   \
> > +   {   MLOCK_LIMIT,   MLOCK_LIMIT },   \
> > +   { RLIM_INFINITY, RLIM_INFINITY },   \
> > +   { RLIM_INFINITY, RLIM_INFINITY },   \
> > +   { MAX_SIGPENDING, MAX_SIGPENDING }, \
> > +   { MQ_BYTES_MAX, MQ_BYTES_MAX }, \
> > +}
> 
> While you are rooting around in there, perhaps this block
> should be converted to C99 initializer syntax, to avoid
> problems if arch-specific changes are later introduced?

Yes, I had considered the same.  I had checked a couple arches and with
proper designated initializers, that bit would not need to be duplicated.

thanks,
-chris
-- 
Linux Security Modules http://lsm.immunix.org http://lsm.bkbits.net
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH] consolidate arch specific resource.h headers

2005-01-18 Thread Bill Rugolsky Jr.
On Tue, Jan 18, 2005 at 04:10:56PM -0800, Chris Wright wrote:
> +#define INIT_RLIMITS \
> +{\
> + { RLIM_INFINITY, RLIM_INFINITY },   \
> + { RLIM_INFINITY, RLIM_INFINITY },   \
> + { RLIM_INFINITY, RLIM_INFINITY },   \
> + {  _STK_LIM, _STK_LIM_MAX  },   \
> + { 0, RLIM_INFINITY },   \
> + { RLIM_INFINITY, RLIM_INFINITY },   \
> + { 0, 0 },   \
> + {  INR_OPEN, INR_OPEN  },   \
> + {   MLOCK_LIMIT,   MLOCK_LIMIT },   \
> + { RLIM_INFINITY, RLIM_INFINITY },   \
> + { RLIM_INFINITY, RLIM_INFINITY },   \
> + { MAX_SIGPENDING, MAX_SIGPENDING }, \
> + { MQ_BYTES_MAX, MQ_BYTES_MAX }, \
> +}

While you are rooting around in there, perhaps this block
should be converted to C99 initializer syntax, to avoid
problems if arch-specific changes are later introduced?

Regards,

Bill Rugolsky
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC][PATCH] consolidate arch specific resource.h headers

2005-01-18 Thread Chris Wright
Most of the include/asm-*/resource.h headers are the same as one another.
This patch makes one generic version, include/asm-generic/resource.h,
and uses that when appropriate.  The only vaguely interesting thing here
is that the generic version introduces a new _STK_LIM_MAX macro, which can
be populated by an arch (ia64 and parisc needed that).  Also, some arches
hid RLIM_INFINITY under __KERNEL__, while others did not.  The generic
version does not, so the following arches will see that change:
arm, arm26, ppc, ppc64, sh (and hence sh64)

The following arches are left untouched:
alpha: untouched (arch specific resource numbers)
m68knommu: untouched (uses m68k/resource.h)
mips: untouched (arch specific resource numbers)
sh64: untouched (uses asm-sh/resource.h)
sparc: untouched (arch specific resource numbers)
sparc64: untouched (arch specific resource numbers)
um: unoutched (uses arch code already)

Thoughts?

 asm-arm/resource.h |   47 
 asm-arm26/resource.h   |   47 
 asm-cris/resource.h|   47 
 asm-frv/resource.h |   48 -
 asm-generic/resource.h |   57 +
 asm-h8300/resource.h   |   47 
 asm-i386/resource.h|   48 -
 asm-ia64/resource.h|   54 +-
 asm-m32r/resource.h|   51 ---
 asm-m68k/resource.h|   47 
 asm-parisc/resource.h  |   48 +
 asm-ppc/resource.h |   44 -
 asm-ppc64/resource.h   |   53 -
 asm-s390/resource.h|   47 
 asm-sh/resource.h  |   47 
 asm-v850/resource.h|   47 
 asm-x86_64/resource.h  |   47 
 17 files changed, 75 insertions(+), 751 deletions(-)

--- /dev/null   2005-01-14 06:27:56.540397616 -0800
+++ edited/include/asm-generic/resource.h   2005-01-18 14:19:33.0 
-0800
@@ -0,0 +1,57 @@
+#ifndef _ASM_GENERIC_RESOURCE_H
+#define _ASM_GENERIC_RESOURCE_H
+
+/*
+ * Resource limits
+ */
+
+#define RLIMIT_CPU 0   /* CPU time in ms */
+#define RLIMIT_FSIZE   1   /* Maximum filesize */
+#define RLIMIT_DATA2   /* max data size */
+#define RLIMIT_STACK   3   /* max stack size */
+#define RLIMIT_CORE4   /* max core file size */
+#define RLIMIT_RSS 5   /* max resident set size */
+#define RLIMIT_NPROC   6   /* max number of processes */
+#define RLIMIT_NOFILE  7   /* max number of open files */
+#define RLIMIT_MEMLOCK 8   /* max locked-in-memory address space */
+#define RLIMIT_AS  9   /* address space limit */
+#define RLIMIT_LOCKS   10  /* maximum file locks held */
+#define RLIMIT_SIGPENDING 11   /* max number of pending signals */
+#define RLIMIT_MSGQUEUE 12 /* maximum bytes in POSIX mqueues */
+
+#define RLIM_NLIMITS   13
+
+/*
+ * SuS says limits have to be unsigned.
+ * Which makes a ton more sense anyway.
+ */
+#ifndef RLIM_INFINITY
+#define RLIM_INFINITY  (~0UL)
+#endif
+
+#ifndef _STK_LIM_MAX
+#define _STK_LIM_MAX   RLIM_INFINITY
+#endif
+
+#ifdef __KERNEL__
+
+#define INIT_RLIMITS   \
+{  \
+   { RLIM_INFINITY, RLIM_INFINITY },   \
+   { RLIM_INFINITY, RLIM_INFINITY },   \
+   { RLIM_INFINITY, RLIM_INFINITY },   \
+   {  _STK_LIM, _STK_LIM_MAX  },   \
+   { 0, RLIM_INFINITY },   \
+   { RLIM_INFINITY, RLIM_INFINITY },   \
+   { 0, 0 },   \
+   {  INR_OPEN, INR_OPEN  },   \
+   {   MLOCK_LIMIT,   MLOCK_LIMIT },   \
+   { RLIM_INFINITY, RLIM_INFINITY },   \
+   { RLIM_INFINITY, RLIM_INFINITY },   \
+   { MAX_SIGPENDING, MAX_SIGPENDING }, \
+   { MQ_BYTES_MAX, MQ_BYTES_MAX }, \
+}
+
+#endif /* __KERNEL__ */
+
+#endif
= include/asm-arm26/resource.h 1.5 vs edited =
--- 1.5/include/asm-arm26/resource.h2004-08-23 01:15:26 -07:00
+++ edited/include/asm-arm26/resource.h 2005-01-18 13:58:55 -08:00
@@ -1,51 +1,6 @@
 #ifndef _ARM_RESOURCE_H
 #define _ARM_RESOURCE_H
 
-/*
- * Resource limits
- */
-
-#define RLIMIT_CPU 0   /* CPU time in ms */
-#define RLIMIT_FSIZE   1   /* Maximum filesize 

[RFC][PATCH] consolidate arch specific resource.h headers

2005-01-18 Thread Chris Wright
Most of the include/asm-*/resource.h headers are the same as one another.
This patch makes one generic version, include/asm-generic/resource.h,
and uses that when appropriate.  The only vaguely interesting thing here
is that the generic version introduces a new _STK_LIM_MAX macro, which can
be populated by an arch (ia64 and parisc needed that).  Also, some arches
hid RLIM_INFINITY under __KERNEL__, while others did not.  The generic
version does not, so the following arches will see that change:
arm, arm26, ppc, ppc64, sh (and hence sh64)

The following arches are left untouched:
alpha: untouched (arch specific resource numbers)
m68knommu: untouched (uses m68k/resource.h)
mips: untouched (arch specific resource numbers)
sh64: untouched (uses asm-sh/resource.h)
sparc: untouched (arch specific resource numbers)
sparc64: untouched (arch specific resource numbers)
um: unoutched (uses arch code already)

Thoughts?

 asm-arm/resource.h |   47 
 asm-arm26/resource.h   |   47 
 asm-cris/resource.h|   47 
 asm-frv/resource.h |   48 -
 asm-generic/resource.h |   57 +
 asm-h8300/resource.h   |   47 
 asm-i386/resource.h|   48 -
 asm-ia64/resource.h|   54 +-
 asm-m32r/resource.h|   51 ---
 asm-m68k/resource.h|   47 
 asm-parisc/resource.h  |   48 +
 asm-ppc/resource.h |   44 -
 asm-ppc64/resource.h   |   53 -
 asm-s390/resource.h|   47 
 asm-sh/resource.h  |   47 
 asm-v850/resource.h|   47 
 asm-x86_64/resource.h  |   47 
 17 files changed, 75 insertions(+), 751 deletions(-)

--- /dev/null   2005-01-14 06:27:56.540397616 -0800
+++ edited/include/asm-generic/resource.h   2005-01-18 14:19:33.0 
-0800
@@ -0,0 +1,57 @@
+#ifndef _ASM_GENERIC_RESOURCE_H
+#define _ASM_GENERIC_RESOURCE_H
+
+/*
+ * Resource limits
+ */
+
+#define RLIMIT_CPU 0   /* CPU time in ms */
+#define RLIMIT_FSIZE   1   /* Maximum filesize */
+#define RLIMIT_DATA2   /* max data size */
+#define RLIMIT_STACK   3   /* max stack size */
+#define RLIMIT_CORE4   /* max core file size */
+#define RLIMIT_RSS 5   /* max resident set size */
+#define RLIMIT_NPROC   6   /* max number of processes */
+#define RLIMIT_NOFILE  7   /* max number of open files */
+#define RLIMIT_MEMLOCK 8   /* max locked-in-memory address space */
+#define RLIMIT_AS  9   /* address space limit */
+#define RLIMIT_LOCKS   10  /* maximum file locks held */
+#define RLIMIT_SIGPENDING 11   /* max number of pending signals */
+#define RLIMIT_MSGQUEUE 12 /* maximum bytes in POSIX mqueues */
+
+#define RLIM_NLIMITS   13
+
+/*
+ * SuS says limits have to be unsigned.
+ * Which makes a ton more sense anyway.
+ */
+#ifndef RLIM_INFINITY
+#define RLIM_INFINITY  (~0UL)
+#endif
+
+#ifndef _STK_LIM_MAX
+#define _STK_LIM_MAX   RLIM_INFINITY
+#endif
+
+#ifdef __KERNEL__
+
+#define INIT_RLIMITS   \
+{  \
+   { RLIM_INFINITY, RLIM_INFINITY },   \
+   { RLIM_INFINITY, RLIM_INFINITY },   \
+   { RLIM_INFINITY, RLIM_INFINITY },   \
+   {  _STK_LIM, _STK_LIM_MAX  },   \
+   { 0, RLIM_INFINITY },   \
+   { RLIM_INFINITY, RLIM_INFINITY },   \
+   { 0, 0 },   \
+   {  INR_OPEN, INR_OPEN  },   \
+   {   MLOCK_LIMIT,   MLOCK_LIMIT },   \
+   { RLIM_INFINITY, RLIM_INFINITY },   \
+   { RLIM_INFINITY, RLIM_INFINITY },   \
+   { MAX_SIGPENDING, MAX_SIGPENDING }, \
+   { MQ_BYTES_MAX, MQ_BYTES_MAX }, \
+}
+
+#endif /* __KERNEL__ */
+
+#endif
= include/asm-arm26/resource.h 1.5 vs edited =
--- 1.5/include/asm-arm26/resource.h2004-08-23 01:15:26 -07:00
+++ edited/include/asm-arm26/resource.h 2005-01-18 13:58:55 -08:00
@@ -1,51 +1,6 @@
 #ifndef _ARM_RESOURCE_H
 #define _ARM_RESOURCE_H
 
-/*
- * Resource limits
- */
-
-#define RLIMIT_CPU 0   /* CPU time in ms */
-#define RLIMIT_FSIZE   1   /* Maximum filesize 

Re: [RFC][PATCH] consolidate arch specific resource.h headers

2005-01-18 Thread Bill Rugolsky Jr.
On Tue, Jan 18, 2005 at 04:10:56PM -0800, Chris Wright wrote:
 +#define INIT_RLIMITS \
 +{\
 + { RLIM_INFINITY, RLIM_INFINITY },   \
 + { RLIM_INFINITY, RLIM_INFINITY },   \
 + { RLIM_INFINITY, RLIM_INFINITY },   \
 + {  _STK_LIM, _STK_LIM_MAX  },   \
 + { 0, RLIM_INFINITY },   \
 + { RLIM_INFINITY, RLIM_INFINITY },   \
 + { 0, 0 },   \
 + {  INR_OPEN, INR_OPEN  },   \
 + {   MLOCK_LIMIT,   MLOCK_LIMIT },   \
 + { RLIM_INFINITY, RLIM_INFINITY },   \
 + { RLIM_INFINITY, RLIM_INFINITY },   \
 + { MAX_SIGPENDING, MAX_SIGPENDING }, \
 + { MQ_BYTES_MAX, MQ_BYTES_MAX }, \
 +}

While you are rooting around in there, perhaps this block
should be converted to C99 initializer syntax, to avoid
problems if arch-specific changes are later introduced?

Regards,

Bill Rugolsky
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH] consolidate arch specific resource.h headers

2005-01-18 Thread Chris Wright
* Bill Rugolsky Jr. ([EMAIL PROTECTED]) wrote:
 On Tue, Jan 18, 2005 at 04:10:56PM -0800, Chris Wright wrote:
  +#define INIT_RLIMITS   \
  +{  \
  +   { RLIM_INFINITY, RLIM_INFINITY },   \
  +   { RLIM_INFINITY, RLIM_INFINITY },   \
  +   { RLIM_INFINITY, RLIM_INFINITY },   \
  +   {  _STK_LIM, _STK_LIM_MAX  },   \
  +   { 0, RLIM_INFINITY },   \
  +   { RLIM_INFINITY, RLIM_INFINITY },   \
  +   { 0, 0 },   \
  +   {  INR_OPEN, INR_OPEN  },   \
  +   {   MLOCK_LIMIT,   MLOCK_LIMIT },   \
  +   { RLIM_INFINITY, RLIM_INFINITY },   \
  +   { RLIM_INFINITY, RLIM_INFINITY },   \
  +   { MAX_SIGPENDING, MAX_SIGPENDING }, \
  +   { MQ_BYTES_MAX, MQ_BYTES_MAX }, \
  +}
 
 While you are rooting around in there, perhaps this block
 should be converted to C99 initializer syntax, to avoid
 problems if arch-specific changes are later introduced?

Yes, I had considered the same.  I had checked a couple arches and with
proper designated initializers, that bit would not need to be duplicated.

thanks,
-chris
-- 
Linux Security Modules http://lsm.immunix.org http://lsm.bkbits.net
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/