Skip to contentSkip to conversation

Add knob to control whether numa support should be checked

PATCH In review Khem Raj 4 participants 53 messages Jul 22, 2016 – Aug 1, 2016 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH v3 1/23 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 | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
m4/ltp-numa.m4 +7 -1
index 60ae07b..2cef0ef 100644
@@ -24,7 +24,12 @@ dnl ----------------------------
 dnl
 AC_DEFUN([LTP_CHECK_SYSCALL_NUMA],
 [dnl
-AC_CHECK_HEADERS([linux/mempolicy.h numa.h numaif.h],[
+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 +53,4 @@ 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
 )])
+])
Signature · 1 line
2.9.0
author
#1 lore raw

PATCH v3 2/23 Add knob to control tirpc support

From: 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
index e0e9c1b..14a9aa4 100644
@@ -99,6 +99,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
@@ -171,7 +178,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.9.0
#2 lore raw

PATCH v3 2/23 Add knob to control tirpc support

Hi!

Quoted 2 lines

allow to disable tirpc. Helps to disable it at top level for eg. musl it does not yet work.

This is the same as the numa one, should be done in the m4/ltp-tirpc.m4

Signature · 2 lines
Cyril Hrubis
[email protected]
author
#3 lore raw

PATCH v3 2/23 Add knob to control tirpc support

Quoted 5 lines · Cyril Hrubis

Hi!

Quoted 2 lines

allow to disable tirpc. Helps to disable it at top level for eg. musl it does not yet work.

This is the same as the numa one, should be done in the m4/ltp-tirpc.m4

OK. I have few other patches related to configure which I havent yet submitted I will fix redo it and send it with the second set.

Quoted 4 lines

--
Cyril Hrubis
[email protected]

author
#4 lore raw

PATCH v3 3/23 Remove including error.h, its unused

In reply to Khem Raj
---
 testcases/kernel/syscalls/faccessat/faccessat01.c   | 1 -
 testcases/kernel/syscalls/fallocate/fallocate01.c   | 1 -
 testcases/kernel/syscalls/fchmodat/fchmodat01.c     | 1 -
 testcases/kernel/syscalls/fchownat/fchownat01.c     | 1 -
 testcases/kernel/syscalls/fchownat/fchownat02.c     | 1 -
 testcases/kernel/syscalls/fstatat/fstatat01.c       | 1 -
 testcases/kernel/syscalls/futimesat/futimesat01.c   | 1 -
 testcases/kernel/syscalls/linkat/linkat01.c         | 1 -
 testcases/kernel/syscalls/linkat/linkat02.c         | 1 -
 testcases/kernel/syscalls/mkdirat/mkdirat01.c       | 1 -
 testcases/kernel/syscalls/mknodat/mknodat01.c       | 1 -
 testcases/kernel/syscalls/mknodat/mknodat02.c       | 1 -
 testcases/kernel/syscalls/openat/openat01.c         | 1 -
 testcases/kernel/syscalls/readlinkat/readlinkat01.c | 1 -
 testcases/kernel/syscalls/renameat/renameat01.c     | 1 -
 testcases/kernel/syscalls/symlinkat/symlinkat01.c   | 1 -
 testcases/kernel/syscalls/unlinkat/unlinkat01.c     | 1 -
 17 files changed, 17 deletions(-)
testcases/kernel/syscalls/faccessat/faccessat01.c +0 -1
index c9ab020..622dfd3 100644
@@ -37,7 +37,6 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
-#include <error.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <string.h>
testcases/kernel/syscalls/fallocate/fallocate01.c +0 -1
index e72b123..c99e799 100644
@@ -96,7 +96,6 @@
 #include <fcntl.h>
 #include <sys/syscall.h>
 #include <unistd.h>
-#include <error.h>
 #include <inttypes.h>
 #include <sys/utsname.h>
 
testcases/kernel/syscalls/fchmodat/fchmodat01.c +0 -1
index 0b35bf9..6bf66d8 100644
@@ -37,7 +37,6 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
-#include <error.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <string.h>
testcases/kernel/syscalls/fchownat/fchownat01.c +0 -1
index b361253..9f4ecde 100644
@@ -28,7 +28,6 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
-#include <error.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <string.h>
testcases/kernel/syscalls/fchownat/fchownat02.c +0 -1
index 6b0304c..d19f3f3 100644
@@ -26,7 +26,6 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
-#include <error.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <string.h>
testcases/kernel/syscalls/fstatat/fstatat01.c +0 -1
index 128f6dd..840d7b6 100644
@@ -28,7 +28,6 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <fcntl.h>
-#include <error.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <string.h>
testcases/kernel/syscalls/futimesat/futimesat01.c +0 -1
index 858212f..514cfcf 100644
@@ -28,7 +28,6 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <fcntl.h>
-#include <error.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <string.h>
testcases/kernel/syscalls/linkat/linkat01.c +0 -1
index fc0687b..0e82f7f 100644
@@ -49,7 +49,6 @@
 #include <sys/time.h>
 #include <fcntl.h>
 #include <unistd.h>
-#include <error.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <string.h>
testcases/kernel/syscalls/linkat/linkat02.c +0 -1
index 5fdf7e2..6766b5a 100644
@@ -23,7 +23,6 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
-#include <error.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <string.h>
testcases/kernel/syscalls/mkdirat/mkdirat01.c +0 -1
index 7e15947..a323ed5 100644
@@ -30,7 +30,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-#include <error.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <string.h>
testcases/kernel/syscalls/mknodat/mknodat01.c +0 -1
index 26e5538..2e13c77 100644
@@ -29,7 +29,6 @@
 #include <sys/types.h>
 #include <fcntl.h>
 #include <sys/stat.h>
-#include <error.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <string.h>
testcases/kernel/syscalls/mknodat/mknodat02.c +0 -1
index 7913872..0216aa2 100644
@@ -29,7 +29,6 @@
 #include <sys/types.h>
 #include <fcntl.h>
 #include <sys/stat.h>
-#include <error.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <string.h>
testcases/kernel/syscalls/openat/openat01.c +0 -1
index 85f9a91..0441c3a 100644
@@ -29,7 +29,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-#include <error.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <string.h>
testcases/kernel/syscalls/readlinkat/readlinkat01.c +0 -1
index 97a49e8..985890e 100644
@@ -29,7 +29,6 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <fcntl.h>
-#include <error.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <string.h>
testcases/kernel/syscalls/renameat/renameat01.c +0 -1
index 18b83d8..f6797da 100644
@@ -42,7 +42,6 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <fcntl.h>
-#include <error.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <string.h>
testcases/kernel/syscalls/symlinkat/symlinkat01.c +0 -1
index 5c238d8..e09ca10 100644
@@ -37,7 +37,6 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <fcntl.h>
-#include <error.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <string.h>
testcases/kernel/syscalls/unlinkat/unlinkat01.c +0 -1
index 5559650..cfc9c4d 100644
@@ -29,7 +29,6 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <fcntl.h>
-#include <error.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <string.h>
Signature · 1 line
2.9.0
author
#6 lore raw

PATCH v3 4/23 Remove unused __BEGIN_DECLS and __END_DECLS

In reply to Khem Raj

Replace __s32 definitions with int32_t
its not a generally available typedef

---
 testcases/kernel/syscalls/epoll2/include/epoll.h |  5 -----
 utils/sctp/include/netinet/sctp.h                | 10 +++-------
 2 files changed, 3 insertions(+), 12 deletions(-)
testcases/kernel/syscalls/epoll2/include/epoll.h +0 -5
index be599c7..d6976d1 100644
@@ -84,9 +84,6 @@ struct epoll_event
   epoll_data_t data;	/* User data variable */
 } EPOLL_PACKED;
 
-
-__BEGIN_DECLS
-
 /* Creates an epoll instance.  Returns an fd for the new instance.
    The "size" parameter is a hint specifying the number of file
    descriptors to be associated with the new instance.  The fd
@@ -114,6 +111,4 @@ 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
-
 #endif /* sys/epoll.h */
utils/sctp/include/netinet/sctp.h +3 -7
index 51f5bfb..c302cdb 100644
@@ -37,9 +37,7 @@
 #include <linux/types.h>
 #include <sys/socket.h>
 
-__BEGIN_DECLS
-
-typedef __s32 sctp_assoc_t;
+typedef int32_t sctp_assoc_t;
 
 /* Socket option layer for SCTP */
 #ifndef SOL_SCTP
