ltp: Don't link against libfl
Subsystems (2)
PATCH 1/31 ltp: Don't link against libfl
From: Chong Lu <[email protected]>
We have already defined yywrap function in scan.l file. After this, we no longer need to link against libfl and so no longer get errors about undefined references to yylex.
--- pan/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
pan/Makefile +1 -1
@@ -31,7 +31,7 @@ CPPFLAGS += -Wno-error CPPFLAGS += -I$(abs_srcdir) -LDLIBS += -lm $(LEXLIB) +LDLIBS += -lm LFLAGS += -l
Signature · 1 line
2.7.0
PATCH 2/31 Add knob to control whether numa support should be checked
From: "Roy.Li" <[email protected]>
otherwise undeterministic dependency will be generated during build depending upong numa being staged or not
--- m4/ltp-numa.m4 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
m4/ltp-numa.m4 +9 -1
@@ -24,7 +24,13 @@ dnl ---------------------------- dnl AC_DEFUN([LTP_CHECK_SYSCALL_NUMA], [dnl -AC_CHECK_HEADERS([linux/mempolicy.h numa.h numaif.h],[ +AC_MSG_CHECKING([for numa]) +AC_ARG_WITH( + [numa], + AC_HELP_STRING([--without-numa], + [without numa support]), + [], + [AC_CHECK_HEADERS([linux/mempolicy.h numa.h numaif.h],[ LTP_SYSCALL_NUMA_HEADERS=yes AC_CHECK_LIB(numa,numa_alloc_onnode,[have_numa_alloc_onnode="yes"]) if test "x$have_numa_alloc_onnode" = "xyes"; then
@@ -48,3 +54,5 @@ if test "x$have_mpol_constants" = "xyes"; then AC_DEFINE(HAVE_MPOL_CONSTANTS,1,[define to 1 if you have all constants required to use mbind tests]) fi )]) +AC_MSG_RESULT([$with_numa]) +])
Signature · 1 line
2.7.0
PATCH 3/31 Add knob to control tirpc support
In reply to Khem RajFrom: Fathi Boudra <[email protected]>
allow to disable tirpc. Helps to disable it at top level for eg. musl it does not yet work.
--- configure.ac | 9 +++++++++ 1 file changed, 9 insertions(+)
configure.ac +9 -0
@@ -98,6 +98,13 @@ if test "x$with_python" = xyes; then else AC_SUBST([WITH_PYTHON],["no"]) fi + +# TI RPC +AC_ARG_WITH([tirpc], + AC_HELP_STRING([--without-tirpc], + [without libtirpc support]), + [],[with_tirpc=yes], +) # END tools knobs # Testsuites knobs
@@ -169,7 +176,9 @@ LTP_CHECK_RENAMEAT2 LTP_CHECK_FALLOCATE LTP_CHECK_SYSCALL_FCNTL LTP_CHECK_SYSCALL_PERF_EVENT_OPEN +if test "x$with_tirpc" = xyes; then LTP_CHECK_TIRPC +fi LTP_CHECK_TEE LTP_CHECK_SPLICE LTP_CHECK_VMSPLICE
Signature · 1 line
2.7.0
PATCH 4/31 build: Add option to select libc implementation
In reply to Khem RajThere are more than glibc for C library implementation available on linux now a days, uclibc cloaked like glibc but musl e.g. is very different and does not implement all GNU extentions
Disable tests specifically not building _yet_ on musl based systems
--- Makefile | 5 +++++ testcases/kernel/Makefile | 5 ++++- testcases/kernel/sched/Makefile | 4 +++- testcases/kernel/syscalls/Makefile | 5 +++++ testcases/network/nfsv4/acl/Makefile | 4 ++++ testcases/network/rpc/Makefile | 3 +++ testcases/realtime/func/pi-tests/Makefile | 4 ++++ testcases/realtime/stress/pi-tests/Makefile | 5 +++++ 8 files changed, 33 insertions(+), 2 deletions(-)
Makefile +5 -0
@@ -49,6 +49,11 @@ SKIP_IDCHECK ?= 0 UCLINUX ?= 0 export UCLINUX +# System C library implementation (glibc,uclibc,musl etc.) +# default to glibc if not set +LIBC ?= glibc +export LIBC + # CLEAN_TARGETS: Targets which exist solely in clean. # COMMON_TARGETS: Targets which exist in all, clean, and install. # INSTALL_TARGETS: Targets which exist in clean and install (contains
testcases/kernel/Makefile +4 -1
@@ -47,13 +47,16 @@ SUBDIRS += connectors \ logging \ mem \ numa \ - pty \ sched \ security \ timers \ tracing \ module \ +ifneq ($(LIBC),musl) +SUBDIRS += pty +endif + ifeq ($(WITH_POWER_MANAGEMENT_TESTSUITE),yes) SUBDIRS += power_management endif
testcases/kernel/sched/Makefile +3 -1
@@ -23,5 +23,7 @@ top_srcdir ?= ../../.. include $(top_srcdir)/include/mk/env_pre.mk - +ifeq ($(LIBC),musl) + FILTER_OUT_DIRS += process_stress +endif include $(top_srcdir)/include/mk/generic_trunk_target.mk
testcases/kernel/syscalls/Makefile +5 -0
@@ -28,5 +28,10 @@ ifeq ($(UCLINUX),1) FILTER_OUT_DIRS += capget capset chmod chown clone fork getcontext llseek \ mincore mprotect nftw profil remap_file_pages sbrk endif +ifeq ($(LIBC),musl) +FILTER_OUT_DIRS += confstr fmtmsg getcontext ioctl mallopt profil \ + rt_sigsuspend setdomainname sethostname sigsuspend \ + ustat +endif include $(top_srcdir)/include/mk/generic_trunk_target.mk
testcases/network/nfsv4/acl/Makefile +4 -0
@@ -26,4 +26,8 @@ include $(top_srcdir)/include/mk/env_pre.mk LDLIBS += $(ACL_LIBS) +ifeq ($(LIBC),musl) +FILTER_OUT_MAKE_TARGETS := acl1 +endif + include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/network/rpc/Makefile +3 -0
@@ -29,5 +29,8 @@ INSTALL_TARGETS := *.sh ifeq ($(TIRPC_LIBS),) FILTER_OUT_DIRS += rpc-tirpc endif +ifeq ($(LIBC),musl) +FILTER_OUT_DIRS += basic_tests +endif include $(top_srcdir)/include/mk/generic_trunk_target.mk
testcases/realtime/func/pi-tests/Makefile +4 -0
@@ -27,5 +27,9 @@ include $(top_srcdir)/include/mk/env_pre.mk include $(abs_srcdir)/../../config.mk MAKE_TARGETS := testpi-0 testpi-1 testpi-2 testpi-4 testpi-5 testpi-6 testpi-7 sbrk_mutex +ifeq ($(LIBC),musl) +FILTER_OUT_MAKE_TARGETS := testpi-5 testpi-6 sbrk_mutex +endif + include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/realtime/stress/pi-tests/Makefile +5 -0
@@ -24,4 +24,9 @@ top_srcdir ?= ../../../.. include $(top_srcdir)/include/mk/env_pre.mk include $(abs_srcdir)/../../config.mk + +ifeq ($(LIBC),musl) +FILTER_OUT_MAKE_TARGETS := testpi-3 +endif + include $(top_srcdir)/include/mk/generic_leaf_target.mk
Signature · 1 line
2.7.0
PATCH 5/31 kernel/controllers: Link with libfts explicitly on musl
In reply to Khem Rajmusl does not implement fts like glibc and therefore it depends on external implementation for all fts APIs
--- testcases/kernel/controllers/Makefile.inc | 3 +++ testcases/kernel/controllers/cpuset/Makefile.inc | 3 +++ 2 files changed, 6 insertions(+)
testcases/kernel/controllers/Makefile.inc +3 -0
@@ -36,6 +36,9 @@ MAKE_DEPS := $(LIB) CPPFLAGS += -I$(abs_srcdir)/../$(LIBDIR) LDFLAGS += -L$(abs_builddir)/../$(LIBDIR) +ifeq ($(LIBC),musl) +LDLIBS += -lfts +endif INSTALL_TARGETS ?= *.sh
testcases/kernel/controllers/cpuset/Makefile.inc +3 -0
@@ -42,6 +42,9 @@ MAKE_DEPS := $(LIBCONTROLLERS) $(LIBCPUSET) LDFLAGS += -L$(abs_builddir)/$(LIBCPUSET_DIR) -L$(abs_builddir)/$(LIBCONTROLLERS_DIR) LDLIBS += -lcpu_set -lcontrollers -lltp +ifeq ($(LIBC),musl) +LDLIBS += -lfts +endif INSTALL_TARGETS ?= *.sh
Signature · 1 line
2.7.0
PATCH 6/31 sendfile: Use off64_t instead of __off64_t
In reply to Khem Raj__off64_t is specific to glibc where as off64_t is widely available Add _GNU_SOURCE for off64_t defines from sys/types.h Fixes
<command-line>:0:7: error: unknown type name 'off64_t' sendfile02.c:97:18: note: in expansion of macro 'OFF_T'
--- testcases/kernel/syscalls/sendfile/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/syscalls/sendfile/Makefile +1 -1
@@ -21,6 +21,6 @@ top_srcdir ?= ../../../.. include $(top_srcdir)/include/mk/testcases.mk include $(abs_srcdir)/../utils/newer_64.mk -%_64: CPPFLAGS += -D_FILE_OFFSET_BITS=64 -DOFF_T=__off64_t +%_64: CPPFLAGS += -D_FILE_OFFSET_BITS=64 -DOFF_T=off64_t -D_GNU_SOURCE include $(top_srcdir)/include/mk/generic_leaf_target.mk
Signature · 1 line
2.7.0
PATCH 7/31 replace SIGCLD with SIGCHLD
In reply to Khem Rajits defined to use SIGCHLD anyway in
bits/signum.h:#define SIGCLD SIGCHLD /* Same as SIGCHLD
(System V). */
plus it helps these tests compile with musl which adheres to posix
--- lib/tst_sig.c | 8 ++++---- testcases/kernel/connectors/pec/pec_listener.c | 1 + testcases/kernel/fs/doio/doio.c | 4 ++-- testcases/kernel/fs/doio/growfiles.c | 2 +- testcases/kernel/syscalls/fcntl/fcntl11.c | 8 ++++---- testcases/kernel/syscalls/fcntl/fcntl17.c | 8 ++++---- testcases/kernel/syscalls/fcntl/fcntl19.c | 8 ++++---- testcases/kernel/syscalls/fcntl/fcntl20.c | 8 ++++---- testcases/kernel/syscalls/fcntl/fcntl21.c | 8 ++++---- testcases/kernel/syscalls/kill/kill02.c | 6 +++--- testcases/kernel/syscalls/kill/kill12.c | 8 ++++---- testcases/kernel/syscalls/mkdir/mkdir09.c | 12 ++++++------ testcases/kernel/syscalls/sighold/sighold02.c | 2 +- testcases/network/tcp_cmds/perf_lan/pingpong.c | 2 +- testcases/network/tcp_cmds/perf_lan/pingpong6.c | 2 +- 15 files changed, 44 insertions(+), 43 deletions(-)
lib/tst_sig.c +4 -4
@@ -49,7 +49,7 @@ fork_flag - set to FORK or NOFORK depending upon whether the calling program executes a fork() system call. It is normally the case that the calling program treats - SIGCLD as an expected signal if fork() is being used. + SIGCHLD as an expected signal if fork() is being used. handler - a pointer to the unexpected signal handler to be executed after an unexpected signal has been
@@ -82,7 +82,7 @@ static void (*tst_setup_signal(int, void (*)(int))) (int);/**************************************************************************** * tst_sig() : set-up to catch unexpected signals. fork_flag is set to NOFORK -* if SIGCLD is to be an "unexpected signal", otherwise it is set to +* if SIGCHLD is to be an "unexpected signal", otherwise it is set to * FORK. cleanup points to a cleanup routine to be executed before * tst_exit is called (cleanup is set to NULL if no cleanup is desired). * handler is a pointer to the signal handling routine (if handler is
@@ -117,7 +117,7 @@ void tst_sig(int fork_flag, void (*handler) (), void (*cleanup) ())for (sig =1 ; sig <NSIG ; sig++) {/* * SIGKILL is never unexpected. -* SIGCLD is only unexpected when +* SIGCHLD is only unexpected when * no forking is being done. * SIGINFO is used for file quotas and should be expected */
@@ -205,7 +205,7 @@ void tst_sig(int fork_flag, void (*handler) (), void (*cleanup) ())#endif break ; -case SIGCLD : +case SIGCHLD :if (fork_flag ==FORK )continue ;
testcases/kernel/connectors/pec/pec_listener.c +1 -0
@@ -20,6 +20,7 @@/* */ /******************************************************************************/ +#define _GNU_SOURCE#include <sys/socket.h> #include <sys/poll.h> #include <sys/types.h>
testcases/kernel/fs/doio/doio.c +2 -2
@@ -573,7 +573,7 @@ int main(int argc, char **argv)case SIGTSTP :case SIGSTOP :case SIGCONT : -case SIGCLD : +case SIGCHLD :case SIGBUS :case SIGSEGV :case SIGQUIT :
@@ -615,7 +615,7 @@ int main(int argc, char **argv) }sigemptyset (&block_mask); -sigaddset (&block_mask,SIGCLD ); +sigaddset (&block_mask,SIGCHLD );sigprocmask (SIG_BLOCK , &block_mask, &omask);/*
testcases/kernel/fs/doio/growfiles.c +1 -1
@@ -1640,7 +1640,7 @@ int set_sig(void)#ifdef SIGRESTART case SIGRESTART :#endif /* SIGRESTART */ -case SIGCLD : +case SIGCHLD :break ;default :
testcases/kernel/syscalls/fcntl/fcntl11.c +4 -4
@@ -105,10 +105,10 @@ void setup(void)memset (&act,0 ,sizeof (act)); act.sa_handler = catch_child;sigemptyset (&act.sa_mask); -sigaddset (&act.sa_mask,SIGCLD ); -if ((sigaction (SIGCLD , &act,NULL )) <0 ) +sigaddset (&act.sa_mask,SIGCHLD ); +if ((sigaction (SIGCHLD , &act,NULL )) <0 )tst_brkm (TBROK |TERRNO , cleanup, -"sigaction(SIGCLD, ..) failed" ); +"sigaction(SIGCHLD, ..) failed" ); }void do_child (void )
@@ -227,7 +227,7 @@ void stop_child(void) {struct flock fl; -signal (SIGCLD ,SIG_DFL ); +signal (SIGCHLD ,SIG_DFL ); fl.l_type =STOP ;parent_put (&fl);wait (0 );
testcases/kernel/syscalls/fcntl/fcntl17.c +4 -4
@@ -150,9 +150,9 @@ int setup(void)memset (&act,0 ,sizeof (act)); act.sa_handler = catch_child;sigemptyset (&act.sa_mask); -sigaddset (&act.sa_mask,SIGCLD ); -if (sigaction (SIGCLD , &act,NULL ) <0 ) { -tst_resm (TFAIL ,"SIGCLD signal setup failed, errno: %d" , errno); +sigaddset (&act.sa_mask,SIGCHLD ); +if (sigaction (SIGCHLD , &act,NULL ) <0 ) { +tst_resm (TFAIL ,"SIGCHLD signal setup failed, errno: %d" , errno);return 1 ; }return 0 ;
@@ -381,7 +381,7 @@ void stop_children(void) {int arg; -signal (SIGCLD ,SIG_DFL ); +signal (SIGCHLD ,SIG_DFL ); arg =STOP ;child_free (child_pipe1[1 ], arg);child_free (child_pipe2[1 ], arg);
testcases/kernel/syscalls/fcntl/fcntl19.c +4 -4
@@ -112,9 +112,9 @@ void setup(void)memset (&act,0 ,sizeof (act)); act.sa_handler = catch_child;sigemptyset (&act.sa_mask); -sigaddset (&act.sa_mask,SIGCLD ); -if ((sigaction (SIGCLD , &act,NULL )) <0 ) { -tst_resm (TFAIL ,"SIGCLD signal setup failed, errno: %d" , errno); +sigaddset (&act.sa_mask,SIGCHLD ); +if ((sigaction (SIGCHLD , &act,NULL )) <0 ) { +tst_resm (TFAIL ,"SIGCHLD signal setup failed, errno: %d" , errno); fail =1 ; } }
@@ -265,7 +265,7 @@ void stop_child(void) {struct flock fl; -signal (SIGCLD ,SIG_DFL ); +signal (SIGCHLD ,SIG_DFL ); fl.l_type =STOP ;parent_put (&fl);wait (0 );
testcases/kernel/syscalls/fcntl/fcntl20.c +4 -4
@@ -109,9 +109,9 @@ void setup(void)memset (&act,0 ,sizeof (act)); act.sa_handler = catch_child;sigemptyset (&act.sa_mask); -sigaddset (&act.sa_mask,SIGCLD ); -if (sigaction (SIGCLD , &act,NULL ) ==-1 ) -tst_brkm (TFAIL |TERRNO , cleanup,"SIGCLD signal setup failed" ); +sigaddset (&act.sa_mask,SIGCHLD ); +if (sigaction (SIGCHLD , &act,NULL ) ==-1 ) +tst_brkm (TFAIL |TERRNO , cleanup,"SIGCHLD signal setup failed" ); }void cleanup (void )
@@ -264,7 +264,7 @@ void stop_child(void) {struct flock fl; -signal (SIGCLD ,SIG_DFL ); +signal (SIGCHLD ,SIG_DFL ); fl.l_type =STOP ;parent_put (&fl);wait (0 );
testcases/kernel/syscalls/fcntl/fcntl21.c +4 -4
@@ -110,9 +110,9 @@ void setup(void)memset (&act,0 ,sizeof (act)); act.sa_handler = catch_child;sigemptyset (&act.sa_mask); -sigaddset (&act.sa_mask,SIGCLD ); -if ((sigaction (SIGCLD , &act,NULL )) <0 ) { -tst_resm (TFAIL ,"SIGCLD signal setup failed, errno: %d" , errno); +sigaddset (&act.sa_mask,SIGCHLD ); +if ((sigaction (SIGCHLD , &act,NULL )) <0 ) { +tst_resm (TFAIL ,"SIGCHLD signal setup failed, errno: %d" , errno); fail =1 ; } }
@@ -272,7 +272,7 @@ void stop_child(void) {struct flock fl; -signal (SIGCLD ,SIG_DFL ); +signal (SIGCHLD ,SIG_DFL ); fl.l_type =STOP ;parent_put (&fl);wait (0 );
testcases/kernel/syscalls/kill/kill02.c +3 -3
@@ -701,7 +701,7 @@ void setup(void)/* * Set to catch unexpected signals. -* SIGCLD is set to be ignored because we do not wait for termination status. +* SIGCHLD is set to be ignored because we do not wait for termination status. * SIGUSR1 is set to be ignored because this is the signal we are using for * the test and we are not concerned with the parent getting it. */
@@ -713,9 +713,9 @@ void setup(void) "signal(SIGUSR1, SIG_IGN) failed"); } -if (signal (SIGCLD ,SIG_IGN ) ==SIG_ERR ) { +if (signal (SIGCHLD ,SIG_IGN ) ==SIG_ERR ) {tst_brkm (TBROK |TERRNO ,NULL , -"signal(SIGCLD, SIG_IGN) failed" ); +"signal(SIGCHLD, SIG_IGN) failed" ); }TEST_PAUSE ;
testcases/kernel/syscalls/kill/kill12.c +4 -4
@@ -98,7 +98,7 @@ int main(int argc, char **argv) exno =1 ; -if (sigset (SIGCLD , chsig) ==SIG_ERR ) { +if (sigset (SIGCHLD , chsig) ==SIG_ERR ) {fprintf (temp,"\tsigset failed, errno = %d\n" , errno);fail_exit (); }
@@ -128,7 +128,7 @@ int main(int argc, char **argv)sleep (1 );kill (pid, sig);/* child should ignroe this sig */ -kill (pid,SIGCLD );/* child should exit */ +kill (pid,SIGCHLD );/* child should exit */ #ifdef BCS while ((npid = wait(&status)) != pid
@@ -222,14 +222,14 @@ void do_child(void)int exno =1 ;#ifdef UCLINUX -if (sigset (SIGCLD , chsig) ==SIG_ERR ) { +if (sigset (SIGCHLD , chsig) ==SIG_ERR ) {fprintf (temp,"\tsigset failed, errno = %d\n" , errno);fail_exit (); }#endif sigset (sig,SIG_IGN );/* set to ignore signal */ -kill (getppid (),SIGCLD );/* tell parent we are ready */ +kill (getppid (),SIGCHLD );/* tell parent we are ready */ while (!chflag)sleep (1 );/* wait for parent */
testcases/kernel/syscalls/mkdir/mkdir09.c +6 -6
@@ -122,10 +122,10 @@ int main(int argc, char *argv[]) } -/* Set up to catch SIGCLD signal */ -if (signal (SIGCLD , chld) ==SIG_ERR ) { +/* Set up to catch SIGCHLD signal */ +if (signal (SIGCHLD , chld) ==SIG_ERR ) {tst_brkm (TFAIL , cleanup, -"Error setting up SIGCLD signal, ERRNO = %d" , errno); +"Error setting up SIGCHLD signal, ERRNO = %d" , errno); }
@@ -236,9 +236,9 @@ int runtest(void)tst_brkm (TFAIL , cleanup,"Error resetting SIGTERM signal, ERRNO = %d" , errno); } -if (signal (SIGCLD ,SIG_DFL ) ==SIG_ERR ) { +if (signal (SIGCHLD ,SIG_DFL ) ==SIG_ERR ) {tst_brkm (TFAIL , cleanup, -"Error resetting SIGCLD signal, ERRNO = %d" , errno); +"Error resetting SIGCHLD signal, ERRNO = %d" , errno); }if (test_time) {
@@ -372,7 +372,7 @@ void term(int sig)void chld (int sig) { -/* Routine to handle SIGCLD signal. */ +/* Routine to handle SIGCHLD signal. */ sigchld++;if (jump) {
testcases/kernel/syscalls/sighold/sighold02.c +1 -1
@@ -77,7 +77,7 @@ static int sigs_map[NUMSIGS];static int skip_sig (int sig) {switch (sig) { -case SIGCLD : +case SIGCHLD :case SIGKILL :case SIGALRM :case SIGSTOP :
testcases/network/tcp_cmds/perf_lan/pingpong.c +1 -1
@@ -182,7 +182,7 @@ int main(int argc, char *argv[])/* Setup traps */ signal (SIGINT , finish); -signal (SIGCLD , finish); +signal (SIGCHLD , finish);/* Fork a child process to continue sending packets */ tst_resm (TINFO ,"Create a child process to continue to send packets" );
testcases/network/tcp_cmds/perf_lan/pingpong6.c +1 -1
@@ -153,7 +153,7 @@ char *argv[];/* Setup traps */ signal (SIGINT , finish); -signal (SIGCLD , finish); +signal (SIGCHLD , finish);/* Fork a child process to continue sending packets */ printf ("Create a child process to continue to send packets \n" );
Signature · 1 line
2.7.0
PATCH 8/31 Check if __GLIBC_PREREQ is defined before using it
In reply to Khem Raj__GLIBC_PREREQ is specific to glibc so it should be checked if it is defined or not.
--- testcases/kernel/syscalls/accept4/accept4_01.c | 9 ++++++- testcases/kernel/syscalls/getcpu/getcpu01.c | 31 ++++++++++++++++++++++ .../sched_getaffinity/sched_getaffinity01.c | 26 ++++++++++++++++++ 3 files changed, 65 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/accept4/accept4_01.c +8 -1
@@ -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);
testcases/kernel/syscalls/getcpu/getcpu01.c +31 -0
@@ -62,6 +62,7 @@#include <dirent.h> #if defined(__i386__) || defined(__x86_64__) +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)#if __GLIBC_PREREQ (2 ,6 )#if defined(__x86_64__)#include <utmpx.h>
@@ -72,13 +73,16 @@ int sys_support = 1;#else int sys_support =0 ;#endif +#endif #else int sys_support =0 ;#endif +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)#if !(__GLIBC_PREREQ (2 ,7 ))#define CPU_FREE (ptr) free(ptr)#endif +#endif void cleanup (void );void setup (void );
@@ -164,9 +168,11 @@ static inline int getcpu(unsigned *cpu_id, unsigned *node_id, {#if defined(__i386__)return syscall (318 , cpu_id, node_id, cache_struct); +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)#elif __GLIBC_PREREQ (2 ,6 ) *cpu_id =sched_getcpu ();#endif +#endif return 0 ; }
@@ -191,15 +197,20 @@ unsigned int set_cpu_affinity(void)cpu_set_t *set;size_t size;int nrcpus =1024 ; +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)#if __GLIBC_PREREQ (2 ,7 ) realloc: set =CPU_ALLOC (nrcpus);#else set =malloc (sizeof (cpu_set_t));#endif +#else + set =malloc (sizeof (cpu_set_t)); +#endif if (set ==NULL ) {tst_brkm (TFAIL ,NULL ,"CPU_ALLOC:errno:%d" , errno); } +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)#if __GLIBC_PREREQ (2 ,7 ) size =CPU_ALLOC_SIZE (nrcpus);CPU_ZERO_S (size, set);
@@ -207,8 +218,13 @@ realloc: size =sizeof (cpu_set_t);CPU_ZERO (set);#endif +#else + size =sizeof (cpu_set_t); +CPU_ZERO (set); +#endif if (sched_getaffinity (0 , size, set) <0 ) {CPU_FREE (set); +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ) #if __GLIBC_PREREQ(2, 7) if (errno == EINVAL && nrcpus < (1024 << 8)) { nrcpus = nrcpus << 2;
@@ -220,10 +236,17 @@ realloc: "NR_CPUS of the kernel is more than 1024, so we'd better use a newer glibc(>= 2.7)"); else#endif +#else +if (errno ==EINVAL ) +tst_resm (TFAIL , +"NR_CPUS of the kernel is more than 1024, so we'd better use a newer glibc(>= 2.7)" ); + else +#endif tst_resm (TFAIL ,"sched_getaffinity:errno:%d" , errno);tst_exit (); } cpu_max =max_cpuid (size, set); +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)#if __GLIBC_PREREQ (2 ,7 )CPU_ZERO_S (size, set);CPU_SET_S (cpu_max, size, set);
@@ -231,6 +254,10 @@ realloc:CPU_ZERO (set);CPU_SET (cpu_max, set);#endif +#else +CPU_ZERO (set); +CPU_SET (cpu_max, set); +#endif if (sched_setaffinity (0 , size, set) <0 ) {CPU_FREE (set);tst_brkm (TFAIL ,NULL ,"sched_setaffinity:errno:%d" , errno);
@@ -247,11 +274,15 @@ unsigned int max_cpuid(size_t size, cpu_set_t * set) {unsigned int index, max =0 ; for (index = 0; index < size * BITS_PER_BYTE; index++) +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)#if __GLIBC_PREREQ (2 ,7 )if (CPU_ISSET_S (index, size, set)) #else if (CPU_ISSET(index, set))#endif +#else + if (CPU_ISSET(index, set)) +#endif max = index;return max; }
testcases/kernel/syscalls/sched_getaffinity/sched_getaffinity01.c +26 -0
@@ -66,9 +66,11 @@ do { \ tst_resm((TEST_RETURN == -1 ? TPASS : TFAIL) | TTERRNO, #t); \ } while (0) +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)#if !(__GLIBC_PREREQ (2 ,7 ))#define CPU_FREE (ptr) free(ptr)#endif +#endif int main (int ac,char **av) {
@@ -95,14 +97,19 @@ static void do_test(void)pid_t unused_pid;unsigned len; +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)#if __GLIBC_PREREQ (2 ,7 ) realloc: mask =CPU_ALLOC (nrcpus);#else mask =malloc (sizeof (cpu_set_t));#endif +#else + mask =malloc (sizeof (cpu_set_t)); +#endif if (mask ==NULL )tst_brkm (TFAIL |TTERRNO , cleanup,"fail to get enough memory" ); +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)#if __GLIBC_PREREQ (2 ,7 ) len =CPU_ALLOC_SIZE (nrcpus);CPU_ZERO_S (len, mask);
@@ -110,10 +117,15 @@ realloc: len =sizeof (cpu_set_t);CPU_ZERO (mask);#endif +#else + len =sizeof (cpu_set_t); +CPU_ZERO (mask); +#endif /* positive test */ TEST (sched_getaffinity (0 , len, mask));if (TEST_RETURN ==-1 ) {CPU_FREE (mask); +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ) #if __GLIBC_PREREQ(2, 7) if (errno == EINVAL && nrcpus < (1024 << 8)) { nrcpus = nrcpus << 2;
@@ -125,17 +137,27 @@ realloc: "newer glibc(>= 2.7)"); else#endif +#else +if (errno ==EINVAL ) +tst_resm (TFAIL ,"NR_CPUS > 1024, we'd better use a " +"newer glibc(>= 2.7)" ); + else +#endif tst_resm (TFAIL |TTERRNO ,"fail to get cpu affinity" );cleanup (); }else {tst_resm (TINFO ,"cpusetsize is %d" , len);tst_resm (TINFO ,"mask.__bits[0] = %lu " , mask->__bits[0 ]);for (i =0 ; i < num; i++) { +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)#if __GLIBC_PREREQ (2 ,7 )TEST (CPU_ISSET_S (i, len, mask));#else TEST (CPU_ISSET (i, mask));#endif +#else +TEST (CPU_ISSET (i, mask)); +#endif if (TEST_RETURN !=-1 )tst_resm (TPASS ,"sched_getaffinity() succeed, " "this process %d is running "
@@ -143,11 +165,15 @@ realloc: } } +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)#if __GLIBC_PREREQ (2 ,7 )CPU_ZERO_S (len, mask);#else CPU_ZERO (mask);#endif +#else +CPU_ZERO (mask); +#endif /* negative tests */ QUICK_TEST (sched_getaffinity (0 , len, (cpu_set_t *) -1 ));QUICK_TEST (sched_getaffinity (0 ,0 , mask));
Signature · 1 line
2.7.0
PATCH 9/31 Guard error.h with __GLIBC__
In reply to Khem Rajerror API is specific to glibc so use the guard to make it conditional on glibc
--- testcases/kernel/syscalls/faccessat/faccessat01.c | 2 ++ testcases/kernel/syscalls/fallocate/fallocate01.c | 2 ++ testcases/kernel/syscalls/fchmodat/fchmodat01.c | 2 ++ testcases/kernel/syscalls/fchownat/fchownat01.c | 2 ++ testcases/kernel/syscalls/fchownat/fchownat02.c | 2 ++ testcases/kernel/syscalls/fstatat/fstatat01.c | 2 ++ testcases/kernel/syscalls/futimesat/futimesat01.c | 2 ++ testcases/kernel/syscalls/linkat/linkat01.c | 2 ++ testcases/kernel/syscalls/linkat/linkat02.c | 2 ++ testcases/kernel/syscalls/mkdirat/mkdirat01.c | 2 ++ testcases/kernel/syscalls/mknodat/mknodat01.c | 2 ++ testcases/kernel/syscalls/mknodat/mknodat02.c | 2 ++ testcases/kernel/syscalls/openat/openat01.c | 2 ++ testcases/kernel/syscalls/readlinkat/readlinkat01.c | 2 ++ testcases/kernel/syscalls/renameat/renameat01.c | 2 ++ testcases/kernel/syscalls/symlinkat/symlinkat01.c | 2 ++ testcases/kernel/syscalls/unlinkat/unlinkat01.c | 2 ++ 17 files changed, 34 insertions(+)
testcases/kernel/syscalls/faccessat/faccessat01.c +2 -0
@@ -37,7 +37,9 @@#include <sys/stat.h> #include <fcntl.h> #include <unistd.h> +#ifdef __GLIBC__#include <error.h> +#endif #include <stdlib.h> #include <errno.h> #include <string.h>
testcases/kernel/syscalls/fallocate/fallocate01.c +2 -0
@@ -96,7 +96,9 @@#include <fcntl.h> #include <sys/syscall.h> #include <unistd.h> +#ifdef __GLIBC__#include <error.h> +#endif #include <inttypes.h> #include <sys/utsname.h>
testcases/kernel/syscalls/fchmodat/fchmodat01.c +2 -0
@@ -37,7 +37,9 @@#include <sys/stat.h> #include <fcntl.h> #include <unistd.h> +#ifdef __GLIBC__#include <error.h> +#endif #include <stdlib.h> #include <errno.h> #include <string.h>
testcases/kernel/syscalls/fchownat/fchownat01.c +2 -0
@@ -28,7 +28,9 @@#include <sys/stat.h> #include <fcntl.h> #include <unistd.h> +#ifdef __GLIBC__#include <error.h> +#endif #include <stdlib.h> #include <errno.h> #include <string.h>
testcases/kernel/syscalls/fchownat/fchownat02.c +2 -0
@@ -26,7 +26,9 @@#include <sys/stat.h> #include <fcntl.h> #include <unistd.h> +#ifdef __GLIBC__#include <error.h> +#endif #include <stdlib.h> #include <errno.h> #include <string.h>
testcases/kernel/syscalls/fstatat/fstatat01.c +2 -0
@@ -48,7 +48,9 @@#include <sys/stat.h> #include <sys/time.h> #include <fcntl.h> +#ifdef __GLIBC__#include <error.h> +#endif #include <stdlib.h> #include <errno.h> #include <string.h>
testcases/kernel/syscalls/futimesat/futimesat01.c +2 -0
@@ -37,7 +37,9 @@#include <sys/stat.h> #include <sys/time.h> #include <fcntl.h> +#ifdef __GLIBC__#include <error.h> +#endif #include <stdlib.h> #include <errno.h> #include <string.h>
testcases/kernel/syscalls/linkat/linkat01.c +2 -0
@@ -49,7 +49,9 @@#include <sys/time.h> #include <fcntl.h> #include <unistd.h> +#ifdef __GLIBC__#include <error.h> +#endif #include <stdlib.h> #include <errno.h> #include <string.h>
testcases/kernel/syscalls/linkat/linkat02.c +2 -0
@@ -23,7 +23,9 @@#include <sys/stat.h> #include <fcntl.h> #include <unistd.h> +#ifdef __GLIBC__#include <error.h> +#endif #include <stdlib.h> #include <errno.h> #include <string.h>
testcases/kernel/syscalls/mkdirat/mkdirat01.c +2 -0
@@ -30,7 +30,9 @@#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> +#ifdef __GLIBC__#include <error.h> +#endif #include <stdlib.h> #include <errno.h> #include <string.h>
testcases/kernel/syscalls/mknodat/mknodat01.c +2 -0
@@ -29,7 +29,9 @@#include <sys/types.h> #include <fcntl.h> #include <sys/stat.h> +#ifdef __GLIBC__#include <error.h> +#endif #include <stdlib.h> #include <errno.h> #include <string.h>
testcases/kernel/syscalls/mknodat/mknodat02.c +2 -0
@@ -29,7 +29,9 @@#include <sys/types.h> #include <fcntl.h> #include <sys/stat.h> +#ifdef __GLIBC__#include <error.h> +#endif #include <stdlib.h> #include <errno.h> #include <string.h>
testcases/kernel/syscalls/openat/openat01.c +2 -0
@@ -29,7 +29,9 @@#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> +#ifdef __GLIBC__#include <error.h> +#endif #include <stdlib.h> #include <errno.h> #include <string.h>
testcases/kernel/syscalls/readlinkat/readlinkat01.c +2 -0
@@ -29,7 +29,9 @@#include <sys/stat.h> #include <sys/time.h> #include <fcntl.h> +#ifdef __GLIBC__#include <error.h> +#endif #include <stdlib.h> #include <errno.h> #include <string.h>
testcases/kernel/syscalls/renameat/renameat01.c +2 -0
@@ -42,7 +42,9 @@#include <sys/stat.h> #include <sys/time.h> #include <fcntl.h> +#ifdef __GLIBC__#include <error.h> +#endif #include <stdlib.h> #include <errno.h> #include <string.h>
testcases/kernel/syscalls/symlinkat/symlinkat01.c +2 -0
@@ -37,7 +37,9 @@#include <sys/stat.h> #include <sys/time.h> #include <fcntl.h> +#ifdef __GLIBC__#include <error.h> +#endif #include <stdlib.h> #include <errno.h> #include <string.h>
testcases/kernel/syscalls/unlinkat/unlinkat01.c +2 -0
@@ -37,7 +37,9 @@#include <sys/stat.h> #include <sys/time.h> #include <fcntl.h> +#ifdef __GLIBC__#include <error.h> +#endif #include <stdlib.h> #include <errno.h> #include <string.h>
Signature · 1 line
2.7.0
PATCH 10/31 replace __BEGIN_DECLS and __END_DECLS
In reply to Khem RajThey are not portable across libc implementations
therefore replace them with expanded macros
Include <asm-generic/types.h> to get __s32 definitions its not a generally available typedef
--- testcases/kernel/syscalls/epoll2/include/epoll.h | 8 ++++++-- utils/sctp/include/netinet/sctp.h | 9 +++++++-- 2 files changed, 13 insertions(+), 4 deletions(-)
testcases/kernel/syscalls/epoll2/include/epoll.h +6 -2
@@ -85,7 +85,9 @@ struct epoll_event }EPOLL_PACKED ; -__BEGIN_DECLS +#ifdef __cplusplus +extern "C" { +#endif /* Creates an epoll instance. Returns an fd for the new instance. The "size" parameter is a hint specifying the number of file
@@ -114,6 +116,8 @@ extern int epoll_ctl (int __epfd, int __op, int __fd, extern int epoll_wait (int __epfd, struct epoll_event *__events, int __maxevents, int __timeout) __THROW; -__END_DECLS +#ifdef __cplusplus +} +#endif #endif /* sys/epoll.h */
utils/sctp/include/netinet/sctp.h +7 -2
@@ -35,9 +35,12 @@#include <stdint.h> #include <linux/types.h> +#include <asm-generic/types.h> #include <sys/socket.h> -__BEGIN_DECLS +#ifdef __cplusplus +extern "C" { +#endif typedef __s32 sctp_assoc_t ;
@@ -862,6 +865,8 @@ int sctp_recvmsg(int s, void *msg, size_t len, struct sockaddr *from,/* Return the address length for an address family. */ int sctp_getaddrlen (sa_family_t family); -__END_DECLS +#ifdef __cplusplus +} +#endif #endif /* __linux_sctp_h__ */
Signature · 1 line
2.7.0
PATCH 11/31 Rename sigset variable to sigset1
In reply to Khem Rajsigset API from signal.h is shadowed by this name conflict
--- testcases/kernel/mem/shmt/shmt04.c | 10 +++++----- testcases/kernel/mem/shmt/shmt06.c | 10 +++++----- testcases/kernel/syscalls/sigprocmask/sigprocmask01.c | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-)
testcases/kernel/mem/shmt/shmt04.c +5 -5
@@ -56,7 +56,7 @@ int TST_TOTAL = 2; /* Total number of test cases. *//**************/ key_t key; -sigset_t sigset; +sigset_t sigset1;#define SIZE 16*1024
@@ -71,9 +71,9 @@ int main(void) key = (key_t )getpid (); -sigemptyset (&sigset); -sigaddset (&sigset,SIGUSR1 ); -sigprocmask (SIG_BLOCK , &sigset,NULL ); +sigemptyset (&sigset1); +sigaddset (&sigset1,SIGUSR1 ); +sigprocmask (SIG_BLOCK , &sigset1,NULL ); pid =fork ();switch (pid) {
@@ -148,7 +148,7 @@ int child(void)char *cp;int sig; -sigwait (&sigset, &sig); +sigwait (&sigset1, &sig); chld_pid =getpid ();/*--------------------------------------------------------*/
testcases/kernel/mem/shmt/shmt06.c +5 -5
@@ -57,7 +57,7 @@ int TST_TOTAL = 2; /* Total number of test cases. *//**************/ key_t key; -sigset_t sigset; +sigset_t sigset1;int child ();static int rm_shm (int );
@@ -70,9 +70,9 @@ int main(void) key = (key_t )getpid (); -sigemptyset (&sigset); -sigaddset (&sigset,SIGUSR1 ); -sigprocmask (SIG_BLOCK , &sigset,NULL ); +sigemptyset (&sigset1); +sigaddset (&sigset1,SIGUSR1 ); +sigprocmask (SIG_BLOCK , &sigset1,NULL ); pid =fork ();switch (pid) {
@@ -147,7 +147,7 @@ int child(void)char *cp;int sig; -sigwait (&sigset, &sig); +sigwait (&sigset1, &sig); chld_pid =getpid ();if ((shmid =shmget (key,SIZE ,0 )) <0 ) {
testcases/kernel/syscalls/sigprocmask/sigprocmask01.c +5 -5
@@ -91,7 +91,7 @@ int TST_TOTAL = 1;int sig_catch =0 ;/* variable to blocked/unblocked signals */ struct sigaction sa_new;/* struct to hold signal info */ -sigset_t sigset;/* signal set to hold signal lists */ +sigset_t sigset1;/* signal set to hold signal lists */ sigset_t sigset2;int main (int ac,char **av)
@@ -112,7 +112,7 @@ int main(int ac, char **av)* so that, signal will not be delivered to * the test process. */ -TEST (sigprocmask (SIG_BLOCK , &sigset,0 )); +TEST (sigprocmask (SIG_BLOCK , &sigset1,0 ));/* Get the process id of test process */ my_pid =getpid ();
@@ -165,7 +165,7 @@ int main(int ac, char **av)*/ errno =0 ;if (sigprocmask (SIG_UNBLOCK , - &sigset,0 ) ==-1 ) { + &sigset1,0 ) ==-1 ) {tst_brkm (TFAIL , cleanup,"sigprocmask() failed " "to unblock signal, "
@@ -212,7 +212,7 @@ void setup(void)* Initialise the signal sets with the list that * excludes/includes all system-defined signals. */ -if (sigemptyset (&sigset) ==-1 ) { +if (sigemptyset (&sigset1) ==-1 ) {tst_brkm (TFAIL , cleanup,"sigemptyset() failed, errno=%d : %s" , errno,strerror (errno));
@@ -235,7 +235,7 @@ void setup(void)* Add specified signal (SIGINT) to the signal set * which excludes system-defined signals. */ -if (sigaddset (&sigset,SIGINT ) ==-1 ) { +if (sigaddset (&sigset1,SIGINT ) ==-1 ) {tst_brkm (TFAIL , cleanup,"sigaddset() failed, errno=%d : %s" , errno,strerror (errno));
Signature · 1 line
2.7.0
PATCH 12/31 fsstress.c: Replace __int64_t with int64_t
In reply to Khem Rajint64_t is defined in ISO C99
include limits.h to get defintions of PATH_MAX
--- testcases/kernel/fs/fsstress/fsstress.c | 31 +++++++++--------- testcases/network/nfs/nfs_fsstress/fsstress.c | 47 ++++++++++++++------------- 2 files changed, 40 insertions(+), 38 deletions(-)
testcases/kernel/fs/fsstress/fsstress.c +16 -15
@@ -36,6 +36,7 @@#ifdef HAVE_SYS_PRCTL_H # include <sys/prctl.h> #endif +#include <limits.h> #define XFS_ERRTAG_MAX 17
@@ -1572,7 +1573,7 @@ void bulkstat_f(int opno, long r)__u64 last;__s32 nent;xfs_bstat_t *t; -__int64_t total; +int64_t total;xfs_fsop_bulkreq_t bsr; last =0 ;
@@ -1764,14 +1765,14 @@ int setdirect(int fd)void dread_f (int opno,long r) { -__int64_t align; +int64_t align;char *buf =NULL ;struct dioattr diob;int e;pathname_t f;int fd;size_t len; -__int64_t lr; +int64_t lr;off64_t off;struct stat64 stb;int v;
@@ -1835,8 +1836,8 @@ void dread_f(int opno, long r) return; }#endif - align = (__int64_t ) diob.d_miniosz; - lr = ((__int64_t )random () <<32 ) +random (); + align = (int64_t ) diob.d_miniosz; + lr = ((int64_t )random () <<32 ) +random (); off = (off64_t) (lr % stb.st_size); off -= (off % align);lseek64 (fd, off,SEEK_SET );
@@ -1865,14 +1866,14 @@ void dread_f(int opno, long r)void dwrite_f (int opno,long r) { -__int64_t align; +int64_t align;char *buf =NULL ;struct dioattr diob;int e;pathname_t f;int fd;size_t len; -__int64_t lr; +int64_t lr;off64_t off;struct stat64 stb;int v;
@@ -1925,8 +1926,8 @@ void dwrite_f(int opno, long r) return; }#endif - align = (__int64_t ) diob.d_miniosz; - lr = ((__int64_t )random () <<32 ) +random (); + align = (int64_t ) diob.d_miniosz; + lr = ((int64_t )random () <<32 ) +random (); off = (off64_t) (lr %MIN (stb.st_size + (1024 *1024 ),MAXFSIZE )); off -= (off % align);lseek64 (fd, off,SEEK_SET );
@@ -2224,7 +2225,7 @@ void read_f(int opno, long r)pathname_t f;int fd;size_t len; -__int64_t lr; +int64_t lr;off64_t off;struct stat64 stb;int v;
@@ -2262,7 +2263,7 @@ void read_f(int opno, long r)close (fd);return ; } - lr = ((__int64_t )random () <<32 ) +random (); + lr = ((int64_t )random () <<32 ) +random (); off = (off64_t) (lr % stb.st_size);lseek64 (fd, off,SEEK_SET ); len = (random () % (getpagesize () *32 )) +1 ;
@@ -2509,7 +2510,7 @@ void truncate_f(int opno, long r) {int e;pathname_t f; -__int64_t lr; +int64_t lr;off64_t off;struct stat64 stb;int v;
@@ -2530,7 +2531,7 @@ void truncate_f(int opno, long r)free_pathname (&f);return ; } - lr = ((__int64_t )random () <<32 ) +random (); + lr = ((int64_t )random () <<32 ) +random (); off = lr %MIN (stb.st_size + (1024 *1024 ),MAXFSIZE ); off %= maxfsize; e =truncate64_path (&f, off) <0 ? errno :0 ;
@@ -2626,7 +2627,7 @@ void write_f(int opno, long r)pathname_t f;int fd;size_t len; -__int64_t lr; +int64_t lr;off64_t off;struct stat64 stb;int v;
@@ -2656,7 +2657,7 @@ void write_f(int opno, long r)close (fd);return ; } - lr = ((__int64_t )random () <<32 ) +random (); + lr = ((int64_t )random () <<32 ) +random (); off = (off64_t) (lr %MIN (stb.st_size + (1024 *1024 ),MAXFSIZE )); off %= maxfsize;lseek64 (fd, off,SEEK_SET );
testcases/network/nfs/nfs_fsstress/fsstress.c +24 -23
179 lines not on this page · raw message
Signature · 1 line
2.7.0
PATCH 13/31 include fcntl.h for getting O_* definitions
In reply to Khem Rajmusl exposes this issue, with glibc fcntl.h is included via some other header and this problem remained latent
--- testcases/kernel/ipc/ipc_stress/shmem_test_03.c | 1 + testcases/kernel/syscalls/mq_notify/mq_notify01.c | 1 + testcases/network/tcp_cmds/sendfile/testsf_c.c | 1 + testcases/network/tcp_cmds/sendfile/testsf_s.c | 1 + 4 files changed, 4 insertions(+)
testcases/kernel/ipc/ipc_stress/shmem_test_03.c +1 -0
@@ -72,6 +72,7 @@#include <string.h> #include <unistd.h> #include <limits.h> +#include <fcntl.h> #include <sys/file.h> #include <sys/ipc.h> #include <sys/mman.h>
testcases/kernel/syscalls/mq_notify/mq_notify01.c +1 -0
@@ -41,6 +41,7 @@#include <mqueue.h> #include <signal.h> #include <stdlib.h> +#include <fcntl.h> #include "../utils/include_j_h.h"
testcases/network/tcp_cmds/sendfile/testsf_c.c +1 -0
@@ -9,6 +9,7 @@#include <sys/types.h> #include <stdlib.h> #include <string.h> +#include <fcntl.h> #include <sys/file.h> #include <arpa/inet.h> #include <netinet/in.h>
testcases/network/tcp_cmds/sendfile/testsf_s.c +1 -0
@@ -6,6 +6,7 @@#include <stdio.h> #include <stdlib.h> #include <unistd.h> +#include <fcntl.h> #include <sys/file.h> #include <errno.h> #include <sys/signal.h>
Signature · 1 line
2.7.0
PATCH 14/31 hyperthreading: Include sys/types.h for pid_t definition
In reply to Khem RajIf sys/types.h is not included then it will not define pid_t_needed and therefore typedef wont be included and we get errors about pid_t being not known
--- testcases/kernel/sched/hyperthreading/ht_affinity/ht_utils.h | 1 + testcases/kernel/sched/hyperthreading/ht_enabled/ht_utils.h | 1 + testcases/kernel/sched/hyperthreading/ht_interrupt/ht_utils.h | 1 + 3 files changed, 3 insertions(+)
testcases/kernel/sched/hyperthreading/ht_affinity/ht_utils.h +1 -0
@@ -3,6 +3,7 @@#define _HTUTILS_H_#include <stdlib.h> +#include <sys/types.h> int is_cmdline_para (const char *para);
testcases/kernel/sched/hyperthreading/ht_enabled/ht_utils.h +1 -0
@@ -2,6 +2,7 @@#ifndef _HTUTILS_H_#define _HTUTILS_H_ +#include <sys/types.h> #include <stdlib.h> int is_cmdline_para (const char *para);
testcases/kernel/sched/hyperthreading/ht_interrupt/ht_utils.h +1 -0
@@ -3,6 +3,7 @@#define _HTUTILS_H_#include <stdlib.h> +#include <sys/types.h> int is_cmdline_para (const char *para);
Signature · 1 line
2.7.0
PATCH 15/31 mincore01: Rename PAGESIZE to pagesize
In reply to Khem RajPAGESIZE conflicts with system headers on musl
--- testcases/kernel/syscalls/mincore/mincore01.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
testcases/kernel/syscalls/mincore/mincore01.c +5 -5
@@ -45,7 +45,7 @@#include "test.h" #include "safe_macros.h" -static int PAGESIZE ; +static int pagesize;static rlim_t STACK_LIMIT =10485760 ;static void cleanup (void );
@@ -146,7 +146,7 @@ static void setup4(struct test_case_t *tc) } tc->addr = global_pointer; - tc->len = as_lim.rlim_cur - (rlim_t )global_pointer +PAGESIZE ; + tc->len = as_lim.rlim_cur - (rlim_t )global_pointer + pagesize; tc->vector = global_vec;/*
@@ -161,7 +161,7 @@ static void setup(void)char *buf;int fd; -PAGESIZE =getpagesize (); + pagesize =getpagesize ();tst_sig (NOFORK ,DEF_HANDLER , cleanup);
@@ -170,7 +170,7 @@ static void setup(void)TEST_PAUSE ;/* global_pointer will point to a mmapped area of global_len bytes */ - global_len =PAGESIZE *2 ; + global_len = pagesize *2 ; buf =SAFE_MALLOC (cleanup, global_len);memset (buf,42 , global_len);
@@ -186,7 +186,7 @@ static void setup(void) PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); global_vec =SAFE_MALLOC (cleanup, - (global_len +PAGESIZE -1 ) /PAGESIZE ); + (global_len + pagesize -1 ) / pagesize);SAFE_CLOSE (cleanup, fd); }
Signature · 1 line
2.7.0
PATCH 16/31 ustat: Change header from ustat.h to sys/ustat.h
In reply to Khem Rajmakes it portable for musl, on glibc ustat.h is just including sys/ustat.h too
--- testcases/kernel/syscalls/ustat/ustat01.c | 2 +- testcases/kernel/syscalls/ustat/ustat02.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/ustat/ustat01.c +1 -1
@@ -20,8 +20,8 @@*/ #include <unistd.h> -#include <ustat.h> #include <errno.h> +#include <sys/ustat.h> #include <sys/types.h> #include <sys/stat.h> #include "test.h"
testcases/kernel/syscalls/ustat/ustat02.c +1 -1
@@ -21,8 +21,8 @@*/ #include <unistd.h> -#include <ustat.h> #include <errno.h> +#include <sys/ustat.h> #include <sys/stat.h> #include <sys/types.h> #include "test.h"
Signature · 1 line
2.7.0
PATCH 17/31 replace sigval_t with union sigval
In reply to Khem RajThis makes it compatible across musl and glibc
--- testcases/kernel/syscalls/timer_getoverrun/timer_getoverrun01.c | 2 +- testcases/kernel/syscalls/timer_gettime/timer_gettime01.c | 2 +- testcases/kernel/timers/timer_create/timer_create02.c | 4 ++-- testcases/kernel/timers/timer_create/timer_create03.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-)
testcases/kernel/syscalls/timer_getoverrun/timer_getoverrun01.c +1 -1
@@ -54,7 +54,7 @@ int main(int ac, char **av)setup (); - ev.sigev_value = (sigval_t )0 ; + ev.sigev_value = (union sigval )0 ; ev.sigev_signo =SIGALRM ; ev.sigev_notify =SIGEV_SIGNAL ;TEST (ltp_syscall (__NR_timer_create,CLOCK_REALTIME , &ev, &timer));
testcases/kernel/syscalls/timer_gettime/timer_gettime01.c +1 -1
@@ -55,7 +55,7 @@ int main(int ac, char **av)setup (); - ev.sigev_value = (sigval_t )0 ; + ev.sigev_value = (union sigval )0 ; ev.sigev_signo =SIGALRM ; ev.sigev_notify =SIGEV_SIGNAL ;TEST (ltp_syscall (__NR_timer_create,CLOCK_REALTIME , &ev, &timer));
testcases/kernel/timers/timer_create/timer_create02.c +2 -2
@@ -142,7 +142,7 @@ void setup_test(int option) {switch (option) {case 0 : - evp.sigev_value = (sigval_t )0 ; + evp.sigev_value = (union sigval )0 ; evp.sigev_signo =SIGALRM ; evp.sigev_notify =SIGEV_SIGNAL ; evp_ptr = &evp;
@@ -151,7 +151,7 @@ void setup_test(int option) evp_ptr =NULL ;break ;case 2 : - evp.sigev_value = (sigval_t )0 ; + evp.sigev_value = (union sigval )0 ; evp.sigev_signo =SIGALRM ;/* any will do */ evp.sigev_notify =SIGEV_NONE ; evp_ptr = &evp;
testcases/kernel/timers/timer_create/timer_create03.c +2 -2
@@ -129,7 +129,7 @@ void setup_test(int option) {switch (option) {case 0 : - evp.sigev_value = (sigval_t )0 ; + evp.sigev_value = (union sigval )0 ; evp.sigev_signo =SIGALRM ; evp.sigev_notify =SIGEV_SIGNAL ; evp_ptr = &evp;
@@ -138,7 +138,7 @@ void setup_test(int option) evp_ptr =NULL ;break ;case 2 : - evp.sigev_value = (sigval_t )0 ; + evp.sigev_value = (union sigval )0 ; evp.sigev_signo =SIGALRM ;/* any will do */ evp.sigev_notify =SIGEV_NONE ; evp_ptr = &evp;
Signature · 1 line
2.7.0
PATCH 18/31 guard mallocopt() with __GLIBC__
In reply to Khem Rajmallocopt is not available on non glibc implementations
--- utils/benchmark/ebizzy-0.3/ebizzy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
utils/benchmark/ebizzy-0.3/ebizzy.c +2 -2
@@ -215,10 +215,10 @@ static void read_options(int argc, char *argv[]) "\"never mmap\" option specified\n");usage (); } - +#ifdef __GLIBC__if (never_mmap)mallopt (M_MMAP_MAX ,0 ); - +#endif if (chunk_size < record_size) {fprintf (stderr,"Chunk size %u smaller than record size %u\n" , chunk_size, record_size);
Signature · 1 line
2.7.0
PATCH 19/31 tomoyo: Replace canonicalize_file_name() with realpath()
In reply to Khem Rajcanonicalize_file_name() API is specific to glibc
--- testcases/kernel/security/tomoyo/tomoyo_filesystem_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
testcases/kernel/security/tomoyo/tomoyo_filesystem_test.c +2 -2
@@ -274,9 +274,9 @@ int main(int argc, char *argv[])/* Test mount(). */ {static char buf[4096 ]; -char *dev_ram_path =canonicalize_file_name ("/dev/ram0" ); +char *dev_ram_path =realpath ("/dev/ram0" ,NULL );if (!dev_ram_path) - dev_ram_path =canonicalize_file_name ("/dev/ram" ); + dev_ram_path =realpath ("/dev/ram" ,NULL );if (!dev_ram_path) { dev_ram_path ="/dev/ram0" ;mknod (dev_ram_path,S_IFBLK ,MKDEV (1 ,0 ));
Signature · 1 line
2.7.0
PATCH 20/31 getdents: define getdents/getdents64 only for glibc
In reply to Khem Rajgetdents/getdents64 are implemented in musl and when we define static functions with same name, it errors out.
--- testcases/kernel/syscalls/getdents/getdents.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/getdents/getdents.h +4 -2
@@ -34,12 +34,13 @@ struct linux_dirent {char d_name[]; }; +#ifdef __GLIBC__static inline int getdents (unsigned int fd,struct linux_dirent *dirp,unsigned int size) {return ltp_syscall (__NR_getdents, fd, dirp, size); } - +#endif struct linux_dirent64 {uint64_t d_ino;int64_t d_off;
@@ -48,10 +49,11 @@ struct linux_dirent64 { char d_name[]; }; +#ifdef __GLIBC__static inline int getdents64 (unsigned int fd,struct linux_dirent64 *dirp64,unsigned int size) {return ltp_syscall (__NR_getdents64, fd, dirp64, size); } - +#endif #endif /* GETDENTS_H */
Signature · 1 line
2.7.0
PATCH 21/31 Include sys/types.h for MREMAP_MAYMOVE definition
In reply to Khem RajFixes errors like
error: 'MREMAP_MAYMOVE' undeclared (first use in this function)
--- testcases/kernel/syscalls/mremap/mremap01.c | 5 +++-- testcases/kernel/syscalls/mremap/mremap02.c | 5 +++-- testcases/kernel/syscalls/mremap/mremap03.c | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-)
testcases/kernel/syscalls/mremap/mremap01.c +3 -2
@@ -74,12 +74,13 @@* RESTRICTIONS: * None. */ +#define _GNU_SOURCE#include <unistd.h> #include <errno.h> -#define __USE_GNU#include <sys/mman.h> -#undef __USE_GNU +#undef _GNU_SOURCE#include <fcntl.h> +#include <sys/types.h> #include "test.h"
testcases/kernel/syscalls/mremap/mremap02.c +3 -2
@@ -72,12 +72,13 @@* RESTRICTIONS: * None. */ +#define _GNU_SOURCE#include <errno.h> #include <unistd.h> #include <fcntl.h> -#define __USE_GNU#include <sys/mman.h> -#undef __USE_GNU +#include <sys/types.h> +#undef _GNU_SOURCE#include "test.h"
testcases/kernel/syscalls/mremap/mremap03.c +3 -2
@@ -73,12 +73,13 @@* RESTRICTIONS: * None. */ +#define _GNU_SOURCE#include <errno.h> #include <unistd.h> #include <fcntl.h> -#define __USE_GNU#include <sys/mman.h> -#undef __USE_GNU +#include <sys/types.h> +#undef _GNU_SOURCE#include "test.h"
Signature · 1 line
2.7.0
PATCH 22/31 include sys/types.h
In reply to Khem RajFixes
error: unknown type name 'uint'
--- testcases/kernel/ipc/ipc_stress/shmem_test_04.c | 1 + 1 file changed, 1 insertion(+)
testcases/kernel/ipc/ipc_stress/shmem_test_04.c +1 -0
@@ -65,6 +65,7 @@#include <signal.h> #include <stdint.h> #include <sys/mman.h> +#include <sys/types.h> #ifdef _LINUX_typedef unsigned long ulong_t ;
Signature · 1 line
2.7.0
PATCH 23/31 ptrace: Use int instead of enum __ptrace_request
In reply to Khem Raj__ptrace_request is only available with glibc
--- testcases/kernel/syscalls/ptrace/ptrace03.c | 4 ++++ testcases/kernel/syscalls/ptrace/spawn_ptrace_child.h | 4 ++++ 2 files changed, 8 insertions(+)
testcases/kernel/syscalls/ptrace/ptrace03.c +4 -0
@@ -102,7 +102,11 @@ static pid_t unused_pid;static pid_t zero_pid;struct test_case_t { +#ifdef __GLIBC__enum __ptrace_request request; +#else +int request; +#endif pid_t *pid;int exp_errno; } test_cases[] = {
testcases/kernel/syscalls/ptrace/spawn_ptrace_child.h +4 -0
@@ -130,7 +130,11 @@ static char *strings[] = { SPT(KILL) SPT(SINGLESTEP) }; +#ifdef __GLIBC__ static inline char *strptrace(enum __ptrace_request request) +#else +static inline char *strptrace(int request) +#endif {return strings[request]; }
Signature · 1 line
2.7.0
PATCH 24/31 rt_sigaction/rt_sigprocmark: Define _GNU_SOURCE
In reply to Khem RajFixes musl build failure e.g.
error: 'SA_NOMASK' undeclared here (not in a function)
--- testcases/kernel/syscalls/rt_sigaction/rt_sigaction01.c | 1 + testcases/kernel/syscalls/rt_sigaction/rt_sigaction02.c | 2 +- testcases/kernel/syscalls/rt_sigaction/rt_sigaction03.c | 1 + testcases/kernel/syscalls/rt_sigprocmask/rt_sigprocmask01.c | 1 + 4 files changed, 4 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/rt_sigaction/rt_sigaction01.c +1 -0
@@ -28,6 +28,7 @@/* sigset_t type. */ /******************************************************************************/ +#define _GNU_SOURCE#include <stdio.h> #include <stdlib.h> #include <unistd.h>
testcases/kernel/syscalls/rt_sigaction/rt_sigaction02.c +1 -1
@@ -23,7 +23,7 @@/* Description: This tests the rt_sigaction() syscall */ /* rt_sigaction Expected EFAULT error check */ /******************************************************************************/ - +#define _GNU_SOURCE#include <stdio.h> #include <stdlib.h> #include <unistd.h>
testcases/kernel/syscalls/rt_sigaction/rt_sigaction03.c +1 -0
@@ -24,6 +24,7 @@/* rt_sigaction Expected EINVAL error check */ /******************************************************************************/ +#define _GNU_SOURCE#include <stdio.h> #include <stdlib.h> #include <unistd.h>
testcases/kernel/syscalls/rt_sigprocmask/rt_sigprocmask01.c +1 -0
@@ -39,6 +39,7 @@/* sigsetsize should indicate the size of a sigset_t type. */ /******************************************************************************/ +#define _GNU_SOURCE#include <stdio.h> #include <signal.h> #include <errno.h>
Signature · 1 line
2.7.0
PATCH 25/31 mc_gethost: include sys/types.h
In reply to Khem RajFix build on musl
error: unknown type name 'u_char'
--- testcases/network/multicast/mc_gethost/mc_gethost.c | 1 + 1 file changed, 1 insertion(+)
testcases/network/multicast/mc_gethost/mc_gethost.c +1 -0
@@ -6,6 +6,7 @@#include <sys/param.h> #include <sys/socket.h> +#include <sys/types.h> #include <netinet/in.h> #include <arpa/inet.h> #include <arpa/nameser.h>
Signature · 1 line
2.7.0
PATCH 26/31 crash01: Define _GNU_SOURCE
In reply to Khem RajFixes musl build errors like
error: 'SA_NOMASK' undeclared (first use in this function)
--- testcases/misc/crash/crash01.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/misc/crash/crash01.c +1 -1
@@ -49,7 +49,7 @@ stress test at the same time you run other tests, like a multi-userbenchmark. */ - +#define _GNU_SOURCE#include <stdio.h> #include <stdlib.h> #include <string.h>
Signature · 1 line
2.7.0
PATCH 27/31 sysconf01: Use _SC_2_C_VERSION conditionally
In reply to Khem Raj_SC_2_C_VERSION is not available on musl
--- testcases/kernel/syscalls/sysconf/sysconf01.c | 2 ++ 1 file changed, 2 insertions(+)
testcases/kernel/syscalls/sysconf/sysconf01.c +2 -0
@@ -102,7 +102,9 @@ int main(void)test_sysconf (_SC_ATEXIT_MAX);test_sysconf (_SC_2_C_BIND);test_sysconf (_SC_2_C_DEV); +#ifdef __GLIBC__test_sysconf (_SC_2_C_VERSION); +#endif /* 21 - 25 */ test_sysconf (_SC_2_CHAR_TERM);test_sysconf (_SC_2_FORT_DEV);
Signature · 1 line
2.7.0
PATCH 28/31 rt_sigaction.h: Use sighandler_t instead of __sighandler_t
In reply to Khem RajWhen _GNU_SOURCE is used then both typedefs are same and using sighandler_t makes it work on musl too
--- include/lapi/rt_sigaction.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/lapi/rt_sigaction.h +1 -1
@@ -34,7 +34,7 @@#define INVAL_SA_PTR ((void *)-1)struct kernel_sigaction { -__sighandler_t k_sa_handler; +sighandler_t k_sa_handler;unsigned long sa_flags;void (*sa_restorer) (void );sigset_t sa_mask;
Signature · 1 line
2.7.0
PATCH 29/31 trace_shed: Fix build with musl
In reply to Khem RajErrors on musl are
trace_sched.c:425:16: error: invalid operands to binary & (have 'thread_sched_t * {aka struct <anonymous> *}' and 'int')
thrd_ndx, WEXITSTATUS(status));
--- testcases/kernel/sched/tool/trace_sched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/sched/tool/trace_sched.c +1 -1
@@ -422,7 +422,7 @@ int main(int argc, /* number of input parameters. */if (status == (thread_sched_t *) -1 ) {fprintf (stderr,"thread [%d] - process exited with errors %d\n" , - thrd_ndx,WEXITSTATUS (status)); + thrd_ndx,WEXITSTATUS ((int )status));exit (-1 ); }else { exp_prio[thrd_ndx] = status->exp_prio;
Signature · 1 line
2.7.0
PATCH 30/31 lib: Use PTHREAD_MUTEX_RECURSIVE in place of PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP for non-glibc
In reply to Khem Raje.g. musl does not implement the _NP mutex types
--- lib/tst_res.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
lib/tst_res.c +4 -1
@@ -104,8 +104,11 @@ int TEST_ERRNO;assert (strlen (buf) >0 ); \ } while (0) +#ifdef __GLIBC__static pthread_mutex_t tmutex =PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP ; - +#else +static pthread_mutex_t tmutex = {PTHREAD_MUTEX_RECURSIVE }; +#endif /* * Define local function prototypes. */
Signature · 1 line
2.7.0
PATCH 31/31 vma03: fix page size offset as per page size alignment
In reply to Khem Rajthe offset the param of mmap2() doesn't align the page size, but, this param allow must be a multiple of the page size as returned by sysconf(_SC_PAGE_SIZE).meanwhile offset * 4096 must be a multiple of the system page size, so modify the input param of offset pgoff = (ULONG_MAX - 1)&(~((pgsz-1)>>12));
--- testcases/kernel/mem/vma/vma03.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/mem/vma/vma03.c +1 -1
@@ -85,7 +85,7 @@ int main(int argc, char *argv[])if (fd ==-1 )tst_brkm (TBROK |TERRNO ,NULL ,"open %s" ,TESTFILE ); - pgoff =ULONG_MAX -1 ; + pgoff = (ULONG_MAX -1 )&(~((pgsz-1 )>>12 )); map =mmap2 (NULL , pgsz,PROT_READ |PROT_WRITE ,MAP_PRIVATE , fd, pgoff);if (map ==MAP_FAILED )
Signature · 1 line
2.7.0