linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: y2038@lists.linaro.org
Cc: baolin.wang@linaro.org, tglx@linutronix.de,
	albert.aribaud@3adev.fr, john.stultz@linaro.org,
	bamvor.zhangjian@linaro.org, ruchandani.tina@gmail.com,
	linux-api@vger.kernel.org, linux-kernel@vger.kernel.org,
	libc-alpha@sourceware.org, Arnd Bergmann <arnd@arndb.de>
Subject: [PATCH 05/19] y2038: make linux/compat_time.h usable on 32-bit
Date: Wed,  6 May 2015 18:30:12 +0200	[thread overview]
Message-ID: <1430929826-318934-6-git-send-email-arnd@arndb.de> (raw)
In-Reply-To: <1430929826-318934-1-git-send-email-arnd@arndb.de>

This adds the necessary type definitions to allow using the
linux/compat_time.h header file on 32-bit architectures without
adding an asm/compat.h header in each architecture.

The types we define here are used in the compat system call
definitions of some system calls that also pass a time_t
in another structure, but are themselves not depending on the
size of time_t.

This also adds a way to use COMPAT_SYSCALL_DEFINE() by
including the compat.h header file. Some code may need to
get reshuffled here.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 include/linux/compat.h      |  6 ++++--
 include/linux/compat_time.h | 24 ++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/include/linux/compat.h b/include/linux/compat.h
index 41b0dae6203b..fefc45094107 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -5,8 +5,6 @@
  * syscall compatibility layer.
  */
 
-#ifdef CONFIG_COMPAT
-
 #include <linux/stat.h>
 #include <linux/param.h>	/* for HZ */
 #include <linux/sem.h>
@@ -17,7 +15,9 @@
 #include <linux/unistd.h>
 #include <linux/compat_time.h>
 
+#ifdef CONFIG_COMPAT
 #include <asm/compat.h>
+#endif
 #include <asm/siginfo.h>
 #include <asm/signal.h>
 
@@ -52,6 +52,8 @@
 	}								\
 	static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__))
 
+#ifdef CONFIG_COMPAT
+
 #ifndef compat_user_stack_pointer
 #define compat_user_stack_pointer() current_user_stack_pointer()
 #endif
diff --git a/include/linux/compat_time.h b/include/linux/compat_time.h
index 37564582f6a5..e17375a91f76 100644
--- a/include/linux/compat_time.h
+++ b/include/linux/compat_time.h
@@ -78,6 +78,30 @@ struct compat_timex {
 	compat_int_t:32; compat_int_t:32; compat_int_t:32;
 };
 
