From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752406AbbEFQa7 (ORCPT ); Wed, 6 May 2015 12:30:59 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:61497 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751885AbbEFQas (ORCPT ); Wed, 6 May 2015 12:30:48 -0400 From: Arnd Bergmann 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 Subject: [PATCH 05/19] y2038: make linux/compat_time.h usable on 32-bit Date: Wed, 6 May 2015 18:30:12 +0200 Message-Id: <1430929826-318934-6-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.1.0.rc2 In-Reply-To: <1430929826-318934-1-git-send-email-arnd@arndb.de> References: <1430929826-318934-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:jCskhgiX93ya5X38sr3Di/STssQ3xHT+sRkUvY3ZzzfHC5pz3MA 6UgL0rSI+63XeTZSg22e4xWyqtRXDKtEPJDVsnJUMKxv3Fb8jfBOigICU7ozpiyukXYNaWh bCOAK2eDI1g40rr4ZY568JmGmjHLSoNmH6/qCWnJa4oIG6K8zpXphkOtMD+oTtWKyg8WMhW 0dy/DSM5S7Aw7XGeMoaIA== X-UI-Out-Filterresults: notjunk:1; Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 #include /* for HZ */ #include @@ -17,7 +15,9 @@ #include #include +#ifdef CONFIG_COMPAT #include +#endif #include #include @@ -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 + +#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