@@ -658,7 +656,7 @@ struct sctp_assoc_value {
 struct sctp_paddrinfo {
 	sctp_assoc_t		spinfo_assoc_id;
 	struct sockaddr_storage	spinfo_address;
-	__s32			spinfo_state;
+	int32_t			spinfo_state;
 	__u32			spinfo_cwnd;
 	__u32			spinfo_srtt;
 	__u32			spinfo_rto;
@@ -693,7 +691,7 @@ enum sctp_spinfo_state {
  */
 struct sctp_status {
 	sctp_assoc_t		sstat_assoc_id;
-	__s32			sstat_state;
+	int32_t			sstat_state;
 	__u32			sstat_rwnd;
 	__u16			sstat_unackdata;
 	__u16			sstat_penddata;
@@ -862,6 +860,4 @@ 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
-
 #endif /* __linux_sctp_h__ */
Signature · 1 line
2.9.0
#7 lore raw

PATCH v3 4/23 Remove unused __BEGIN_DECLS and __END_DECLS

Hi!

Quoted 2 lines

Replace __s32 definitions with int32_t
its not a generally available typedef

Are you sure that __s32 is the only one missing?

Since all the __sXX and __uXX types are defined in a file included in /usr/include/asm-generic/types.h (int-ll64.h on x86_64) which is a part of linux-headers package. This rather looks like something is wrong with your kernel headers.

Signature · 2 lines
Cyril Hrubis
[email protected]
author
#8 lore raw

PATCH v3 5/23 guard mallocopt() with __GLIBC__

In reply to Khem Raj

mallocopt is not available on non glibc implementations

---
 utils/benchmark/ebizzy-0.3/ebizzy.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
utils/benchmark/ebizzy-0.3/ebizzy.c +4 -2
index 5bb8eff..f9ccc8b 100644
@@ -215,10 +215,12 @@ static void read_options(int argc, char *argv[])
 			"\"never mmap\" option specified\n");
 		usage();
 	}
-
+#ifdef __GLIBC__
 	if (never_mmap)
 		mallopt(M_MMAP_MAX, 0);
-
+#else
+	fprintf(stderr, "Platform does not support mallopt() API\n");
+#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.9.0
#9 lore raw

PATCH v3 5/23 guard mallocopt() with __GLIBC__

Hi!

utils/benchmark/ebizzy-0.3/ebizzy.c static void read_options(int argc, char *argv[]) · line 222

Quoted 6 lines
utils/benchmark/ebizzy-0.3/ebizzy.c +3 -1
+#ifdef __GLIBC__
 	if (never_mmap)
 		mallopt(M_MMAP_MAX, 0);
-
+#else
+	fprintf(stderr, "Platform does not support mallopt() API\n");

Shouldn't be this message printed only if (never_mmap) ?

Quoted 1 line

+#endif

Signature · 2 lines
Cyril Hrubis
[email protected]
author
#10 lore raw

PATCH v3 6/23 Use unsigned int instead of uint

In reply to Khem Raj

Fixes

error: unknown type name 'uint'

---
 testcases/kernel/ipc/ipc_stress/shmem_test_04.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
testcases/kernel/ipc/ipc_stress/shmem_test_04.c +2 -2
index 72c2e60..41aa3f4 100644
@@ -116,7 +116,7 @@ typedef unsigned long ulong_t;
  * sys_error (): System error message function
  * error (): Error message function
  */
-static int mkemptyfile(uint);
+static int mkemptyfile(unsigned int);
 static void parse_args(int, char **);
 static void cleanup(int);
 static void setup_signal_handlers();
@@ -476,7 +476,7 @@ static void int_handler(int sig)
  *
  * Make an empty temporary file of a given size and return its descriptor.
  */
-static int mkemptyfile(uint size)
+static int mkemptyfile(unsigned int size)
 {
 #ifdef _LINUX_
 
Signature · 1 line
2.9.0
author
#12 lore raw

PATCH v3 7/23 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           | 2 +-
 testcases/kernel/syscalls/ptrace/spawn_ptrace_child.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/ptrace/ptrace03.c +1 -1
index a4028fc..f326b83 100644
@@ -102,7 +102,7 @@ static pid_t unused_pid;
 static pid_t zero_pid;
 
 struct test_case_t {
-	enum __ptrace_request request;
+	int request;
 	pid_t *pid;
 	int exp_errno;
 } test_cases[] = {
testcases/kernel/syscalls/ptrace/spawn_ptrace_child.h +1 -1
index ae538e9..83de9b4 100644
@@ -130,7 +130,7 @@ static char *strings[] = {
 	SPT(KILL)
 	SPT(SINGLESTEP)
 };
-static inline char *strptrace(enum __ptrace_request request)
+static inline char *strptrace(int request)
 {
 	return strings[request];
 }
Signature · 1 line
2.9.0

A message that is not in the archive (sent off-list or not yet received): 20160722042656.22346-7-raj.khem-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#14 lore raw

Re: [LTP] [PATCH V3 07/23] ptrace: Use int instead of enum __ptrace_request

Hi!

Quoted 26 lines

__ptrace_request is only available with glibc

---
 testcases/kernel/syscalls/ptrace/ptrace03.c           | 2 +-
 testcases/kernel/syscalls/ptrace/spawn_ptrace_child.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/ptrace/ptrace03.c +1 -1
index a4028fc..f326b83 100644
@@ -102,7 +102,7 @@ static pid_t unused_pid;
 static pid_t zero_pid;
 
 struct test_case_t {
-	enum __ptrace_request request;
+	int request;
 	pid_t *pid;
 	int exp_errno;
 } test_cases[] = {
testcases/kernel/syscalls/ptrace/spawn_ptrace_child.h +0 -0
index ae538e9..83de9b4 100644

testcases/kernel/syscalls/ptrace/spawn_ptrace_child.h static char *strings[] = { · line 136

Quoted 8 lines
testcases/kernel/syscalls/ptrace/spawn_ptrace_child.h +1 -1
@@ -130,7 +130,7 @@ static char *strings[] = {
 	SPT(KILL)
 	SPT(SINGLESTEP)
 };
-static inline char *strptrace(enum __ptrace_request request)
+static inline char *strptrace(int request)
 {
 	return strings[request];
 }

The enum __ptrace_request is used to describe the function prototype in the ptrace() manual page so one can argue that it's part of the official API.

If I remeber right, it's missing in musl libc and the code in question fails to compile.

CCing glibc ML and also man-pages ML to see if the type is used in manual page intentionally or not.

Signature · 6 lines
Cyril Hrubis
[email protected]
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author
#15 lore raw

PATCH v3 8/23 rt_sigaction/rt_sigprocmark: Replace SA_NOMASK with SA_NODEFER

In reply to Khem Raj

Fixes musl build failure e.g.
error: 'SA_NOMASK' undeclared here (not in a function)

---
 testcases/kernel/syscalls/rt_sigaction/rt_sigaction01.c | 4 ++--
 testcases/kernel/syscalls/rt_sigaction/rt_sigaction02.c | 5 ++---
 testcases/kernel/syscalls/rt_sigaction/rt_sigaction03.c | 4 ++--
 testcases/kernel/syscalls/sigaction/sigaction02.c       | 2 +-
 testcases/misc/crash/crash01.c                          | 4 ++--
 testcases/misc/crash/crash02.c                          | 3 +--
 6 files changed, 10 insertions(+), 12 deletions(-)
testcases/kernel/syscalls/rt_sigaction/rt_sigaction01.c +2 -2
index 5cf89cc..e07b974 100644
@@ -57,10 +57,10 @@ static void setup(void)
 
 static int test_flags[] =
     { SA_RESETHAND | SA_SIGINFO, SA_RESETHAND, SA_RESETHAND | SA_SIGINFO,
-SA_RESETHAND | SA_SIGINFO, SA_NOMASK };
+SA_RESETHAND | SA_SIGINFO, SA_NODEFER };
 char *test_flags_list[] =
     { "SA_RESETHAND|SA_SIGINFO", "SA_RESETHAND", "SA_RESETHAND|SA_SIGINFO",
-"SA_RESETHAND|SA_SIGINFO", "SA_NOMASK" };
+"SA_RESETHAND|SA_SIGINFO", "SA_NODEFER" };
 
 static void handler(int sig)
 {
testcases/kernel/syscalls/rt_sigaction/rt_sigaction02.c +2 -3
index a1da743..594b260 100644
@@ -23,7 +23,6 @@
 /* Description: This tests the rt_sigaction() syscall                         */
 /*		rt_sigaction Expected EFAULT error check                      */
 /******************************************************************************/
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -55,10 +54,10 @@ void setup(void)
 
 static int test_flags[] =
     { SA_RESETHAND | SA_SIGINFO, SA_RESETHAND, SA_RESETHAND | SA_SIGINFO,
-SA_RESETHAND | SA_SIGINFO, SA_NOMASK };
+SA_RESETHAND | SA_SIGINFO, SA_NODEFER };
 char *test_flags_list[] =
     { "SA_RESETHAND|SA_SIGINFO", "SA_RESETHAND", "SA_RESETHAND|SA_SIGINFO",
-"SA_RESETHAND|SA_SIGINFO", "SA_NOMASK" };
+"SA_RESETHAND|SA_SIGINFO", "SA_NODEFER" };
 
 static struct test_case_t {
 	int exp_errno;
testcases/kernel/syscalls/rt_sigaction/rt_sigaction03.c +2 -2
index 175d220..991c87f 100644
@@ -55,10 +55,10 @@ static void setup(void)
 
 static int test_flags[] =
     { SA_RESETHAND | SA_SIGINFO, SA_RESETHAND, SA_RESETHAND | SA_SIGINFO,
-SA_RESETHAND | SA_SIGINFO, SA_NOMASK };
+SA_RESETHAND | SA_SIGINFO, SA_NODEFER };
 char *test_flags_list[] =
     { "SA_RESETHAND|SA_SIGINFO", "SA_RESETHAND", "SA_RESETHAND|SA_SIGINFO",
-"SA_RESETHAND|SA_SIGINFO", "SA_NOMASK" };
+"SA_RESETHAND|SA_SIGINFO", "SA_NODEFER" };
 
 static struct test_case_t {
 	int exp_errno;
testcases/kernel/syscalls/sigaction/sigaction02.c +1 -1
index 641a04e..8641bfc 100644
@@ -91,7 +91,7 @@ int set_handler(int sig, int sig_to_mask, int flag)
 
 	if (flag == 0) {
 		sa.sa_sigaction = (void *)handler;
-		sa.sa_flags = SA_NOMASK;
+		sa.sa_flags = SA_NODEFER;
 		sigemptyset(&sa.sa_mask);
 		sigaddset(&sa.sa_mask, sig_to_mask);
 		err = sigaction(sig, &sa, NULL);
testcases/misc/crash/crash01.c +2 -2
index 0574521..614b7e8 100644
@@ -49,7 +49,7 @@ stress test at the same time you run other tests, like a multi-user
 benchmark.
 
 */
-
+#define _GNU_SOURCE
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -409,7 +409,7 @@ void my_signal(int sig, void (*func) ())
 
 	act.sa_handler = func;
 	memset(&act.sa_mask, 0x00, sizeof(sigset_t));
-	act.sa_flags = SA_NOMASK | SA_RESTART;
+	act.sa_flags = SA_NODEFER | SA_RESTART;
 	sigaction(sig, &act, 0);
 }
 
testcases/misc/crash/crash02.c +1 -2
index 00fee34..1aba3b9 100644
@@ -49,7 +49,6 @@ TODO:
 	* Does a syscall is supposed to send SIGSEGV?
 */
 
-#define _GNU_SOURCE
 #include <sys/syscall.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -358,7 +357,7 @@ void my_signal(int sig, void (*func) ())
 
 	act.sa_handler = func;
 	memset(&act.sa_mask, 0x00, sizeof(sigset_t));
-	act.sa_flags = SA_NOMASK | SA_RESTART;
+	act.sa_flags = SA_NODEFER | SA_RESTART;
 	sigaction(sig, &act, 0);
 }
 
Signature · 1 line
2.9.0
#16 lore raw

PATCH v3 8/23 rt_sigaction/rt_sigprocmark: Replace SA_NOMASK with SA_NODEFER

Hi!

Quoted 33 lines
testcases/misc/crash/crash01.c +2 -2
@@ -49,7 +49,7 @@ stress test at the same time you run other tests, like a multi-user
 benchmark.
 
 */
-
+#define _GNU_SOURCE
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -409,7 +409,7 @@ void my_signal(int sig, void (*func) ())
 
 	act.sa_handler = func;
 	memset(&act.sa_mask, 0x00, sizeof(sigset_t));
-	act.sa_flags = SA_NOMASK | SA_RESTART;
+	act.sa_flags = SA_NODEFER | SA_RESTART;
 	sigaction(sig, &act, 0);
 }
 
testcases/misc/crash/crash02.c +0 -1
index 00fee34..1aba3b9 100644
@@ -49,7 +49,6 @@ TODO:
 	* Does a syscall is supposed to send SIGSEGV?
 */
 
-#define _GNU_SOURCE
 #include <sys/syscall.h>
 #include <stdio.h>
 #include <stdlib.h>

testcases/misc/crash/crash02.c void my_signal(int sig, void (*func) ()) · line 362

Quoted 7 lines
testcases/misc/crash/crash02.c +1 -1
@@ -358,7 +357,7 @@ void my_signal(int sig, void (*func) ())
 
 	act.sa_handler = func;
 	memset(&act.sa_mask, 0x00, sizeof(sigset_t));
-	act.sa_flags = SA_NOMASK | SA_RESTART;
+	act.sa_flags = SA_NODEFER | SA_RESTART;
 	sigaction(sig, &act, 0);
 }

