All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARC: Add guard macro to uapi/asm/unistd.h
@ 2013-11-21 10:29 Vineet Gupta
  2013-11-21 10:57 ` Chen Gang
  0 siblings, 1 reply; 4+ messages in thread
From: Vineet Gupta @ 2013-11-21 10:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Francois Bedard, Chen Gang, Ingo Molnar, Vineet Gupta,
	David Howells

Chen originally proposed this as "right thing to do" however I
actually ran into this when building perf tools. Some of the utils
include unistd.h as well as linux/unistd.h. Since -I includes kernel
headers too, we end up including the ARC unistd.h twice, leading to
redefinition nwarnings.

------------------>8-------------------
    CC bench/sched-pipe.o
In file included from ~/kernel/arch/arc/include/uapi/asm/unistd.h:21:0,
                 from ~/kernel/include/uapi/linux/unistd.h:7,
                 from bench/sched-pipe.c:24:
~/kernel/include/uapi/asm-generic/unistd.h:889:0: error: "__NR_fcntl64"
redefined [-Werror]
 #define __NR_fcntl64 __NR3264_fcntl
 ^
In file included from
~/gnu/arc-linux-uclibc/sys-include/sys/syscall.h:24:0,
                 from bench/../perf.h:112,
                 from bench/sched-pipe.c:13:
~/gnu/arc-linux-uclibc/include/bits/sysnum.h:761:0: note: this is the
location of the previous definition
------------------>8-------------------

Verified that make headers_install works fine with this.

Suggested-by: Chen Gang <gang.chen.5i5j@gmail.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Cc: David Howells <dhowells@redhat.com>
---
I will be adding this to arc tree for 3.13
---
 arch/arc/include/uapi/asm/unistd.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arc/include/uapi/asm/unistd.h b/arch/arc/include/uapi/asm/unistd.h
index 6f30484f34b7..68125dd766c6 100644
--- a/arch/arc/include/uapi/asm/unistd.h
+++ b/arch/arc/include/uapi/asm/unistd.h
@@ -8,6 +8,9 @@
 
 /******** no-legacy-syscalls-ABI *******/
 
+#ifndef _UAPI_ASM_ARC_UNISTD_H
+#define _UAPI_ASM_ARC_UNISTD_H
+
 #define __ARCH_WANT_SYS_EXECVE
 #define __ARCH_WANT_SYS_CLONE
 #define __ARCH_WANT_SYS_VFORK
@@ -32,3 +35,5 @@ __SYSCALL(__NR_arc_gettls, sys_arc_gettls)
 /* Generic syscall (fs/filesystems.c - lost in asm-generic/unistd.h */
 #define __NR_sysfs		(__NR_arch_specific_syscall + 3)
 __SYSCALL(__NR_sysfs, sys_sysfs)
+
+#endif
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ARC: Add guard macro to uapi/asm/unistd.h
  2013-11-21 10:29 [PATCH] ARC: Add guard macro to uapi/asm/unistd.h Vineet Gupta
@ 2013-11-21 10:57 ` Chen Gang
  2013-11-21 11:02   ` Chen Gang
  2013-11-21 11:09   ` Vineet Gupta
  0 siblings, 2 replies; 4+ messages in thread
From: Chen Gang @ 2013-11-21 10:57 UTC (permalink / raw)
  To: Vineet Gupta; +Cc: linux-kernel, Francois Bedard, Ingo Molnar, David Howells

On 11/21/2013 06:29 PM, Vineet Gupta wrote:
> Chen originally proposed this as "right thing to do" however I
> actually ran into this when building perf tools. Some of the utils
> include unistd.h as well as linux/unistd.h. Since -I includes kernel
> headers too, we end up including the ARC unistd.h twice, leading to
> redefinition nwarnings.
> 
> ------------------>8-------------------
>     CC bench/sched-pipe.o
> In file included from ~/kernel/arch/arc/include/uapi/asm/unistd.h:21:0,
>                  from ~/kernel/include/uapi/linux/unistd.h:7,
>                  from bench/sched-pipe.c:24:
> ~/kernel/include/uapi/asm-generic/unistd.h:889:0: error: "__NR_fcntl64"
> redefined [-Werror]
>  #define __NR_fcntl64 __NR3264_fcntl
>  ^
> In file included from
> ~/gnu/arc-linux-uclibc/sys-include/sys/syscall.h:24:0,
>                  from bench/../perf.h:112,
>                  from bench/sched-pipe.c:13:
> ~/gnu/arc-linux-uclibc/include/bits/sysnum.h:761:0: note: this is the
> location of the previous definition
> ------------------>8-------------------
> 
> Verified that make headers_install works fine with this.
> 
> Suggested-by: Chen Gang <gang.chen.5i5j@gmail.com>
> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
> Cc: David Howells <dhowells@redhat.com>
> ---
> I will be adding this to arc tree for 3.13
> ---
>  arch/arc/include/uapi/asm/unistd.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/arch/arc/include/uapi/asm/unistd.h b/arch/arc/include/uapi/asm/unistd.h
> index 6f30484f34b7..68125dd766c6 100644
> --- a/arch/arc/include/uapi/asm/unistd.h
> +++ b/arch/arc/include/uapi/asm/unistd.h
> @@ -8,6 +8,9 @@
>  
>  /******** no-legacy-syscalls-ABI *******/
>  
> +#ifndef _UAPI_ASM_ARC_UNISTD_H
> +#define _UAPI_ASM_ARC_UNISTD_H
> +
>  #define __ARCH_WANT_SYS_EXECVE
>  #define __ARCH_WANT_SYS_CLONE
>  #define __ARCH_WANT_SYS_VFORK
> @@ -32,3 +35,5 @@ __SYSCALL(__NR_arc_gettls, sys_arc_gettls)
>  /* Generic syscall (fs/filesystems.c - lost in asm-generic/unistd.h */
>  #define __NR_sysfs		(__NR_arch_specific_syscall + 3)
>  __SYSCALL(__NR_sysfs, sys_sysfs)
> +
> +#endif
> 

