All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: "H. Peter Anvin" <hpa@zytor.com>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Use __kernel_long_t/__kernel_ulong_t in <linux/resource.h>
Date: Thu, 26 Dec 2013 07:36:19 -0800	[thread overview]
Message-ID: <20131226153619.GB23355@gmail.com> (raw)
In-Reply-To: <20131225145447.GA18146@gmail.com>

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

On Wed, Dec 25, 2013 at 06:54:47AM -0800, H.J. Lu wrote:
> Both x32 and x86-64 use the same struct rusage and struct rlimit for
> system calls.  But x32 log is 32-bit.  This patch change uapi
> <linux/resource.h> to use __kernel_long_t in struct rusage and
> __kernel_ulong_t in and struct rlimit.

Here is the updated patch which uses __kernel_long_t/__kernel_ulong_t
only if __BITS_PER_LONG == 64. 
 
H.J.

[-- Attachment #2: 0002-Use-__kernel_long_t-__kernel_ulong_t-in-linux-resour.patch --]
[-- Type: text/plain, Size: 2376 bytes --]

>From d2a3409eb9aecd545a3f9c384dd55cfc870122ac Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Wed, 25 Dec 2013 06:50:33 -0800
Subject: [PATCH] Use __kernel_long_t/__kernel_ulong_t in <linux/resource.h>

Both x32 and x86-64 use the same struct rusage and struct rlimit for
system calls.  But x32 log is 32-bit.  This patch change uapi
<linux/resource.h> to use __kernel_long_t in struct rusage and
__kernel_ulong_t in and struct rlimit if __BITS_PER_LONG == 64.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
 include/uapi/linux/resource.h | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/resource.h b/include/uapi/linux/resource.h
index e0ed284..87d2daa 100644
--- a/include/uapi/linux/resource.h
+++ b/include/uapi/linux/resource.h
@@ -23,6 +23,22 @@
 struct	rusage {
 	struct timeval ru_utime;	/* user time used */
 	struct timeval ru_stime;	/* system time used */
+#if __BITS_PER_LONG == 64
+	__kernel_long_t	ru_maxrss;	/* maximum resident set size */
+	__kernel_long_t	ru_ixrss;	/* integral shared memory size */
+	__kernel_long_t	ru_idrss;	/* integral unshared data size */
+	__kernel_long_t	ru_isrss;	/* integral unshared stack size */
+	__kernel_long_t	ru_minflt;	/* page reclaims */
+	__kernel_long_t	ru_majflt;	/* page faults */
+	__kernel_long_t	ru_nswap;	/* swaps */
+	__kernel_long_t	ru_inblock;	/* block input operations */
+	__kernel_long_t	ru_oublock;	/* block output operations */
+	__kernel_long_t	ru_msgsnd;	/* messages sent */
+	__kernel_long_t	ru_msgrcv;	/* messages received */
+	__kernel_long_t	ru_nsignals;	/* signals received */
+	__kernel_long_t	ru_nvcsw;	/* voluntary context switches */
+	__kernel_long_t	ru_nivcsw;	/* involuntary " */
+#else
 	long	ru_maxrss;		/* maximum resident set size */
 	long	ru_ixrss;		/* integral shared memory size */
 	long	ru_idrss;		/* integral unshared data size */
@@ -37,11 +53,17 @@ struct	rusage {
 	long	ru_nsignals;		/* signals received */
 	long	ru_nvcsw;		/* voluntary context switches */
 	long	ru_nivcsw;		/* involuntary " */
+#endif
 };
 
 struct rlimit {
-	unsigned long	rlim_cur;
-	unsigned long	rlim_max;
+#if __BITS_PER_LONG == 64
+	__kernel_ulong_t	rlim_cur;
+	__kernel_ulong_t	rlim_max;
+#else
+	unsigned long		rlim_cur;
+	unsigned long		rlim_max;
+#endif
 };
 
 #define RLIM64_INFINITY		(~0ULL)
-- 
1.8.4.2


      parent reply	other threads:[~2013-12-26 15:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-25 14:54 [PATCH] Use __kernel_long_t/__kernel_ulong_t in <linux/resource.h> H.J. Lu
2013-12-26 10:03 ` Christoph Hellwig
2013-12-26 13:52   ` H.J. Lu
2013-12-26 13:54     ` H.J. Lu
2013-12-26 17:58     ` H. Peter Anvin
2013-12-26 18:08       ` H.J. Lu
2013-12-26 19:13     ` H. Peter Anvin
2013-12-26 15:36 ` H.J. Lu [this message]

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=20131226153619.GB23355@gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 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.