What is the reason to add #define _GNU_SOURCE to crash01 and to remove it from crash02? That looks like unintended change to me.

The rest is obviously OK.

Signature · 2 lines
Cyril Hrubis
[email protected]
author
#17 lore raw

PATCH v3 8/23 rt_sigaction/rt_sigprocmark: Replace SA_NOMASK with SA_NODEFER

Quoted 38 lines · Cyril Hrubis

Hi!

Quoted 34 lines
testcases/misc/crash/crash01.c +0 -0
@@ -49,7 +49,7 @@ stress test at the same time you run other tests, like a multi-user

benchmark.

*/

testcases/misc/crash/crash01.c +1 -1
-
+#define _GNU_SOURCE

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

testcases/misc/crash/crash01.c +1 -1
@@ -409,7 +409,7 @@ void my_signal(int sig, void (*func) ())
 
 	act.sa_handler = func;
 	memset(&act.sa_mask, 0x00, sizeof(sigset_t));
-	act.sa_flags = SA_NOMASK | SA_RESTART;
+	act.sa_flags = SA_NODEFER | SA_RESTART;
 	sigaction(sig, &act, 0);
 }
 
testcases/misc/crash/crash02.c +0 -1
index 00fee34..1aba3b9 100644
@@ -49,7 +49,6 @@ TODO:
 	* Does a syscall is supposed to send SIGSEGV?
 */
 
-#define _GNU_SOURCE
 #include <sys/syscall.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -358,7 +357,7 @@ void my_signal(int sig, void (*func) ())
 
Quoted 9 lines

testcases/misc/crash/crash02.c void my_signal(int sig, void (*func) ()) · line 362

Quoted 6 lines
testcases/misc/crash/crash02.c +1 -1
 	act.sa_handler = func;
 	memset(&act.sa_mask, 0x00, sizeof(sigset_t));
-	act.sa_flags = SA_NOMASK | SA_RESTART;
+	act.sa_flags = SA_NODEFER | SA_RESTART;
 	sigaction(sig, &act, 0);
 }

What is the reason to add #define _GNU_SOURCE to crash01 and to remove it from crash02? That looks like unintended change to me.

The define was needed only for these SA_* symbols which are removed so I removed the define as well.

Quoted 6 lines

The rest is obviously OK.

--
Cyril Hrubis
[email protected]

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 204 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.linux.it/pipermail/ltp/attachments/20160727/f531c8de/attachment.sig>

#18 lore raw

PATCH v3 8/23 rt_sigaction/rt_sigprocmark: Replace SA_NOMASK with SA_NODEFER

Hi!

Quoted 37 lines
Quoted 27 lines
Quoted 27 lines

+#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

testcases/misc/crash/crash01.c +1 -1
@@ -409,7 +409,7 @@ void my_signal(int sig, void (*func) ())
 
 	act.sa_handler = func;
 	memset(&act.sa_mask, 0x00, sizeof(sigset_t));
-	act.sa_flags = SA_NOMASK | SA_RESTART;
+	act.sa_flags = SA_NODEFER | SA_RESTART;
 	sigaction(sig, &act, 0);
 }
 
testcases/misc/crash/crash02.c +0 -1
index 00fee34..1aba3b9 100644
@@ -49,7 +49,6 @@ TODO:
 	* Does a syscall is supposed to send SIGSEGV?
 */
 
-#define _GNU_SOURCE
 #include <sys/syscall.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -358,7 +357,7 @@ void my_signal(int sig, void (*func) ())
 
Quoted 9 lines

testcases/misc/crash/crash02.c void my_signal(int sig, void (*func) ()) · line 362

Quoted 6 lines
testcases/misc/crash/crash02.c +1 -1
 	act.sa_handler = func;
 	memset(&act.sa_mask, 0x00, sizeof(sigset_t));
-	act.sa_flags = SA_NOMASK | SA_RESTART;
+	act.sa_flags = SA_NODEFER | SA_RESTART;
 	sigaction(sig, &act, 0);
 }

What is the reason to add #define _GNU_SOURCE to crash01 and to remove it from crash02? That looks like unintended change to me.

Quoted 2 lines

The define was needed only for these SA_* symbols which are removed so I removed the define as well.

Hmm, so why the patch adds it to crash01.c at all?

Signature · 2 lines
Cyril Hrubis
[email protected]
author
#19 lore raw

PATCH v3 9/23 mc_gethost: Use unsigned char instead of u_char

In reply to Khem Raj

Fix build on musl
error: unknown type name 'u_char'

---
 testcases/network/multicast/mc_gethost/mc_gethost.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/network/multicast/mc_gethost/mc_gethost.c +1 -1