+#ifdef CONFIG_COMPAT
+#include <asm/compat.h>
+
+#define _COMPAT_NSIG_WORDS     (_COMPAT_NSIG / _COMPAT_NSIG_BPW)
+typedef struct {
+       compat_sigset_word      sig[_COMPAT_NSIG_WORDS];
+} compat_sigset_t;
+
+#else
+
+#define compat_mmsghdr mmsghdr
+#define compat_stat stat
+#define compat_siginfo siginfo
+#define compat_sigevent sigevent
+#define compat_sigset_t sigset_t
+#define __compat_uid_t __kernel_uid_t
+#define __compat_gid_t __kernel_gid_t
+#define compat_mode_t __kernel_mode_t
+#define copy_siginfo_to_user32(uinfo, info) copy_siginfo_to_user(uinfo, info)
+static inline void __user *compat_ptr(compat_uptr_t ptr)
+{
+	return (void __user*)ptr;
+}
+#endif
 
 /*
  * These functions operate on 32- or 64-bit specs depending on
-- 
2.1.0.rc2

  parent reply	other threads:[~2015-05-06 16:30 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-06 16:30 [PATCH 00/19] converting system calls to 64-bit time_t, part 1 Arnd Bergmann
2015-05-06 16:30 ` [PATCH 01/19] compat: remove compat_printk Arnd Bergmann
2015-05-06 16:30 ` [PATCH 02/19] initramfs: use vfs_stat/lstat directly Arnd Bergmann
2015-05-06 16:30 ` [PATCH 03/19] y2038: introduce linux/compat_time.h header Arnd Bergmann
2015-05-06 16:30 ` [PATCH 04/19] y2038: introduce CONFIG_COMPAT_TIME Arnd Bergmann
2015-05-06 16:30 ` Arnd Bergmann [this message]
2015-05-06 16:30 ` [PATCH 07/19] y2038: add compat_sys_rt_sigtimedwait variants Arnd Bergmann
2015-05-06 16:30 ` [PATCH 08/19] y2038: introduce struct __kernel_timespec Arnd Bergmann
2015-05-06 16:30 ` [PATCH 10/19] y2038: use __kernel_stat for sys_newstat syscalls Arnd Bergmann
     [not found] ` <1430929826-318934-1-git-send-email-arnd-r2nGTMty4D4@public.gmane.org>
2015-05-06 16:30   ` [PATCH 06/19] y2038: compile compat time code even when CONFIG_COMPAT is not set Arnd Bergmann
2015-05-06 16:30   ` [PATCH 09/19] y2038: introduce struct __kernel_stat Arnd Bergmann
2015-05-06 16:30   ` [PATCH 11/19] y2038: introduce and use struct __kernel_rusage Arnd Bergmann
2015-05-07  7:27   ` [PATCH 00/19] converting system calls to 64-bit time_t, part 1 Paul Bolle
2015-05-07  7:39     ` Paul Bolle
2015-05-07  8:52       ` Arnd Bergmann
2015-05-07  9:24         ` Paul Bolle
2015-05-06 16:30 ` [PATCH 12/19] y2038: add compat_{get,put}_timespec64 Arnd Bergmann
2015-05-06 16:30 ` [PATCH 13/19] y2038: add compat handling for sys_semtimedop Arnd Bergmann
     [not found]   ` <1430929826-318934-14-git-send-email-arnd-r2nGTMty4D4@public.gmane.org>
2015-05-15 22:46     ` Thomas Gleixner
2015-05-16  7:28       ` Arnd Bergmann
2015-05-16 19:54       ` Arnd Bergmann
2015-05-19  9:19         ` Thomas Gleixner
2015-05-06 16:30 ` [PATCH 14/19] y2038: use __kernel_timespec for sys_mq_timed{send,receive} Arnd Bergmann
2015-05-06 16:30 ` [PATCH 15/19] y2038: introduce timespec64_to_jiffies Arnd Bergmann
2015-05-19  9:28   ` Thomas Gleixner
2015-05-06 16:30 ` [PATCH 16/19] y2038: use __kernel_timespec in sys_rt_sigtimedwait Arnd Bergmann
2015-05-19  9:28   ` Thomas Gleixner
2015-05-06 16:30 ` [PATCH 17/19] y2038: use __kernel_timespec in sys_futex Arnd Bergmann
2015-05-15 22:53   ` Thomas Gleixner
2015-05-16  7:21     ` Thomas Gleixner
     [not found]   ` <1430929826-318934-18-git-send-email-arnd-r2nGTMty4D4@public.gmane.org>
2015-05-19  9:24     ` Thomas Gleixner
2015-05-06 16:30 ` [PATCH 18/19] y2038: introduce jiffies_to_timespec64 Arnd Bergmann
     [not found]   ` <1430929826-318934-19-git-send-email-arnd-r2nGTMty4D4@public.gmane.org>
2015-05-19  9:25     ` Thomas Gleixner
2015-05-06 16:30 ` [PATCH 19/19] y2038: use __kernel_timespec in sys_sched_rr_get_interval Arnd Bergmann
2015-05-19  9:27   ` Thomas Gleixner

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=1430929826-318934-6-git-send-email-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=albert.aribaud@3adev.fr \
    --cc=bamvor.zhangjian@linaro.org \
    --cc=baolin.wang@linaro.org \
    --cc=john.stultz@linaro.org \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ruchandani.tina@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=y2038@lists.linaro.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 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).