linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests/core: fix conflicting types compile error for close_range()
@ 2021-10-27 19:26 Shuah Khan
  2021-11-01  9:32 ` Christian Brauner
  0 siblings, 1 reply; 2+ messages in thread
From: Shuah Khan @ 2021-10-27 19:26 UTC (permalink / raw)
  To: shuah, christian.brauner; +Cc: Shuah Khan, linux-kselftest, linux-kernel

close_range() test type conflicts with close_range() library call in
x86_64-linux-gnu/bits/unistd_ext.h. Fix it by changing the name to
core_close_range().

gcc -g -I../../../../usr/include/    close_range_test.c  -o ../tools/testing/selftests/core/close_range_test
In file included from close_range_test.c:16:
close_range_test.c:57:6: error: conflicting types for ‘close_range’; have ‘void(struct __test_metadata *)’
   57 | TEST(close_range)
      |      ^~~~~~~~~~~
../kselftest_harness.h:181:21: note: in definition of macro ‘__TEST_IMPL’
  181 |         static void test_name(struct __test_metadata *_metadata); \
      |                     ^~~~~~~~~
close_range_test.c:57:1: note: in expansion of macro ‘TEST’
   57 | TEST(close_range)
      | ^~~~
In file included from /usr/include/unistd.h:1204,
                 from close_range_test.c:13:
/usr/include/x86_64-linux-gnu/bits/unistd_ext.h:56:12: note: previous declaration of ‘close_range’ with type ‘int(unsigned int,  unsigned int,  int)’
   56 | extern int close_range (unsigned int __fd, unsigned int __max_fd,
      |            ^~~~~~~~~~~

Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
---
 tools/testing/selftests/core/close_range_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/core/close_range_test.c b/tools/testing/selftests/core/close_range_test.c
index 73eb29c916d1..aa7d13d91963 100644
--- a/tools/testing/selftests/core/close_range_test.c
+++ b/tools/testing/selftests/core/close_range_test.c
@@ -54,7 +54,7 @@ static inline int sys_close_range(unsigned int fd, unsigned int max_fd,
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 #endif
 
-TEST(close_range)
+TEST(core_close_range)
 {
 	int i, ret;
 	int open_fds[101];
-- 
2.32.0


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

* Re: [PATCH] selftests/core: fix conflicting types compile error for close_range()
  2021-10-27 19:26 [PATCH] selftests/core: fix conflicting types compile error for close_range() Shuah Khan
@ 2021-11-01  9:32 ` Christian Brauner
  0 siblings, 0 replies; 2+ messages in thread
From: Christian Brauner @ 2021-11-01  9:32 UTC (permalink / raw)
  To: Shuah Khan; +Cc: shuah, linux-kselftest, linux-kernel

On Wed, Oct 27, 2021 at 01:26:19PM -0600, Shuah Khan wrote:
> close_range() test type conflicts with close_range() library call in
> x86_64-linux-gnu/bits/unistd_ext.h. Fix it by changing the name to
> core_close_range().
> 
> gcc -g -I../../../../usr/include/    close_range_test.c  -o ../tools/testing/selftests/core/close_range_test
> In file included from close_range_test.c:16:
> close_range_test.c:57:6: error: conflicting types for ‘close_range’; have ‘void(struct __test_metadata *)’
>    57 | TEST(close_range)
>       |      ^~~~~~~~~~~
> ../kselftest_harness.h:181:21: note: in definition of macro ‘__TEST_IMPL’
>   181 |         static void test_name(struct __test_metadata *_metadata); \
>       |                     ^~~~~~~~~
> close_range_test.c:57:1: note: in expansion of macro ‘TEST’
>    57 | TEST(close_range)
>       | ^~~~
> In file included from /usr/include/unistd.h:1204,
>                  from close_range_test.c:13:
> /usr/include/x86_64-linux-gnu/bits/unistd_ext.h:56:12: note: previous declaration of ‘close_range’ with type ‘int(unsigned int,  unsigned int,  int)’
>    56 | extern int close_range (unsigned int __fd, unsigned int __max_fd,
>       |            ^~~~~~~~~~~
> 
> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
> ---

Looks good. thank you!
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>

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

end of thread, other threads:[~2021-11-01  9:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-27 19:26 [PATCH] selftests/core: fix conflicting types compile error for close_range() Shuah Khan
2021-11-01  9:32 ` Christian Brauner

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).