index 5b9a790..a5c5d01 100644
@@ -25,7 +25,7 @@ int main(argc, argv)
 int argc;
 char **argv;
 {
-	u_char b_addr[IN6ADDRSZ];
+	unsigned char b_addr[IN6ADDRSZ];
 	struct hostent *host;
 	char **ap, **cp, *arg;
 	const char *prog = "amnesia";
Signature · 1 line
2.9.0
author
#21 lore raw

PATCH v3 10/23 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
index 8542e77..7ebae23 100644
@@ -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 _SC_2_C_VERSION
 	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.9.0
#22 lore raw

PATCH v3 10/23 sysconf01: Use _SC_2_C_VERSION conditionally

Hi!

Quoted 1 line

_SC_2_C_VERSION is not available on musl

Looks like it has been removed from minimal required set of system variables in newer POSIXes.

Quoted 9 lines
---
 testcases/kernel/syscalls/sysconf/sysconf01.c | 2 ++
 1 file changed, 2 insertions(+)
testcases/kernel/syscalls/sysconf/sysconf01.c +0 -0
index 8542e77..7ebae23 100644

testcases/kernel/syscalls/sysconf/sysconf01.c int main(void) · line 107

Quoted 6 lines
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 _SC_2_C_VERSION
 	test_sysconf(_SC_2_C_VERSION);
+#endif

I've added an else branch that prints TCONF so that the number of tests is always the same and pushed, thanks.

Signature · 2 lines
Cyril Hrubis
[email protected]
author
#23 lore raw

PATCH v3 11/23 lapi: Use sig_t instead of sighandler_t

In reply to Khem Raj

sighandler_t is GNU specific

---
 include/lapi/rt_sigaction.h                      | 2 +-
 testcases/kernel/syscalls/rt_sigsuspend/Makefile | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
include/lapi/rt_sigaction.h +1 -1
index a107786..7efee33 100644
@@ -34,7 +34,7 @@
 #define INVAL_SA_PTR ((void *)-1)
 
 struct kernel_sigaction {
-	__sighandler_t k_sa_handler;
+	sig_t k_sa_handler;
 	unsigned long sa_flags;
 	void (*sa_restorer) (void);
 	sigset_t sa_mask;
testcases/kernel/syscalls/rt_sigsuspend/Makefile +1 -0
index 37bc3a9..2ef86f0 100644
@@ -19,4 +19,5 @@
 top_srcdir		?= ../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
+
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
Signature · 1 line
2.9.0
#24 lore raw

PATCH v3 11/23 lapi: Use sig_t instead of sighandler_t

Hi!

testcases/kernel/syscalls/rt_sigsuspend/Makefile line 23

Quoted 8 lines
testcases/kernel/syscalls/rt_sigsuspend/Makefile +1 -0
@@ -19,4 +19,5 @@
 top_srcdir		?= ../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
+
 include $(top_srcdir)/include/mk/generic_leaf_target.mk

Again this added newline is unintended change that should not have been part of this patch.

Signature · 2 lines
Cyril Hrubis
[email protected]
author
#25 lore raw

PATCH v3 11/23 lapi: Use sig_t instead of sighandler_t

Quoted 9 lines · Cyril Hrubis

Hi!

Quoted 5 lines
testcases/kernel/syscalls/rt_sigsuspend/Makefile +0 -0
@@ -19,4 +19,5 @@

top_srcdir ?= ../../../..

Quoted 6 lines
Quoted 3 lines

include $(top_srcdir)/include/mk/testcases.mk +
include $(top_srcdir)/include/mk/generic_leaf_target.mk

Again this added newline is unintended change that should not have been part of this patch.

overusing from my side. Do you want me to send a v4 ?

Quoted 4 lines

--
Cyril Hrubis
[email protected]

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 204 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.linux.it/pipermail/ltp/attachments/20160727/39e052df/attachment.sig>

#26 lore raw

PATCH v3 11/23 lapi: Use sig_t instead of sighandler_t

Hi!

Quoted 1 line

overusing from my side. Do you want me to send a v4 ?

Looking at it again, the sig_t is BSD specific one and may not be defined on older glibc.

So the safest bet would be to define it as:

void (*k_sa_handler)(int);

Signature · 2 lines
Cyril Hrubis
[email protected]
author
#27 lore raw

PATCH v3 12/23 trace_shed: Adapt to glibc 2.24 removal of union wait type

In reply to Khem Raj

This is now needed since glibc commit
https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=b49ab5f4503f36dcbf43f821f817da66b2931fe6;hp=5f5682b9654101ccaf375c2814cbddbe6033a725

The thread return status is
either -1 or pointer to the table. So there is no point in passing it to WEXITSTATUS() and priting the value

fixes below error

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 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
testcases/kernel/sched/tool/trace_sched.c +2 -2
index 7815686..71caf23 100644
@@ -421,8 +421,8 @@ int main(int argc,		/* number of input parameters.                        */
 		} else {
 			if (status == (thread_sched_t *) - 1) {
 				fprintf(stderr,
-					"thread [%d] - process exited with errors %d\n",
-					thrd_ndx, WEXITSTATUS(status));
+					"thread [%d] - process exited with exit code -1\n",
+					thrd_ndx);
 				exit(-1);
 			} else {
 				exp_prio[thrd_ndx] = status->exp_prio;
Signature · 1 line
2.9.0
#28 lore raw

PATCH v3 12/23 trace_shed: Adapt to glibc 2.24 removal of union wait type

Hi!
Pushed with a few changes to the commit description, thanks.

Signature · 2 lines
Cyril Hrubis
[email protected]
author
#29 lore raw

PATCH v3 13/23 vma03: fix page size offset as per page size alignment

In reply to Khem Raj

the 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));

needed on ppc64 with 64K pagesize

---
 testcases/kernel/mem/vma/vma03.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/mem/vma/vma03.c +1 -1
index ad8a7b4..a539233 100644
@@ -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.9.0
#30 lore raw

PATCH v3 13/23 vma03: fix page size offset as per page size alignment

Hi!
I've reworded the commit message and added a comment to the test code as well and pushed, thanks.

Signature · 2 lines
Cyril Hrubis
[email protected]
author
#31 lore raw

PATCH v3 14/23 shmat1: Cover GNU specific code under __USE_GNU

In reply to Khem Raj

on x86, we use uc_mcontext element from sigcontext which is marked gnu-specific in glibc, this patch adds this condition around the code

---
 testcases/kernel/mem/mtest06/shmat1.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
testcases/kernel/mem/mtest06/shmat1.c +2 -2
index 0d6d7a4..bee69f6 100644
@@ -111,7 +111,7 @@ int done_shmat = 0;		/* disallow read and writes before shmat      */
 static void sig_handler(int signal,	/* signal number, set to handle SIGALRM       */
 			int code, struct ucontext *ut)
 {				/* contains pointer to sigcontext structure   */
-#ifdef __i386__
+#if defined(__i386__) && defined(__USE_GNU)
 	unsigned long except;	/* exception type.                            */
 	int ret = 0;		/* exit code from signal handler.             */
 	struct sigcontext *scp =	/* pointer to sigcontext structure            */
@@ -122,7 +122,7 @@ static void sig_handler(int signal,	/* signal number, set to handle SIGALRM
 		fprintf(stdout, "Test ended, success\n");
 		exit(0);
 	}
-#ifdef __i386__
+#if defined(__i386__) && defined(__USE_GNU)
 	else {
 		except = scp->trapno;
 		fprintf(stderr, "signal caught - [%d] ", signal);
Signature · 1 line
2.9.0
#32 lore raw

PATCH v3 14/23 shmat1: Cover GNU specific code under __USE_GNU

Hi!

Quoted 1 line

+#if defined(__i386__) && defined(__USE_GNU)

Hmm, shouldn't this rather be defined(__GLIBC__) ?

As far as I can tell __USE_GNU is enabled if _GNU_SOURCE is defined while __GLIBC__ is defined in glibc unconditionally.

Signature · 2 lines
Cyril Hrubis
[email protected]
author
#33 lore raw

PATCH v3 14/23 shmat1: Cover GNU specific code under __USE_GNU

Quoted 10 lines · Cyril Hrubis

Hi!

Quoted 1 line

+#if defined(__i386__) && defined(__USE_GNU)

Hmm, shouldn't this rather be defined(__GLIBC__) ?

As far as I can tell __USE_GNU is enabled if _GNU_SOURCE is defined while __GLIBC__ is defined in glibc unconditionally.

Probably, yes

Quoted 4 lines

--
Cyril Hrubis
[email protected]

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 204 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.linux.it/pipermail/ltp/attachments/20160727/30dae79a/attachment.sig>

author
#34 lore raw

PATCH v3 15/23 Add periodic output for long time test.

In reply to Khem Raj

From: Tudor Florea <[email protected]>

This is needed in context of having scripts running ltp tests and waiting with a timeout for the output of the tests.

---
 .../kernel/controllers/memcg/stress/memcg_stress_test.sh      | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh +8 -3
index dc610f1..769da72 100755
@@ -37,7 +37,8 @@ if [ "x$(grep -w memory /proc/cgroups | cut -f4)" != "x1" ]; then
         exit 0
 fi
 
-RUN_TIME=$(( 60 * 60 ))
+ONE_MINUTE=60
+RUN_TIME=60
 
 cleanup()
 {
@@ -62,7 +63,7 @@ do_mount()
 # $1 - Number of cgroups
 # $2 - Allocated how much memory in one process? in MB
 # $3 - The interval to touch memory in a process
-# $4 - How long does this test run ? in second
+# $4 - How long does this test run ? in minutes
 run_stress()
 {
 	do_mount;
@@ -81,7 +82,11 @@ run_stress()
 		eval /bin/kill -s SIGUSR1 \$pid$i 2> /dev/null
 	done
 
-	sleep $4
+	for i in $(seq 0 $(($4-1)))
+	do
+		eval echo "Started $i min ago. Still alive... " 
+		sleep $ONE_MINUTE
+	done
 
 	for i in $(seq 0 $(($1-1)))
 	do
Signature · 1 line
2.9.0
#35 lore raw

PATCH v3 15/23 Add periodic output for long time test.

Hi!

Quoted 24 lines
testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh +3 -2
index dc610f1..769da72 100755
@@ -37,7 +37,8 @@ if [ "x$(grep -w memory /proc/cgroups | cut -f4)" != "x1" ]; then
         exit 0
 fi
 
-RUN_TIME=$(( 60 * 60 ))
+ONE_MINUTE=60
+RUN_TIME=60
 
 cleanup()
 {
@@ -62,7 +63,7 @@ do_mount()
 # $1 - Number of cgroups
 # $2 - Allocated how much memory in one process? in MB
 # $3 - The interval to touch memory in a process
-# $4 - How long does this test run ? in second
+# $4 - How long does this test run ? in minutes
 run_stress()
 {
 	do_mount;

testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh run_stress() · line 85

Quoted 5 lines
testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh +1 -1
@@ -81,7 +82,11 @@ run_stress()
 		eval /bin/kill -s SIGUSR1 \$pid$i 2> /dev/null
 	done
 
-	sleep $4
+	for i in $(seq 0 $(($4-1)))
                   ^
	for i in $(seq 1 $4); do

testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh run_stress() · line 87

Quoted 1 line
testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh +1 -0
+		eval echo "Started $i min ago. Still alive... " 

Why is this eval here?

Also can we be a bit less verbose?

What about just printing one dot (.) each minute and print a newline each ten minutes as well?

testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh run_stress() · line 88

Quoted 1 line
testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh +1 -0
+		sleep $ONE_MINUTE

There is no need for the ONE_MINUTE abstraction, just do sleep 60 here.

Quoted 10 lines
testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh +1 -0
+	done
 
 	for i in $(seq 0 $(($1-1)))
 	do
Signature · 5 lines
2.9.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 2 lines
Cyril Hrubis
[email protected]
#36 lore raw

PATCH v3 15/23 Add periodic output for long time test.

Hi
This patch was needed to avoid the timeout of the script used to parse the redirected output of the test. That being said don't have any strong arguments (pro or cons) of cleaning up or improving the patch. To be pedantic, I think that a newline for every 10 minutes is a little too seldom; maybe just adding a new line every 5 minute is acceptable. I hope that helps,
Tudor.

Quoted 57 lines · Cyril Hrubis

Hi!

Quoted 24 lines
testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh +3 -2
index dc610f1..769da72 100755
@@ -37,7 +37,8 @@ if [ "x$(grep -w memory /proc/cgroups | cut -f4)" != "x1" ]; then
         exit 0
 fi
 
-RUN_TIME=$(( 60 * 60 ))
+ONE_MINUTE=60
+RUN_TIME=60
 
 cleanup()
 {
@@ -62,7 +63,7 @@ do_mount()
 # $1 - Number of cgroups
 # $2 - Allocated how much memory in one process? in MB
 # $3 - The interval to touch memory in a process
-# $4 - How long does this test run ? in second
+# $4 - How long does this test run ? in minutes
 run_stress()
 {
 	do_mount;

testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh run_stress() · line 85

Quoted 5 lines
testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh +1 -1
@@ -81,7 +82,11 @@ run_stress()
 		eval /bin/kill -s SIGUSR1 \$pid$i 2> /dev/null
 	done
 
-	sleep $4
+	for i in $(seq 0 $(($4-1)))
                   ^
	for i in $(seq 1 $4); do

testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh run_stress() · line 87

Quoted 1 line
testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh +1 -0
+		eval echo "Started $i min ago. Still alive... " 

Why is this eval here?

Also can we be a bit less verbose?

What about just printing one dot (.) each minute and print a newline each ten minutes as well?

testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh run_stress() · line 88

Quoted 1 line
testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh +1 -0
+		sleep $ONE_MINUTE

There is no need for the ONE_MINUTE abstraction, just do sleep 60 here.

Quoted 10 lines
testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh +1 -0
+	done
 
 	for i in $(seq 0 $(($1-1)))
 	do
Signature · 5 lines
2.9.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#37 lore raw

PATCH v3 15/23 Add periodic output for long time test.

Hi!

Quoted 5 lines

This patch was needed to avoid the timeout of the script used to parse the redirected output of the test. That being said don't have any strong arguments (pro or cons) of cleaning up or improving the patch. To be pedantic, I think that a newline for every 10 minutes is a little too seldom; maybe just adding a new line every 5 minute is acceptable.

Newline per five lines is OK as well. Having 12 lines of output is still much better than having 60.

Signature · 2 lines
Cyril Hrubis
[email protected]
author
#38 lore raw

PATCH v3 16/23 Fix test_proc_kill hanging

In reply to Khem Raj

From: George Nita <[email protected]>

Sometimes the signal is delivered to memcg_process before the framework took into consideration its pid entered in the tasks. Fixed by delaying the signal send command.

---
 testcases/kernel/controllers/memcg/functional/memcg_lib.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/controllers/memcg/functional/memcg_lib.sh +1 -1
index c90d0a2..331e75b 100755
@@ -220,8 +220,8 @@ test_proc_kill()
 
 	$TEST_PATH/memcg_process $2 -s $3 &
 	pid=$!
-	sleep 1
 	echo $pid > tasks
+	sleep 1
 
 	kill -s USR1 $pid 2> /dev/null
 	sleep 1
Signature · 1 line
2.9.0
#39 lore raw

PATCH v3 16/23 Fix test_proc_kill hanging

Hi!

testcases/kernel/controllers/memcg/functional/memcg_lib.sh test_proc_kill() · line 224

Quoted 11 lines
testcases/kernel/controllers/memcg/functional/memcg_lib.sh +1 -1
index c90d0a2..331e75b 100755
@@ -220,8 +220,8 @@ test_proc_kill()
 
 	$TEST_PATH/memcg_process $2 -s $3 &
 	pid=$!
-	sleep 1
 	echo $pid > tasks
+	sleep 1

Hmm are you sure that this fixes race condition where the test is not attached to the group while the signal is send?

I would say that the kernel should guarantee that once the echo returns back to userspace the processes is attached. Anything else would be terribly racy.

There is different race condition as well, and this one is between the memcg_process setting up the signal handler and the stress test testing the signal that may be the cause for a random failures as well.

Quoted 8 lines
testcases/kernel/controllers/memcg/functional/memcg_lib.sh +0 -0
 	kill -s USR1 $pid 2> /dev/null
 	sleep 1
Signature · 5 lines
2.9.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 2 lines
Cyril Hrubis
[email protected]
author
#40 lore raw

PATCH v3 17/23 initialize recursive mutex in a portable way

In reply to Khem Raj

PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP is not in POSIX

use the portable way instead: pthread_once was designed for such cases.

Link with libpthread wherever libltp is asked for

---
 include/mk/testcases.mk                    |  2 +-
 lib/ltp.pc.in                              |  2 +-
 lib/newlib_tests/Makefile                  |  2 +-
 lib/tests/Makefile                         |  2 +-
 lib/tst_res.c                              | 18 +++++++++++++++++-
 testcases/kernel/containers/netns/Makefile |  2 +-
 testcases/kernel/containers/share/Makefile |  2 +-
 7 files changed, 23 insertions(+), 7 deletions(-)
include/mk/testcases.mk +1 -1
index ea26d4f..eff0eee 100644
@@ -49,7 +49,7 @@ CPPFLAGS	+= -I$(abs_top_builddir)/$(TKI_DIR)
 
 INSTALL_DIR	:= testcases/bin
 
-LDLIBS		+= -lltp
+LDLIBS		+= -lltp -lpthread
 
 $(APICMDS_DIR) $(LIBLTP_DIR) $(abs_top_builddir)/$(TKI_DIR): %:
 	mkdir -p "$@"
lib/ltp.pc.in +1 -1
index 9620129..63cd5f4 100644
@@ -6,5 +6,5 @@ libdir=@libdir@
 Name: LTP
 Description: Linux Test Project
 Version: @VERSION@
-Libs: -L${libdir} -lltp
+Libs: -L${libdir} -lltp -lpthread
 Cflags: -I${includedir}
lib/newlib_tests/Makefile +1 -1
index 0e4eeb8..9dd69fd 100644
@@ -3,7 +3,7 @@ top_srcdir		?= ../..
 include $(top_srcdir)/include/mk/env_pre.mk
 
 CFLAGS			+= -W -Wall
-LDLIBS			+= -lltp
+LDLIBS			+= -lltp -lpthread
 
 test08: CFLAGS+=-pthread
 test09: CFLAGS+=-pthread
lib/tests/Makefile +1 -1
index 73a0f16..bc4476d 100644
@@ -3,7 +3,7 @@ top_srcdir		?= ../..
 include $(top_srcdir)/include/mk/env_pre.mk
 
 CFLAGS			+= -W
-LDLIBS			+= -lltp
+LDLIBS			+= -lltp -lpthread
 
 tst_cleanup_once: CFLAGS += -pthread
 
lib/tst_res.c +17 -1
index b388d0d..ab995f8 100644
@@ -79,7 +79,8 @@ int TEST_ERRNO;
 	assert(strlen(buf) > 0);		\
 } while (0)
 
-static pthread_mutex_t tmutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+static pthread_once_t tmutex_once = PTHREAD_ONCE_INIT;
+static pthread_mutex_t tmutex;
 
 static void check_env(void);
 static void tst_condense(int tnum, int ttype, const char *tmesg);
@@ -142,9 +143,20 @@ const char *strttype(int ttype)
 #include "errnos.h"
 #include "signame.h"
 
+static void init_tmutex(void)
+{
+	pthread_mutexattr_t attr;
+
+	pthread_mutexattr_init(&attr);
+	pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+	pthread_mutex_init(&tmutex, &attr);
+	pthread_mutexattr_destroy(&attr);
+}
+
 static void tst_res__(const char *file, const int lineno, int ttype,
                       const char *arg_fmt, ...)
 {
+	pthread_once(&tmutex_once, init_tmutex);
 	pthread_mutex_lock(&tmutex);
 
 	char tmesg[USERMESG];
@@ -233,6 +245,7 @@ void tst_flush(void)
 {
 	NO_NEWLIB_ASSERT("Unknown", 0);
 
+	pthread_once(&tmutex_once, init_tmutex);
 	pthread_mutex_lock(&tmutex);
 
 	/*
@@ -369,6 +382,7 @@ void tst_exit(void)
 {
 	NO_NEWLIB_ASSERT("Unknown", 0);
 
+	pthread_once(&tmutex_once, init_tmutex);
 	pthread_mutex_lock(&tmutex);
 
 	tst_flush();
@@ -441,6 +455,7 @@ static int tst_brk_entered = 0;
 static void tst_brk__(const char *file, const int lineno, int ttype,
                       void (*func)(void), const char *arg_fmt, ...)
 {
+	pthread_once(&tmutex_once, init_tmutex);
 	pthread_mutex_lock(&tmutex);
 
 	char tmesg[USERMESG];
@@ -505,6 +520,7 @@ void tst_resm_hexd_(const char *file, const int lineno, int ttype,
 {
 	NO_NEWLIB_ASSERT(file, lineno);
 
+	pthread_once(&tmutex_once, init_tmutex);
 	pthread_mutex_lock(&tmutex);
 
 	char tmesg[USERMESG];
testcases/kernel/containers/netns/Makefile +1 -1
index 3756a55..b2411cd 100644
@@ -22,6 +22,6 @@ top_srcdir              ?= ../../../..
 include $(top_srcdir)/include/mk/testcases.mk
 include $(abs_srcdir)/../Makefile.inc
 
-LDLIBS                  := -lclone -lltp
+LDLIBS                  := -lclone -lltp -lpthread
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/containers/share/Makefile +1 -1
index 962d688..cd79f99 100644
@@ -17,6 +17,6 @@ top_srcdir              ?= ../../../..
 include $(top_srcdir)/include/mk/testcases.mk
 include $(abs_srcdir)/../Makefile.inc
 
-LDLIBS                  := -lltp
+LDLIBS                  := -lltp -lpthread
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
Signature · 1 line
2.9.0
#41 lore raw

PATCH v3 17/23 initialize recursive mutex in a portable way

Hi!

Quoted 42 lines
include/mk/testcases.mk +1 -1
index ea26d4f..eff0eee 100644
@@ -49,7 +49,7 @@ CPPFLAGS	+= -I$(abs_top_builddir)/$(TKI_DIR)
 
 INSTALL_DIR	:= testcases/bin
 
-LDLIBS		+= -lltp
+LDLIBS		+= -lltp -lpthread
 
 $(APICMDS_DIR) $(LIBLTP_DIR) $(abs_top_builddir)/$(TKI_DIR): %:
 	mkdir -p "$@"
lib/ltp.pc.in +1 -1
index 9620129..63cd5f4 100644
@@ -6,5 +6,5 @@ libdir=@libdir@
 Name: LTP
 Description: Linux Test Project
 Version: @VERSION@
-Libs: -L${libdir} -lltp
+Libs: -L${libdir} -lltp -lpthread
 Cflags: -I${includedir}
lib/newlib_tests/Makefile +1 -1
index 0e4eeb8..9dd69fd 100644
@@ -3,7 +3,7 @@ top_srcdir		?= ../..
 include $(top_srcdir)/include/mk/env_pre.mk
 
 CFLAGS			+= -W -Wall
-LDLIBS			+= -lltp
+LDLIBS			+= -lltp -lpthread
 
 test08: CFLAGS+=-pthread
 test09: CFLAGS+=-pthread
lib/tests/Makefile +0 -0
index 73a0f16..bc4476d 100644

lib/tests/Makefile top_srcdir ?= ../.. · line 8

Quoted 7 lines
lib/tests/Makefile +1 -1
@@ -3,7 +3,7 @@ top_srcdir		?= ../..
 include $(top_srcdir)/include/mk/env_pre.mk
 
 CFLAGS			+= -W
-LDLIBS			+= -lltp
+LDLIBS			+= -lltp -lpthread
 
 tst_cleanup_once: CFLAGS += -pthread

This causes everything to be linked with pthreads which is enough for my NACK for this patch.

Quoted 60 lines
lib/tst_res.c +16 -1
index b388d0d..ab995f8 100644
@@ -79,7 +79,8 @@ int TEST_ERRNO;
 	assert(strlen(buf) > 0);		\
 } while (0)
 
-static pthread_mutex_t tmutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+static pthread_once_t tmutex_once = PTHREAD_ONCE_INIT;
+static pthread_mutex_t tmutex;
 
 static void check_env(void);
 static void tst_condense(int tnum, int ttype, const char *tmesg);
@@ -142,9 +143,20 @@ const char *strttype(int ttype)
 #include "errnos.h"
 #include "signame.h"
 
+static void init_tmutex(void)
+{
+	pthread_mutexattr_t attr;
+
+	pthread_mutexattr_init(&attr);
+	pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+	pthread_mutex_init(&tmutex, &attr);
+	pthread_mutexattr_destroy(&attr);
+}
+
 static void tst_res__(const char *file, const int lineno, int ttype,
                       const char *arg_fmt, ...)
 {
+	pthread_once(&tmutex_once, init_tmutex);
 	pthread_mutex_lock(&tmutex);
 
 	char tmesg[USERMESG];
@@ -233,6 +245,7 @@ void tst_flush(void)
 {
 	NO_NEWLIB_ASSERT("Unknown", 0);
 
+	pthread_once(&tmutex_once, init_tmutex);
 	pthread_mutex_lock(&tmutex);
 
 	/*
@@ -369,6 +382,7 @@ void tst_exit(void)
 {
 	NO_NEWLIB_ASSERT("Unknown", 0);
 
+	pthread_once(&tmutex_once, init_tmutex);
 	pthread_mutex_lock(&tmutex);
 
 	tst_flush();
@@ -441,6 +455,7 @@ static int tst_brk_entered = 0;
 static void tst_brk__(const char *file, const int lineno, int ttype,
                       void (*func)(void), const char *arg_fmt, ...)
 {
+	pthread_once(&tmutex_once, init_tmutex);
 	pthread_mutex_lock(&tmutex);
 
 	char tmesg[USERMESG];

lib/tst_res.c void tst_resm_hexd_(const char *file, const int lineno, int ttype, · line 525

Quoted 6 lines
lib/tst_res.c +1 -0
@@ -505,6 +520,7 @@ void tst_resm_hexd_(const char *file, const int lineno, int ttype,
 {
 	NO_NEWLIB_ASSERT(file, lineno);
 
+	pthread_once(&tmutex_once, init_tmutex);
 	pthread_mutex_lock(&tmutex);
 

I do not like this.

I guess the easiest solution would be to eliminate the need for the mutex to be recursive.

Which may be possible if we turn the T_exitval into counters and use atomic operations to increment them which should us free from guarding T_exitval updates called from tst_print() which are called from all over the place. Or we can get rid of T_mode keeping only the default VERBOSE behavior, which should have the same efect...

Signature · 2 lines
Cyril Hrubis
[email protected]
author
#42 lore raw

PATCH v3 18/23 replace SIGCLD with SIGCHLD

In reply to Khem Raj

SIGCLD is defined with SIGCHLD anyway

see

bits/signum.h:#define SIGCLD SIGCHLD /* Same as SIGCHLD(System V). */

additionally these tests can now compile on systemd with musl libc

---
 doc/man3/tst_sig.3                               |  8 ++++----
 doc/man3/tst_tmpdir.3                            |  2 +-
 include/old/test.h                               |  4 ++--
 include/tst_cmd.h                                |  2 +-
 lib/signame.h                                    |  6 +++---
 lib/tst_sig.c                                    |  8 ++++----
 testcases/kernel/fs/doio/doio.c                  |  4 ++--
 testcases/kernel/fs/doio/growfiles.c             |  2 +-
 testcases/kernel/ipc/ipc_stress/signal_test_04.c |  2 +-
 testcases/kernel/ipc/ipc_stress/signals.h        |  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 +-
 tools/top-LTP/proc/sig.c                         |  2 +-
 20 files changed, 55 insertions(+), 55 deletions(-)
doc/man3/tst_sig.3 +4 -4
index 485c010..7550644 100644
@@ -55,18 +55,18 @@ of exiting following an unexpected interruption by a signal.
 program.
 .P
 The \fIfork_flag\fR parameter is used to tell \fItst_sig\fR
-whether or not to ignore the SIGCLD signal caused by the death of a
+whether or not to ignore the SIGCHLD signal caused by the death of a
 child process that had previously been created by the
 \fIfork\fR(2) system call (see \fIsignal\fR(2) for more
-information on the SIGCLD signal).
+information on the SIGCHLD signal).
 .P
 Setting \fIfork_flag\fR to FORK will cause \fItst_sig\fR to
-ignore the SIGCLD signal.  This option should be set if the
+ignore the SIGCHLD signal.  This option should be set if the
 test program directly (eg. call \fIfork\fR(2)) or indirectly
 (eg. call \fIsystem\fR(3S)) creates a child process.
 .P
 Setting \fIfork_flag\fR to NOFORK will cause \fItst_sig\fR to
-treat the SIGCLD signal just as any other unexpected
+treat the SIGCHLD signal just as any other unexpected
 signal (ie. the \fIhandler\fR will be called).
 This option should be set by any test program which does not
 directly or indirectly create any child processes.
doc/man3/tst_tmpdir.3 +1 -1
index 4baa359..b8a8d79 100644
@@ -61,7 +61,7 @@ to \fBtst_tmpdir()\fR and should be called immediately prior to the test
 exiting via \fBtst_exit()\fR.
 .P
 \fBtst_rmdir()\fR uses the \fBsystem\fR(3S) library routine (which in turn
-calls \fBfork\fR(2)), so tests that use it \fBcannot\fR treat SIGCLD as an
+calls \fBfork\fR(2)), so tests that use it \fBcannot\fR treat SIGCHLD as an
 unexpected signal.
 .P
 Users may gain access to the name of the temporary directory by declaring the
include/old/test.h +2 -2
index 9c52a83..cb22961 100644
@@ -72,8 +72,8 @@
 
 
 /* defines for unexpected signal setup routine (set_usig.c) */
-#define FORK    1		/* SIGCLD is to be ignored */
-#define NOFORK  0		/* SIGCLD is to be caught */
+#define FORK    1		/* SIGCHLD is to be ignored */
+#define NOFORK  0		/* SIGCHLD is to be caught */
 #define DEF_HANDLER SIG_ERR	/* tells set_usig() to use default signal handler */
 
 /*
include/tst_cmd.h +1 -1
index 78c1822..9f4240e 100644
@@ -92,7 +92,7 @@ static inline int tst_run_cmd(void (cleanup_fn)(void),
 }
 #endif
 
-/* Wrapper function for system(3), ignorcing SIGCLD signal.
+/* Wrapper function for system(3), ignorcing SIGCHLD signal.
  * @command: the command to be run.
  */
 int tst_system(const char *command);
lib/signame.h +3 -3
index 19d38d9..932ad1f 100644
@@ -51,9 +51,9 @@ const char *tst_strsig(int sig)
 		PAIR(SIGSTKFLT)
 	#endif
 
-	#ifdef SIGCLD
-		/* SIGCLD same as SIGCHLD */
-		STRPAIR(SIGCHLD, "SIGCHLD/SIGCLD")
+	#ifdef SIGCHLD
+		/* SIGCHLD same as SIGCHLD */
+		STRPAIR(SIGCHLD, "SIGCHLD/SIGCHLD")
 	#else
 		PAIR(SIGCHLD)
 	#endif
lib/tst_sig.c +4 -4
index 3af5ffd..36565e1 100644
@@ -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/fs/doio/doio.c +2 -2
index 4b0dec5..5f65ef9 100644
@@ -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
index 09e7f35..bbad230 100644
@@ -1640,7 +1640,7 @@ int set_sig(void)
 #ifdef SIGRESTART
 		case SIGRESTART:
 #endif /* SIGRESTART */
-		case SIGCLD:
+		case SIGCHLD:
 			break;
 
 		default:
testcases/kernel/ipc/ipc_stress/signal_test_04.c +1 -1
index e33a46f..9ee75ce 100644
@@ -147,7 +147,7 @@ int main(int argc, char **argv)
 	 * stop upon receiving the signal).
 	 *
 	 * Wait for the child process to receive the SIGSTOP signal
