public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH V2 08/32] Check if __GLIBC_PREREQ is defined before using it
Date: Wed, 3 Feb 2016 13:42:02 +0100	[thread overview]
Message-ID: <20160203124202.GA30788@rei.lan> (raw)
In-Reply-To: <1452302060-103643-8-git-send-email-raj.khem@gmail.com>

Hi!
> diff --git a/testcases/kernel/syscalls/accept4/accept4_01.c b/testcases/kernel/syscalls/accept4/accept4_01.c
> index 6072bfa..2b090cb 100644
> --- a/testcases/kernel/syscalls/accept4/accept4_01.c
> +++ b/testcases/kernel/syscalls/accept4/accept4_01.c
> @@ -64,6 +64,7 @@ static void cleanup(void)
>  	tst_rmdir();
>  }
>  
> +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
>  #if !(__GLIBC_PREREQ(2, 10))
>  static int
>  accept4_01(int fd, struct sockaddr *sockaddr, socklen_t *addrlen, int flags)
> @@ -82,7 +83,6 @@ accept4_01(int fd, struct sockaddr *sockaddr, socklen_t *addrlen, int flags)
>  	}
>  	tst_resm(TINFO, "\n");
>  #endif
> -
>  #if USE_SOCKETCALL
>  	long args[6];
>  
> @@ -97,6 +97,7 @@ accept4_01(int fd, struct sockaddr *sockaddr, socklen_t *addrlen, int flags)
>  #endif
>  }
>  #endif
> +#endif
>  
>  static void
>  do_test(int lfd, struct sockaddr_in *conn_addr,
> @@ -119,9 +120,15 @@ do_test(int lfd, struct sockaddr_in *conn_addr,
>  		die("Connect Error");
>  
>  	addrlen = sizeof(struct sockaddr_in);
> +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
>  #if !(__GLIBC_PREREQ(2, 10))
>  	acceptfd = accept4_01(lfd, (struct sockaddr *)&claddr, &addrlen,
>  			      closeonexec_flag | nonblock_flag);
> +
> +#else
> +	acceptfd = accept4(lfd, (struct sockaddr *)&claddr, &addrlen,
> +			   closeonexec_flag | nonblock_flag);
> +#endif
>  #else
>  	acceptfd = accept4(lfd, (struct sockaddr *)&claddr, &addrlen,
>  			   closeonexec_flag | nonblock_flag);

This should be ideally converted to configure check for accept4() rather
than adding more #ifdefs around.

> diff --git a/testcases/kernel/syscalls/getcpu/getcpu01.c b/testcases/kernel/syscalls/getcpu/getcpu01.c
> index c927512..6de6362 100644
> --- a/testcases/kernel/syscalls/getcpu/getcpu01.c
> +++ b/testcases/kernel/syscalls/getcpu/getcpu01.c

We allready have fallback definitions for the CPU_SET* macros in
testcases/kernel/syscalls/sched_setaffinity/sched_setaffinity.h the
header should be moved to include/lapi/cpu_set.h and included in all
the testcases so that we can drop most of these GLIBC_PREREQ() instead
of adding more #ifdefs around.

-- 
Cyril Hrubis
chrubis@suse.cz

  reply	other threads:[~2016-02-03 12:42 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-09  1:13 [LTP] [PATCH V2 01/32] ltp: Don't link against libfl Khem Raj
2016-01-09  1:13 ` [LTP] [PATCH V2 02/32] Add knob to control whether numa support should be checked Khem Raj
2016-02-03 14:14   ` Cyril Hrubis
2016-01-09  1:13 ` [LTP] [PATCH V2 03/32] Add knob to control tirpc support Khem Raj
2016-02-03 14:14   ` Cyril Hrubis
2016-01-09  1:13 ` [LTP] [PATCH V2 04/32] build: Add option to select libc implementation Khem Raj
2016-02-02 15:45   ` Cyril Hrubis
2016-01-09  1:13 ` [LTP] [PATCH V2 05/32] kernel/controllers: Link with libfts explicitly on musl Khem Raj
2016-02-02 15:48   ` Cyril Hrubis
2016-01-09  1:13 ` [LTP] [PATCH V2 06/32] sendfile: Use off64_t instead of __off64_t Khem Raj
2016-01-09  1:13 ` [LTP] [PATCH V2 07/32] replace SIGCLD with SIGCHLD Khem Raj
2016-02-02 15:59   ` Cyril Hrubis
2016-01-09  1:13 ` [LTP] [PATCH V2 08/32] Check if __GLIBC_PREREQ is defined before using it Khem Raj
2016-02-03 12:42   ` Cyril Hrubis [this message]
2016-01-09  1:13 ` [LTP] [PATCH V2 09/32] Guard error.h with __GLIBC__ Khem Raj
2016-02-02 15:41   ` Cyril Hrubis
2016-01-09  1:13 ` [LTP] [PATCH V2 10/32] replace __BEGIN_DECLS and __END_DECLS Khem Raj
2016-02-02 15:52   ` Cyril Hrubis
2016-01-09  1:13 ` [LTP] [PATCH V2 11/32] Rename sigset variable to sigset1 Khem Raj
2016-01-09  1:14 ` [LTP] [PATCH V2 12/32] fsstress.c: Replace __int64_t with int64_t Khem Raj
2016-01-09  1:14 ` [LTP] [PATCH V2 13/32] include fcntl.h for getting O_* definitions Khem Raj
2016-01-09  1:14 ` [LTP] [PATCH V2 14/32] hyperthreading: Include sys/types.h for pid_t definition Khem Raj
2016-01-09  1:14 ` [LTP] [PATCH V2 15/32] mincore01: Rename PAGESIZE to pagesize Khem Raj
2016-02-02 18:04   ` Cyril Hrubis
2016-01-09  1:14 ` [LTP] [PATCH V2 16/32] ustat: Change header from ustat.h to sys/ustat.h Khem Raj
2016-01-09  1:14 ` [LTP] [PATCH V2 17/32] replace sigval_t with union sigval Khem Raj
2016-01-09  1:14 ` [LTP] [PATCH V2 18/32] guard mallocopt() with __GLIBC__ Khem Raj
2016-02-02 16:15   ` Cyril Hrubis
2016-01-09  1:14 ` [LTP] [PATCH V2 19/32] tomoyo: Replace canonicalize_file_name() with realpath() Khem Raj
2016-01-09  1:14 ` [LTP] [PATCH V2 20/32] getdents: define getdents/getdents64 only for glibc Khem Raj
2016-02-02 16:48   ` Cyril Hrubis
2016-01-09  1:14 ` [LTP] [PATCH V2 21/32] Define _GNU_SOURCE for MREMAP_MAYMOVE definition Khem Raj
2016-02-02 16:51   ` Cyril Hrubis
2016-01-09  1:14 ` [LTP] [PATCH V2 22/32] include sys/types.h Khem Raj
2016-02-02 17:02   ` Cyril Hrubis
2016-01-09  1:14 ` [LTP] [PATCH V2 23/32] ptrace: Use int instead of enum __ptrace_request Khem Raj
2016-02-02 17:02   ` Cyril Hrubis
2016-01-09  1:14 ` [LTP] [PATCH V2 24/32] rt_sigaction/rt_sigprocmark: Define _GNU_SOURCE Khem Raj
2016-02-02 17:08   ` Cyril Hrubis
2016-01-09  1:14 ` [LTP] [PATCH V2 25/32] mc_gethost: include sys/types.h Khem Raj
2016-02-02 17:09   ` Cyril Hrubis
2016-01-09  1:14 ` [LTP] [PATCH V2 26/32] crash01: Define _GNU_SOURCE Khem Raj
2016-02-02 17:10   ` Cyril Hrubis
2016-01-09  1:14 ` [LTP] [PATCH V2 27/32] sysconf01: Use _SC_2_C_VERSION conditionally Khem Raj
2016-02-02 17:14   ` Cyril Hrubis
2016-01-09  1:14 ` [LTP] [PATCH V2 28/32] rt_sigaction.h: Use sighandler_t instead of __sighandler_t Khem Raj
2016-02-02 17:21   ` Cyril Hrubis
2016-01-09  1:14 ` [LTP] [PATCH V2 29/32] trace_shed: Fix build with musl Khem Raj
2016-02-02 17:28   ` Cyril Hrubis
2016-01-09  1:14 ` [LTP] [PATCH V2 30/32] lib: Use PTHREAD_MUTEX_RECURSIVE in place of PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP for non-glibc Khem Raj
2016-01-09  7:44   ` Khem Raj
2016-01-09  1:14 ` [LTP] [PATCH V2 31/32] vma03: fix page size offset as per page size alignment Khem Raj
2016-02-03 13:30   ` Cyril Hrubis
2016-01-09  1:14 ` [LTP] [PATCH V2 32/32] regen.sh: Include asm/unistd.h explicitly Khem Raj
2016-02-02 18:02 ` [LTP] [PATCH V2 01/32] ltp: Don't link against libfl Cyril Hrubis
2016-02-02 18:43   ` Khem Raj

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=20160203124202.GA30788@rei.lan \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /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