Is it better to append comment for "#endif"?

e.g. "#endif /* _UAPI_ASM_ARC_UNISTD_H */"


Thanks.
-- 
Chen Gang

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ARC: Add guard macro to uapi/asm/unistd.h
  2013-11-21 10:57 ` Chen Gang
@ 2013-11-21 11:02   ` Chen Gang
  2013-11-21 11:09   ` Vineet Gupta
  1 sibling, 0 replies; 4+ messages in thread
From: Chen Gang @ 2013-11-21 11:02 UTC (permalink / raw)
  To: Vineet Gupta; +Cc: linux-kernel, Francois Bedard, Ingo Molnar, David Howells

On 11/21/2013 06:57 PM, Chen Gang wrote:
> On 11/21/2013 06:29 PM, Vineet Gupta wrote:
>> Chen originally proposed this as "right thing to do" however I
>> actually ran into this when building perf tools. Some of the utils
>> include unistd.h as well as linux/unistd.h. Since -I includes kernel
>> headers too, we end up including the ARC unistd.h twice, leading to
>> redefinition nwarnings.
>>
>> ------------------>8-------------------
>>     CC bench/sched-pipe.o
>> In file included from ~/kernel/arch/arc/include/uapi/asm/unistd.h:21:0,
>>                  from ~/kernel/include/uapi/linux/unistd.h:7,
>>                  from bench/sched-pipe.c:24:
>> ~/kernel/include/uapi/asm-generic/unistd.h:889:0: error: "__NR_fcntl64"
>> redefined [-Werror]
>>  #define __NR_fcntl64 __NR3264_fcntl
>>  ^
>> In file included from
>> ~/gnu/arc-linux-uclibc/sys-include/sys/syscall.h:24:0,
>>                  from bench/../perf.h:112,
>>                  from bench/sched-pipe.c:13:
>> ~/gnu/arc-linux-uclibc/include/bits/sysnum.h:761:0: note: this is the
>> location of the previous definition
>> ------------------>8-------------------
>>
>> Verified that make headers_install works fine with this.
>>
>> Suggested-by: Chen Gang <gang.chen.5i5j@gmail.com>

Also thank you very much, it is my 1st patch with new mail address.  :-)

Thanks.

>> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
>> Cc: David Howells <dhowells@redhat.com>
>> ---
>> I will be adding this to arc tree for 3.13
>> ---
>>  arch/arc/include/uapi/asm/unistd.h | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/arch/arc/include/uapi/asm/unistd.h b/arch/arc/include/uapi/asm/unistd.h
>> index 6f30484f34b7..68125dd766c6 100644
>> --- a/arch/arc/include/uapi/asm/unistd.h
>> +++ b/arch/arc/include/uapi/asm/unistd.h
>> @@ -8,6 +8,9 @@
>>  
>>  /******** no-legacy-syscalls-ABI *******/
>>  
>> +#ifndef _UAPI_ASM_ARC_UNISTD_H
>> +#define _UAPI_ASM_ARC_UNISTD_H
>> +
>>  #define __ARCH_WANT_SYS_EXECVE
>>  #define __ARCH_WANT_SYS_CLONE
>>  #define __ARCH_WANT_SYS_VFORK
>> @@ -32,3 +35,5 @@ __SYSCALL(__NR_arc_gettls, sys_arc_gettls)
>>  /* Generic syscall (fs/filesystems.c - lost in asm-generic/unistd.h */
>>  #define __NR_sysfs		(__NR_arch_specific_syscall + 3)
>>  __SYSCALL(__NR_sysfs, sys_sysfs)
>> +
>> +#endif
>>
> 
> Is it better to append comment for "#endif"?
> 
> e.g. "#endif /* _UAPI_ASM_ARC_UNISTD_H */"
> 
> 
> Thanks.
> 


-- 
Chen Gang

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ARC: Add guard macro to uapi/asm/unistd.h
  2013-11-21 10:57 ` Chen Gang
  2013-11-21 11:02   ` Chen Gang
@ 2013-11-21 11:09   ` Vineet Gupta
  1 sibling, 0 replies; 4+ messages in thread
From: Vineet Gupta @ 2013-11-21 11:09 UTC (permalink / raw)
  To: Chen Gang
  Cc: linux-kernel@vger.kernel.org, Francois Bedard, Ingo Molnar,
	David Howells

On 11/21/2013 04:25 PM, Chen Gang wrote:
>> +
>> > +#endif
>> > 
> Is it better to append comment for "#endif"?
>
> e.g. "#endif /* _UAPI_ASM_ARC_UNISTD_H */"

It's a preference thing. I do it when there are multiple #endif's, hence need some
disambiguation.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-11-21 11:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-21 10:29 [PATCH] ARC: Add guard macro to uapi/asm/unistd.h Vineet Gupta
2013-11-21 10:57 ` Chen Gang
2013-11-21 11:02   ` Chen Gang
2013-11-21 11:09   ` Vineet Gupta

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.