-	 * and send a corresponding SIGCLD interrupt to the parent.
+	 * and send a corresponding SIGCHLD interrupt to the parent.
 	 *
 	 * Send SIGKILL signal to child process (child process
 	 * will exit upon receiving the signal).
testcases/kernel/ipc/ipc_stress/signals.h +1 -1
index a842123..d9b6e14 100644
@@ -38,7 +38,7 @@ char * signames [] =
  "SIGALRM", //         14      // Alarm clock (POSIX).
  "SIGTERM", //         15      // Termination (ANSI).
  "SIGSTKFLT", //       16      // Stack fault.
- "SIGCLD/SIGCHLD", //  SIGCHLD // Same as SIGCHLD (System V).
+ "SIGCHLD/SIGCHLD", //  SIGCHLD // Same as SIGCHLD (System V).
  //"SIGCHLD", //       17      // Child status has changed (POSIX).
  "SIGCONT", //         18      // Continue (POSIX).
  "SIGSTOP", //         19      // Stop, unblockable (POSIX).
testcases/kernel/syscalls/fcntl/fcntl11.c +4 -4
index fa6ce53..2de2b6c 100644
@@ -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
index 229e490..e055f1a 100644
@@ -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;
@@ -390,7 +390,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
index a542cfc..88c91d6 100644
@@ -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
index aa06bab..99fd783 100644
@@ -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
index 5307021..8f1a67c 100644
@@ -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
index 9d6cc68..08360dd 100644
@@ -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
index 7a47a4a..d7c4147 100644
@@ -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
index 41c20e9..07b4fb8 100644
@@ -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
index e3076fb..be01874 100644
@@ -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:
tools/top-LTP/proc/sig.c +1 -1
index 1cfad86..0f9bdee 100644
@@ -23,7 +23,7 @@
  * You get SIGSTKFLT and SIGUNUSED instead on i386, m68k, ppc, and arm.
  * (this is a Linux & libc bug -- both must be fixed)
  *
