diff mbox

arm64: add guard macro of unistd.h to prevent double inclusion

Message ID 1410235185-16652-1-git-send-email-yangyingliang@huawei.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yang Yingliang Sept. 9, 2014, 3:59 a.m. UTC
Add guard macros in both uapi/asm/unistd.h and asm/unistd.h.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 arch/arm64/include/asm/unistd.h      | 5 +++++
 arch/arm64/include/uapi/asm/unistd.h | 5 +++++
 2 files changed, 10 insertions(+)

Comments

Will Deacon Sept. 9, 2014, 12:39 p.m. UTC | #1
On Tue, Sep 09, 2014 at 04:59:45AM +0100, Yang Yingliang wrote:
> Add guard macros in both uapi/asm/unistd.h and asm/unistd.h.
> 
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  arch/arm64/include/asm/unistd.h      | 5 +++++
>  arch/arm64/include/uapi/asm/unistd.h | 5 +++++
>  2 files changed, 10 insertions(+)

We probably need something similar for unistd32.h too, as lib/compat_audit.c
now includes that.

Can you post a v2 please?

Will
Yang Yingliang Sept. 11, 2014, 7:55 a.m. UTC | #2
On 2014/9/9 20:39, Will Deacon wrote:
> On Tue, Sep 09, 2014 at 04:59:45AM +0100, Yang Yingliang wrote:
>> Add guard macros in both uapi/asm/unistd.h and asm/unistd.h.
>>
>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>> ---
>>  arch/arm64/include/asm/unistd.h      | 5 +++++
>>  arch/arm64/include/uapi/asm/unistd.h | 5 +++++
>>  2 files changed, 10 insertions(+)
> 
> We probably need something similar for unistd32.h too, as lib/compat_audit.c
> now includes that.
> 
> Can you post a v2 please?
> 
> Will
> 
> 
OK, I'll send a v2.

Regards,
Yang
Arnd Bergmann Sept. 11, 2014, 3:14 p.m. UTC | #3
On Tuesday 09 September 2014 11:59:45 Yang Yingliang wrote:
> Add guard macros in both uapi/asm/unistd.h and asm/unistd.h.
> 
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  arch/arm64/include/asm/unistd.h      | 5 +++++
>  arch/arm64/include/uapi/asm/unistd.h | 5 +++++
>  2 files changed, 10 insertions(+)

This will lead to an empty system call table, because asm/unistd.h
is intentionally included multiple times in order to get both the
syscall definition and the macros, which are defined in pairs in
this file.

How did you come up with this patch?

	Arnd

> diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h
> index 6d2bf41..21a7dec 100644
> --- a/arch/arm64/include/asm/unistd.h
> +++ b/arch/arm64/include/asm/unistd.h
> @@ -13,6 +13,9 @@
>   * You should have received a copy of the GNU General Public License
>   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
>   */
> +#ifndef __ASM_ARM64_UNISTD_H
> +#define __ASM_ARM64_UNISTD_H
> +
>  #ifdef CONFIG_COMPAT
>  #define __ARCH_WANT_COMPAT_SYS_GETDENTS64
>  #define __ARCH_WANT_COMPAT_STAT64
> @@ -48,3 +51,5 @@
>  #include <uapi/asm/unistd.h>
>  
>  #define NR_syscalls (__NR_syscalls)
> +
> +#endif /* __ASM_ARM64_UNISTD_H */
> diff --git a/arch/arm64/include/uapi/asm/unistd.h b/arch/arm64/include/uapi/asm/unistd.h
> index 1caadc2..ab72cac 100644
> --- a/arch/arm64/include/uapi/asm/unistd.h
> +++ b/arch/arm64/include/uapi/asm/unistd.h
> @@ -13,4 +13,9 @@
>   * You should have received a copy of the GNU General Public License
>   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
>   */
> +#ifndef _UAPI__ASM_ARM64_UNISTD_H
> +#define _UAPI__ASM_ARM64_UNISTD_H
> +
>  #include <asm-generic/unistd.h>
> +
> +#endif /* _UAPI__ASM_ARM64_UNISTD_H */
>
diff mbox

Patch

diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h
index 6d2bf41..21a7dec 100644
--- a/arch/arm64/include/asm/unistd.h
+++ b/arch/arm64/include/asm/unistd.h
@@ -13,6 +13,9 @@ 
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
+#ifndef __ASM_ARM64_UNISTD_H
+#define __ASM_ARM64_UNISTD_H
+
 #ifdef CONFIG_COMPAT
 #define __ARCH_WANT_COMPAT_SYS_GETDENTS64
 #define __ARCH_WANT_COMPAT_STAT64
@@ -48,3 +51,5 @@ 
 #include <uapi/asm/unistd.h>
 
 #define NR_syscalls (__NR_syscalls)
+
+#endif /* __ASM_ARM64_UNISTD_H */
diff --git a/arch/arm64/include/uapi/asm/unistd.h b/arch/arm64/include/uapi/asm/unistd.h
index 1caadc2..ab72cac 100644
--- a/arch/arm64/include/uapi/asm/unistd.h
+++ b/arch/arm64/include/uapi/asm/unistd.h
@@ -13,4 +13,9 @@ 
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
+#ifndef _UAPI__ASM_ARM64_UNISTD_H
+#define _UAPI__ASM_ARM64_UNISTD_H
+
 #include <asm-generic/unistd.h>
+
+#endif /* _UAPI__ASM_ARM64_UNISTD_H */