- * Total garbage: SIGIO SIGINFO SIGIOT SIGLOST SIGCLD
+ * Total garbage: SIGIO SIGINFO SIGIOT SIGLOST SIGCHLD
  *                 (popular ones are handled as aliases)
  * Nearly garbage: SIGSTKFLT SIGUNUSED (nothing else to fill slots)
  */
Signature · 1 line
2.9.0
#43 lore raw

PATCH v3 18/23 replace SIGCLD with SIGCHLD

Hi!

lib/signame.h const char *tst_strsig(int sig) · line 59

Quoted 9 lines
lib/signame.h +3 -3
-	#ifdef SIGCLD
-		/* SIGCLD same as SIGCHLD */
-		STRPAIR(SIGCHLD, "SIGCHLD/SIGCLD")
+	#ifdef SIGCHLD
+		/* SIGCHLD same as SIGCHLD */
+		STRPAIR(SIGCHLD, "SIGCHLD/SIGCHLD")
 	#else
 		PAIR(SIGCHLD)
 	#endif

I had to fix this part, since obviously it does not make sense anymore and all of it needed to be replaced by just PAIR(SIGCHLD);

testcases/kernel/ipc/ipc_stress/signals.h char * signames [] = · line 44

Quoted 11 lines
testcases/kernel/ipc/ipc_stress/signals.h +1 -1
@@ -38,7 +38,7 @@ char * signames [] =
  "SIGALRM", //         14      // Alarm clock (POSIX).
  "SIGTERM", //         15      // Termination (ANSI).
  "SIGSTKFLT", //       16      // Stack fault.
- "SIGCLD/SIGCHLD", //  SIGCHLD // Same as SIGCHLD (System V).
+ "SIGCHLD/SIGCHLD", //  SIGCHLD // Same as SIGCHLD (System V).
  //"SIGCHLD", //       17      // Child status has changed (POSIX).
  "SIGCONT", //         18      // Continue (POSIX).
  "SIGSTOP", //         19      // Stop, unblockable (POSIX).

And here as well.

And pushed, thanks.

Signature · 2 lines
Cyril Hrubis
[email protected]
author
#44 lore raw

PATCH v3 19/23 creat06: Include limits.h for PATH_MAX

In reply to Khem Raj

Glibc includes limits.h indirectly and this error goes hidden but musl is less pardoning

Fixes errors like

creat06.c:81:23: error: ‘PATH_MAX’ undeclared here (not in a function)

 static char long_name[PATH_MAX+2];
                       ^~~~~~~~
---
 testcases/kernel/syscalls/creat/creat06.c | 1 +
 1 file changed, 1 insertion(+)
testcases/kernel/syscalls/creat/creat06.c +1 -0
index bb27d03..165c1de 100644
@@ -51,6 +51,7 @@
 
 #include <errno.h>
 #include <string.h>
+#include <limits.h>
 #include <pwd.h>
 #include <sys/mman.h>
 #include <sys/types.h>
Signature · 1 line
2.9.0
author
#46 lore raw

PATCH v3 20/23 fcntl34: Replace pthread_yield() with sched_yield()

In reply to Khem Raj

sched_yield() is specified in POSIX, helps compiling with musl

home/root/work/ltp/testcases/kernel/syscalls/fcntl/fcntl34.c:88: undefined reference to `pthread_yield'
collect2: error: ld returned 1 exit status
make: *** [<builtin>: fcntl34] Error 1

---
 testcases/kernel/syscalls/fcntl/fcntl34.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/fcntl/fcntl34.c +2 -1
index c72951e..a1c0c44 100644
@@ -23,6 +23,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <pthread.h>
+#include <sched.h>
 
 #include "lapi/fcntl.h"
 #include "tst_test.h"
@@ -84,7 +85,7 @@ void *thread_fn_01(void *arg)
 		if (fcntl(fd, F_OFD_SETLKW, &lck) == -1)
 			tst_brk(TBROK | TERRNO, "fcntl() failed");
 
-		pthread_yield();
+		sched_yield();
 	}
 
 	SAFE_CLOSE(fd);
Signature · 1 line
2.9.0
author
#48 lore raw

PATCH v3 21/23 rename 'sigset' var to avoid shadowing with libc symbol sigset

In reply to Khem Raj

Fixes errors like

epoll_pwait01.c:44:17: error: ‘sigset’ redeclared as different kind of symbol

 static sigset_t sigset;
                 ^~~~~~
In file included from ../../../../include/old/test.h:38:0,
                 from epoll_pwait01.c:36:
/usr/include/signal.h:231:8: note: previous declaration of ‘sigset’ was here
 void (*sigset(int, void (*)(int)))(int);
        ^~~~~~
---
 testcases/kernel/controllers/cgroup_fj/cgroup_fj_proc.c  |  6 +++---
 .../kernel/controllers/cpuctl_fj/cpuctl_fj_cpu-hog.c     |  6 +++---
 .../cpuset/cpuset_load_balance_test/cpuset_cpu_hog.c     | 16 ++++++++--------
 .../cpuset/cpuset_memory_spread_test/cpuset_mem_hog.c    |  8 ++++----
 testcases/kernel/fs/doio/doio.c                          |  6 +++---
 testcases/kernel/syscalls/epoll_pwait/epoll_pwait01.c    |  8 ++++----
 testcases/kernel/syscalls/sigsuspend/sigsuspend01.c      |  6 +++---
 testcases/kernel/syscalls/truncate/truncate03.c          |  8 ++++----
 .../conformance/interfaces/sched_setparam/1-1.c          |  8 ++++----
 9 files changed, 36 insertions(+), 36 deletions(-)
testcases/kernel/controllers/cgroup_fj/cgroup_fj_proc.c +3 -3
index 880cb76..93bc8b7 100644
@@ -40,7 +40,7 @@ void sighandler(UNUSED int signo)
 
 int main(void)
 {
-	sigset_t sigset;
+	sigset_t signalset;
 	struct sigaction sa;
 	pid_t pid;
 	int status;
@@ -54,11 +54,11 @@ int main(void)
 	if (sigaction(SIGUSR1, &sa, NULL) < 0)
 		err(1, "sigaction()");
 
-	if (sigemptyset(&sigset) < 0)
+	if (sigemptyset(&signalset) < 0)
 		err(1, "sigemptyset()");
 
 	/* wait for the signal SIGUSR1 to start testing */
-	sigsuspend(&sigset);
+	sigsuspend(&signalset);
 	if (errno != EINTR)
 		err(1, "sigsuspend()");
 
testcases/kernel/controllers/cpuctl_fj/cpuctl_fj_cpu-hog.c +3 -3
index 3f300c7..da1c312 100644
@@ -43,7 +43,7 @@ void sighandler(UNUSED int signo)
 
 int main(void)
 {
-	sigset_t sigset;
+	sigset_t signalset;
 	struct sigaction sa;
 
 	sa.sa_handler = sighandler;
@@ -54,10 +54,10 @@ int main(void)
 	if (sigaction(SIGUSR1, &sa, NULL) < 0)
 		err(1, "sigaction()");
 
-	if (sigemptyset(&sigset) < 0)
+	if (sigemptyset(&signalset) < 0)
 		err(1, "sigemptyset()");
 
-	sigsuspend(&sigset);
+	sigsuspend(&signalset);
 	if (errno != EINTR)
 		err(1, "sigsuspend()");
 
testcases/kernel/controllers/cpuset/cpuset_load_balance_test/cpuset_cpu_hog.c +8 -8
index de81f26..8a6ec26 100644
@@ -161,7 +161,7 @@ void checkopt(int argc, char **argv)
 int cpu_hog(void)
 {
 	double f = 2744545.34456455;
-	sigset_t sigset;
+	sigset_t signalset;
 	struct cpuset *cp = NULL;
 	struct bitmask *cpumask = NULL;
 	int cpu;
@@ -180,12 +180,12 @@ int cpu_hog(void)
 		goto err1;
 	}
 
-	if (sigemptyset(&sigset) < 0) {
+	if (sigemptyset(&signalset) < 0) {
 		ret = -1;
 		goto err2;
 	}
 
-	sigsuspend(&sigset);
+	sigsuspend(&signalset);
 
 	if (cpuset_cpusetofpid(cp, 0) < 0) {
 		ret = -1;
@@ -249,7 +249,7 @@ int main(int argc, char **argv)
 	int i = 0;
 	pid_t pid;
 	pid_t *childpids = NULL;
-	sigset_t sigset;
+	sigset_t signalset;
 	int status = 0;
 	int ret = 0;
 
@@ -260,7 +260,7 @@ int main(int argc, char **argv)
 		exit(EXIT_FAILURE);
 	}
 
-	if (sigemptyset(&sigset) < 0) {
+	if (sigemptyset(&signalset) < 0) {
 		warn("sigemptyset failed");
 		report_result("2\n");
 		exit(EXIT_FAILURE);
@@ -275,7 +275,7 @@ int main(int argc, char **argv)
 	memset(childpids, 0, (nprocs) * sizeof(pid_t));
 
 	report_result("0\n");
-	sigsuspend(&sigset);
+	sigsuspend(&signalset);
 	for (; i < nprocs; i++) {
 		pid = fork();
 		if (pid == -1) {
@@ -294,10 +294,10 @@ int main(int argc, char **argv)
 	report_result("0\n");
 
 	while (!end) {
-		if (sigemptyset(&sigset) < 0)
+		if (sigemptyset(&signalset) < 0)
 			ret = -1;
 		else
-			sigsuspend(&sigset);
+			sigsuspend(&signalset);
 
 		if (ret || end) {
 			for (i = 0; i < nprocs; i++) {
testcases/kernel/controllers/cpuset/cpuset_memory_spread_test/cpuset_mem_hog.c +4 -4
index 6ca6663..56e039e 100644
@@ -71,13 +71,13 @@ int page_cache_hog(void)
 
 int mem_hog(void)
 {
-	sigset_t sigset;
+	sigset_t signalset;
 	int fd;
 	int ret = 0;
 
-	if (sigemptyset(&sigset) < 0)
+	if (sigemptyset(&signalset) < 0)
 		err(1, "sigemptyset()");
-	sigsuspend(&sigset);
+	sigsuspend(&signalset);
 
 	while (!end) {
 		ret = page_cache_hog();
@@ -96,7 +96,7 @@ int mem_hog(void)
 
 		close(fd);
 
-		sigsuspend(&sigset);
+		sigsuspend(&signalset);
 	}
 
 	return ret;
testcases/kernel/fs/doio/doio.c +3 -3
index 5f65ef9..be68999 100644
@@ -4743,7 +4743,7 @@ int aio_wait(int aio_id)
 #ifdef RECALL_SIZEOF
 	long mask[RECALL_SIZEOF];
 #endif
-	sigset_t sigset;
+	sigset_t signalset;
 	struct aio_info *aiop;
 #ifdef CRAY
 	struct iosw *ioswlist[1];
@@ -4762,11 +4762,11 @@ int aio_wait(int aio_id)
 		break;
 
 	case A_SIGNAL:
-		sigemptyset(&sigset);
+		sigemptyset(&signalset);
 		sighold(aiop->sig);
 
 		while (!aiop->signalled || !aiop->done) {
-			sigsuspend(&sigset);
+			sigsuspend(&signalset);
 			sighold(aiop->sig);
 		}
 		break;
testcases/kernel/syscalls/epoll_pwait/epoll_pwait01.c +4 -4
index 4f8448e..ed05da8 100644
@@ -41,7 +41,7 @@ char *TCID = "epoll_pwait01";
 int TST_TOTAL = 2;
 
 static int epfd, fds[2];
-static sigset_t sigset;
+static sigset_t signalset;
 static struct epoll_event epevs;
 static struct sigaction sa;
 
@@ -64,7 +64,7 @@ int main(int ac, char **av)
 	for (lc = 0; TEST_LOOPING(lc); lc++) {
 		tst_count = 0;
 
-		do_test(&sigset);
+		do_test(&signalset);
 		do_test(NULL);
 	}
 
@@ -83,10 +83,10 @@ static void setup(void)
 
 	TEST_PAUSE;
 
-	if (sigemptyset(&sigset) == -1)
+	if (sigemptyset(&signalset) == -1)
 		tst_brkm(TFAIL | TERRNO, NULL, "sigemptyset() failed");
 
-	if (sigaddset(&sigset, SIGUSR1) == -1)
+	if (sigaddset(&signalset, SIGUSR1) == -1)
 		tst_brkm(TFAIL | TERRNO, NULL, "sigaddset() failed");
 
 	sa.sa_flags = 0;
testcases/kernel/syscalls/sigsuspend/sigsuspend01.c +3 -3
index b84f986..b9542e7 100644
@@ -83,7 +83,7 @@ char *TCID = "sigsuspend01";
 int TST_TOTAL = 1;
 
 struct sigaction sa_new;	/* struct to hold signal info */
-sigset_t sigset;		/* signal set to hold signal lists */
+sigset_t signalset;		/* signal set to hold signal lists */
 sigset_t sigset1;
 sigset_t sigset2;
 
@@ -111,7 +111,7 @@ int main(int ac, char **av)
 		 * of the process and suspend process execution till
 		 * receipt of a signal 'SIGALRM'.
 		 */
-		TEST(sigsuspend(&sigset));
+		TEST(sigsuspend(&signalset));
 
 		/* Reset the alarm timer */
 		alarm(0);
@@ -160,7 +160,7 @@ void setup(void)
 	 * Initialise the signal sets with the list that
 	 * excludes/includes  all system-defined signals.
 	 */
-	if (sigemptyset(&sigset) == -1) {
+	if (sigemptyset(&signalset) == -1) {
 		tst_brkm(TFAIL, cleanup,
 			 "sigemptyset() failed, errno=%d : %s",
 			 errno, strerror(errno));
testcases/kernel/syscalls/truncate/truncate03.c +4 -4
index 60881c9..2e97f45 100644
@@ -119,7 +119,7 @@ void setup(void)
 	struct passwd *ltpuser;
 	char *bad_addr;
 	struct rlimit rlim;
-	sigset_t sigset;
+	sigset_t signalset;
 
 	tst_sig(NOFORK, DEF_HANDLER, cleanup);
 
@@ -157,9 +157,9 @@ void setup(void)
 	rlim.rlim_max = MAX_FSIZE;
 	SAFE_SETRLIMIT(cleanup, RLIMIT_FSIZE, &rlim);
 
-	sigemptyset(&sigset);
-	sigaddset(&sigset, SIGXFSZ);
-	TEST(sigprocmask(SIG_BLOCK, &sigset, NULL));
+	sigemptyset(&signalset);
+	sigaddset(&signalset, SIGXFSZ);
+	TEST(sigprocmask(SIG_BLOCK, &signalset, NULL));
 	if (TEST_RETURN != 0)
 		tst_brkm(TBROK | TTERRNO, cleanup, "sigprocmask");
 }
testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/1-1.c +4 -4
index 8674e2f..f7cfc9e 100644
@@ -22,18 +22,18 @@
 
 void child_proc()
 {
-	sigset_t sigset;
+	sigset_t signalset;
 	int sig;
 
-	if (sigemptyset(&sigset) != 0) {
+	if (sigemptyset(&signalset) != 0) {
 		perror("An error occurs when calling sigemptyset()");
 		exit(1);
 	}
-	if (sigaddset(&sigset, SIGUSR1) != 0) {
+	if (sigaddset(&signalset, SIGUSR1) != 0) {
 		perror("An error occurs when calling sigaddset()");
 		exit(1);
 	}
-	if (sigwait(&sigset, &sig) != 0) {
+	if (sigwait(&signalset, &sig) != 0) {
 		perror("An error occurs when calling sigwait()");
 		exit(1);
 	}
Signature · 1 line
2.9.0
author
#50 lore raw

PATCH v3 22/23 pec: Replace obsoleted SA_ONESHOT with SA_RESETHAND

In reply to Khem Raj

This is needed especially for musl, for glibc _GNU_SOURCE is added by libc-features.h automatically. which defines SA_ONESHOT

Fixes

pec_listener.c: In function ‘main’:
pec_listener.c:233:27: error: ‘SA_ONESHOT’ undeclared (first use in this function)

  sigint_action.sa_flags = SA_ONESHOT;
                           ^~~~~~~~~~
---
 testcases/kernel/connectors/pec/pec_listener.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/connectors/pec/pec_listener.c +1 -1
index a1beb13..d11e4dc 100644
@@ -230,7 +230,7 @@ int main(int argc, char **argv)
 	struct sockaddr_nl src_addr;
 	struct pollfd pfd;
 
-	sigint_action.sa_flags = SA_ONESHOT;
+	sigint_action.sa_flags = SA_RESETHAND;
 	sigint_action.sa_handler = &sigint_handler;
 	sigaction(SIGINT, &sigint_action, NULL);
 
Signature · 1 line
2.9.0
author
#52 lore raw

PATCH v3 23/23 shmem_test_04: Include sys/types.h for caddr_t

In reply to Khem Raj
---
 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
index 41aa3f4..01cf62b 100644
@@ -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.9.0
#53 lore raw

PATCH v3 23/23 shmem_test_04: Include sys/types.h for caddr_t

Hi!
The caddr_t is legacy BSD type it should rather be replaced with void *.

Signature · 2 lines
Cyril Hrubis
[email protected]