Hello community, here is the log from the commit of package stress-ng for openSUSE:Factory checked in at 2019-12-10 22:43:27 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/stress-ng (Old) and /work/SRC/openSUSE:Factory/.stress-ng.new.4691 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "stress-ng" Tue Dec 10 22:43:27 2019 rev:72 rq:755498 version:0.10.13 Changes: -------- --- /work/SRC/openSUSE:Factory/stress-ng/stress-ng.changes 2019-11-28 13:51:09.070688436 +0100 +++ /work/SRC/openSUSE:Factory/.stress-ng.new.4691/stress-ng.changes 2019-12-10 22:43:38.349782050 +0100 @@ -1,0 +2,24 @@ +Mon Dec 9 19:32:58 UTC 2019 - Martin Hauke <mar...@gmx.de> + +- Update to version 0.10.13 + * stress-dev: add TIOCMGET, TIOCGICOUNT and TIOCGSERIAL ioctls + * stress-close: add more open types, don't chown files if root, + remove AF_APPLETALK + * stress-close: enable some more socket domains + * test: add test-setproctitle.c, forgot to add this earlier + * Where possible set the process title (argv[0]) + * Change cache size information from info to debug level output + * stress-ng: add missing space between switch statement and ( + * Add SIGILL to signals that need to be handled, it was missing + * stress-rdrand: fix typo in \n at end of info message + * stress-sock: fix build issues on systems without HAVE_RECVMMSG + * stress-sock: get the incoming CPU of the socket + * stress-sock: get MTU size and set TOS to IPTOS_THROUGHPUT + * kernel-coverage.sh: add random sock-opts flag + * stress-sock: also exercice recvmmsg and recvmsg + * stress-sock: remove debug + * stress-sock: add a random send option for --sock-opt + * core-mwc: fix mwc8() being reset when using mwc1() + * stress-schedpolicy: silently ignore EBUSY returns + +------------------------------------------------------------------- Old: ---- stress-ng-0.10.12.tar.xz New: ---- stress-ng-0.10.13.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ stress-ng.spec ++++++ --- /var/tmp/diff_new_pack.l2TL4A/_old 2019-12-10 22:43:39.037781795 +0100 +++ /var/tmp/diff_new_pack.l2TL4A/_new 2019-12-10 22:43:39.041781793 +0100 @@ -18,7 +18,7 @@ Name: stress-ng -Version: 0.10.12 +Version: 0.10.13 Release: 0 Summary: Tool to load and stress a computer License: GPL-2.0-only ++++++ stress-ng-0.10.12.tar.xz -> stress-ng-0.10.13.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.10.12/Makefile new/stress-ng-0.10.13/Makefile --- old/stress-ng-0.10.12/Makefile 2019-11-27 20:41:37.000000000 +0100 +++ new/stress-ng-0.10.13/Makefile 2019-12-09 13:42:13.000000000 +0100 @@ -16,7 +16,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION=0.10.12 +VERSION=0.10.13 # # Codename "systematic system smasher" # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.10.12/Makefile.config new/stress-ng-0.10.13/Makefile.config --- old/stress-ng-0.10.12/Makefile.config 2019-11-27 20:41:37.000000000 +0100 +++ new/stress-ng-0.10.13/Makefile.config 2019-12-09 13:42:13.000000000 +0100 @@ -219,6 +219,14 @@ endif endif +ifndef $(HAVE_BSD_UNISTD_H) +HAVE_BSD_UNISTD_H = $(shell $(MAKE) -f Makefile.config --no-print-directory $(HAVE_NOT) HEADER=bsd/unistd.h have_header_h) +ifeq ($(HAVE_BSD_UNISTD_H),1) + CONFIG_CFLAGS += -DHAVE_BSD_UNISTD_H +$(info autoconfig: using bsd/unistd.h) +endif +endif + ifndef $(HAVE_BSD_WCHAR) HAVE_BSD_WCHAR = $(shell $(MAKE) -f Makefile.config --no-print-directory $(HAVE_NOT) TEST_PROG=test-bsd-wchar have_test_prog) ifeq ($(HAVE_BSD_WCHAR),1) @@ -980,6 +988,14 @@ endif endif +ifndef $(HAVE_LINUX_SERIAL_H) +HAVE_LINUX_SERIAL_H = $(shell $(MAKE) -f Makefile.config --no-print-directory $(HAVE_NOT) HEADER=linux/serial.h have_header_h) +ifeq ($(HAVE_LINUX_SERIAL_H),1) + CONFIG_CFLAGS += -DHAVE_LINUX_SERIAL_H +$(info autoconfig: using linux/serial.h) +endif +endif + ifndef $(HAVE_LINUX_SOCK_DIAG_H) HAVE_LINUX_SOCK_DIAG_H = $(shell $(MAKE) -f Makefile.config --no-print-directory $(HAVE_NOT) TEST_PROG=test-sock-diag have_test_prog) ifeq ($(HAVE_LINUX_SOCK_DIAG_H),1) @@ -2146,6 +2162,14 @@ endif endif +ifndef $(HAVE_RECVMMSG) +HAVE_RECVMMSG = $(shell $(MAKE) -f Makefile.config --no-print-directory $(HAVE_NOT) TEST_PROG=test-recvmmsg have_test_prog) +ifeq ($(HAVE_RECVMMSG),1) + CONFIG_CFLAGS += -DHAVE_RECVMMSG +$(info autoconfig: using recvmmsg) +endif +endif + ifndef $(HAVE_REMAP_FILE_PAGES) HAVE_REMAP_FILE_PAGES = $(shell $(MAKE) -f Makefile.config --no-print-directory $(HAVE_NOT) TEST_PROG=test-remap-file-pages have_test_prog) ifeq ($(HAVE_REMAP_FILE_PAGES),1) @@ -2245,6 +2269,14 @@ endif endif +ifndef $(HAVE_SETPROCTITLE) +HAVE_SETPROCTITLE = $(shell $(MAKE) -f Makefile.config --no-print-directory $(HAVE_NOT) TEST_LIBS=$(LIB_BSD) TEST_PROG=test-setproctitle have_test_prog) +ifeq ($(HAVE_SETPROCTITLE),1) + CONFIG_CFLAGS += -DHAVE_SETPROCTITLE +$(info autoconfig: using setproctitle) +endif +endif + ifndef $(HAVE_SETNS) HAVE_SETNS = $(shell $(MAKE) -f Makefile.config --no-print-directory $(HAVE_NOT) TEST_PROG=test-setns have_test_prog) ifeq ($(HAVE_SETNS),1) @@ -2423,6 +2455,22 @@ endif endif +ifndef $(HAVE_SERIAL_ICOUNTER) +HAVE_SERIAL_ICOUNTER = $(shell $(MAKE) -f Makefile.config --no-print-directory $(HAVE_NOT) TEST_PROG=test-serial-icounter have_test_prog) +ifeq ($(HAVE_SERIAL_ICOUNTER),1) + CONFIG_CFLAGS += -DHAVE_SERIAL_ICOUNTER +$(info autoconfig: using struct serial_icounter_struct) +endif +endif + +ifndef $(HAVE_SERIAL_STRUCT) +HAVE_SERIAL_STRUCT = $(shell $(MAKE) -f Makefile.config --no-print-directory $(HAVE_NOT) TEST_PROG=test-serial-struct have_test_prog) +ifeq ($(HAVE_SERIAL_STRUCT),1) + CONFIG_CFLAGS += -DHAVE_SERIAL_STRUCT +$(info autoconfig: using struct serial_struct) +endif +endif + ifndef $(HAVE_SHMID_DS) HAVE_SHMID_DS = $(shell $(MAKE) -f Makefile.config --no-print-directory $(HAVE_NOT) TEST_PROG=test-shmid-ds have_test_prog) ifeq ($(HAVE_SHMID_DS),1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.10.12/core-helper.c new/stress-ng-0.10.13/core-helper.c --- old/stress-ng-0.10.12/core-helper.c 2019-11-27 20:41:37.000000000 +0100 +++ new/stress-ng-0.10.13/core-helper.c 2019-12-09 13:42:13.000000000 +0100 @@ -418,19 +418,42 @@ } /* + * stress_set_proc_name_init() + * init setproctitle if supported + */ +void stress_set_proc_name_init(int argc, char *argv[], char *envp[]) +{ +#if defined(HAVE_BSD_UNISTD_H) && \ + defined(HAVE_SETPROCTITLE) + (void)setproctitle_init(argc, argv, envp); +#else + (void)argc; + (void)argv; + (void)envp; +#endif +} + +/* * stress_set_proc_name() * Set process name, we don't care if it fails */ void stress_set_proc_name(const char *name) { + (void)name; + + if (!(g_opt_flags & OPT_FLAGS_KEEP_NAME)) { +#if defined(HAVE_BSD_UNISTD_H) && \ + defined(HAVE_SETPROCTITLE) + /* Sets argv[0] */ + setproctitle("-%s", name); +#endif #if defined(HAVE_PRCTL) && \ defined(HAVE_SYS_PRCTL_H) && \ defined(PR_SET_NAME) - if (!(g_opt_flags & OPT_FLAGS_KEEP_NAME)) + /* Sets the comm field */ (void)prctl(PR_SET_NAME, name); -#else - (void)name; /* No-op */ #endif + } } /* @@ -774,7 +797,7 @@ cpu_caches = get_all_cpu_cache_details(); if (!cpu_caches) { if (warn_once(WARN_ONCE_CACHE_DEFAULT)) - pr_inf("%s: using defaults, can't determine cache details from sysfs\n", name); + pr_dbg("%s: using defaults, can't determine cache details from sysfs\n", name); g_shared->mem_cache_size = MEM_CACHE_SIZE; goto init_done; } @@ -792,7 +815,7 @@ cache = get_cpu_cache(cpu_caches, g_shared->mem_cache_level); if (!cache) { if (warn_once(WARN_ONCE_CACHE_NONE)) - pr_inf("%s: using built-in defaults as no suitable " + pr_dbg("%s: using built-in defaults as no suitable " "cache found\n", name); g_shared->mem_cache_size = MEM_CACHE_SIZE; goto init_done; @@ -820,7 +843,7 @@ if (!g_shared->mem_cache_size) { if (warn_once(WARN_ONCE_CACHE_DEFAULT)) - pr_inf("%s: using built-in defaults as " + pr_dbg("%s: using built-in defaults as " "unable to determine cache size\n", name); g_shared->mem_cache_size = MEM_CACHE_SIZE; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.10.12/core-mwc.c new/stress-ng-0.10.13/core-mwc.c --- old/stress-ng-0.10.12/core-mwc.c 2019-11-27 20:41:37.000000000 +0100 +++ new/stress-ng-0.10.13/core-mwc.c 2019-12-09 13:42:13.000000000 +0100 @@ -154,7 +154,7 @@ { static uint32_t mwc_saved; - if (mwc_n16) { + if (LIKELY(mwc_n16)) { mwc_n16--; mwc_saved >>= 16; } else { @@ -194,7 +194,7 @@ mwc_n1--; mwc_saved >>= 1; } else { - mwc_n8 = 31; + mwc_n1 = 31; mwc_saved = mwc32(); } return mwc_saved & 0x1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.10.12/kernel-coverage.sh new/stress-ng-0.10.13/kernel-coverage.sh --- old/stress-ng-0.10.12/kernel-coverage.sh 2019-11-27 20:41:37.000000000 +0100 +++ new/stress-ng-0.10.13/kernel-coverage.sh 2019-12-09 13:42:13.000000000 +0100 @@ -119,6 +119,7 @@ do_stress --sock 0 --sock-domain unix do_stress --sock 0 --sock-type stream do_stress --sock 0 --sock-type seqpacket +do_stress --sock 0 --sock-opts random do_stress --stream 0 --stream-madvise hugepage do_stress --stream 0 --stream-madvise nohugepage diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.10.12/stress-close.c new/stress-ng-0.10.13/stress-close.c --- old/stress-ng-0.10.12/stress-close.c 2019-11-27 20:41:37.000000000 +0100 +++ new/stress-ng-0.10.13/stress-close.c 2019-12-09 13:42:13.000000000 +0100 @@ -33,6 +33,7 @@ #if defined(HAVE_LIB_PTHREAD) #define MAX_PTHREADS (3) +#define SHM_NAME_LEN (128) static volatile int fd, dupfd; static volatile uint64_t max_delay_us = 1; @@ -45,15 +46,12 @@ #if defined(AF_LOCAL) AF_LOCAL, #endif -/* #if defined(AF_INET) AF_INET, #endif #if defined(AF_INET6) AF_INET6, #endif -*/ -/* #if defined(AF_IPX) AF_IPX, #endif @@ -69,10 +67,11 @@ #if defined(AF_ATMPVC) AF_ATMPVC, #endif -*/ +/* #if defined(AF_APPLETALK) AF_APPLETALK, #endif +*/ #if defined(AF_PACKET) AF_PACKET, #endif @@ -121,9 +120,10 @@ while (keep_stressing()) { shim_usleep_interruptible(mwc32() % max_delay_us); - (void)close(fd); - shim_usleep_interruptible(mwc32() % max_delay_us); - (void)close(dupfd); + if (fd != -1) + (void)close(fd); + if (dupfd != -1) + (void)close(dupfd); } return &nowt; @@ -142,7 +142,17 @@ size_t i; const uid_t uid = getuid(); const gid_t gid = getgid(); + const bool not_root = !stress_check_capability(0); double max_duration = 0.0; +#if defined(HAVE_LIB_RT) + char shm_name[SHM_NAME_LEN]; +#endif + +#if defined(HAVE_LIB_RT) + (void)snprintf(shm_name, SHM_NAME_LEN, + "stress-ng-%d-%" PRIx32, (int)getpid(), mwc32()); +#endif + (void)sigfillset(&set); fd = -1; @@ -172,7 +182,7 @@ t1 = time_now(); - switch (mwc8() % 10) { + switch (mwc8() % 13) { case 0: domain = mwc8() % SIZEOF_ARRAY(domains); type = mwc8() % SIZEOF_ARRAY(types); @@ -237,6 +247,24 @@ fd = shim_userfaultfd(0); break; #endif +#if defined(O_PATH) + case 10: + fd = open("/tmp", O_PATH | O_RDWR); + break; +#endif +#if defined(O_DIRECTORY) && \ + defined(O_CLOEXEC) + case 11: + fd = open("/tmp/", O_RDONLY | O_DIRECTORY | O_CLOEXEC); + break; +#endif +#if defined(HAVE_LIB_RT) + case 12: + fd = shm_open(shm_name, O_CREAT | O_RDWR | O_TRUNC, + S_IRUSR | S_IWUSR); + (void)shm_unlink(shm_name); + break; +#endif default: break; } @@ -245,12 +273,14 @@ if (fd != -1) { dupfd = dup(fd); + if (not_root) { #if defined(HAVE_FCHOWNAT) - ret = fchownat(fd, "", uid, gid, 0); - (void)ret; + ret = fchownat(fd, "", uid, gid, 0); + (void)ret; #endif - ret = fchown(fd, uid, gid); - (void)ret; + ret = fchown(fd, uid, gid); + (void)ret; + } #if defined(HAVE_FACCESSAT) ret = faccessat(fd, "", F_OK, 0); (void)ret; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.10.12/stress-dev.c new/stress-ng-0.10.13/stress-dev.c --- old/stress-ng-0.10.12/stress-dev.c 2019-11-27 20:41:37.000000000 +0100 +++ new/stress-ng-0.10.13/stress-dev.c 2019-12-09 13:42:13.000000000 +0100 @@ -375,7 +375,34 @@ (void)ret; } #endif +#if defined(TIOCMGET) + { + int status; + ret = ioctl(fd, TIOCMGET, &status); + (void)ret; + } +#endif +#if defined(TIOCGICOUNT) && \ + defined(HAVE_LINUX_SERIAL_H) && \ + defined(HAVE_SERIAL_ICOUNTER) + { + struct serial_icounter_struct counter; + + ret = ioctl(fd, TIOCGICOUNT, &counter); + (void)ret; + } +#endif +#if defined(TIOCGSERIAL) && \ + defined(HAVE_LINUX_SERIAL_H) && \ + defined(HAVE_SERIAL_STRUCT) + { + struct serial_struct serial; + + ret = ioctl(fd, TIOCGSERIAL, &serial); + (void)ret; + } +#endif } #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.10.12/stress-ng.1 new/stress-ng-0.10.13/stress-ng.1 --- old/stress-ng-0.10.12/stress-ng.1 2019-11-27 20:41:37.000000000 +0100 +++ new/stress-ng-0.10.13/stress-ng.1 2019-12-09 13:42:13.000000000 +0100 @@ -3110,10 +3110,11 @@ .B \-\-sock\-ops N stop socket stress workers after N bogo operations. .TP -.B \-\-sock\-opts [ send | sendmsg | sendmmsg ] +.B \-\-sock\-opts [ random | send | sendmsg | sendmmsg ] by default, messages are sent using send(2). This option allows one to specify -the sending method using send(2), sendmsg(2) or sendmmsg(2). Note that -sendmmsg is only available for Linux systems that support this system call. +the sending method using send(2), sendmsg(2), sendmmsg(2) or a random selection +of one of thse 3 on each iteration. Note that sendmmsg is only available for +Linux systems that support this system call. .TP .B \-\-sock\-type [ stream | seqpacket ] specify the socket type to use. The default type is stream. seqpacket currently diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.10.12/stress-ng.c new/stress-ng-0.10.13/stress-ng.c --- old/stress-ng-0.10.12/stress-ng.c 2019-11-27 20:41:37.000000000 +0100 +++ new/stress-ng-0.10.13/stress-ng.c 2019-12-09 13:42:13.000000000 +0100 @@ -99,6 +99,9 @@ #if defined(SIGINT) SIGINT, #endif +#if defined(SIGILL) + SIGILL, +#endif #if defined(SIGQUIT) SIGQUIT, #endif @@ -1489,7 +1492,7 @@ g_keep_stressing_flag = false; kill_procs(SIGALRM); - switch(signum) { + switch (signum) { case SIGILL: case SIGSEGV: case SIGFPE: @@ -2678,7 +2681,7 @@ #endif } -int main(int argc, char **argv) +int main(int argc, char **argv, char **envp) { double duration = 0.0; /* stressor run time in secs */ size_t len; @@ -2698,6 +2701,8 @@ const uint32_t cpus_configured = stress_get_processors_configured(); int ret; + stress_set_proc_name_init(argc, argv, envp); + if (setjmp(g_error_env) == 1) exit(EXIT_FAILURE); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.10.12/stress-ng.h new/stress-ng-0.10.13/stress-ng.h --- old/stress-ng-0.10.12/stress-ng.h 2019-11-27 20:41:37.000000000 +0100 +++ new/stress-ng-0.10.13/stress-ng.h 2019-12-09 13:42:13.000000000 +0100 @@ -227,6 +227,10 @@ #include <bsd/sys/tree.h> #endif +#if defined(HAVE_BSD_UNISTD_H) +#include <bsd/unistd.h> +#endif + #if defined(HAVE_BSD_WCHAR) #include <bsd/wchar.h> #endif @@ -512,6 +516,10 @@ #include <linux/seccomp.h> #endif +#if defined(HAVE_LINUX_SERIAL_H) +#include <linux/serial.h> +#endif + #if defined(HAVE_LINUX_SOCK_DIAG_H) #include <linux/sock_diag.h> #endif @@ -3280,6 +3288,7 @@ const int sched_priority, const bool quiet); extern const char *stress_get_sched_name(const int sched); extern void set_iopriority(const int32_t class, const int32_t level); +extern void stress_set_proc_name_init(int argc, char *argv[], char *envp[]); extern void stress_set_proc_name(const char *name); /* Memory locking */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.10.12/stress-rdrand.c new/stress-ng-0.10.13/stress-rdrand.c --- old/stress-ng-0.10.12/stress-rdrand.c 2019-11-27 20:41:37.000000000 +0100 +++ new/stress-ng-0.10.13/stress-rdrand.c 2019-12-09 13:42:13.000000000 +0100 @@ -118,7 +118,7 @@ return 0; } pr_inf("rdrand stressor will be skipped, CPU " - "does not support the instuction 'darn'n"); + "does not support the instuction 'darn'\n"); return -1; #else pr_inf("rdrand stressor will be skipped, cannot" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.10.12/stress-schedpolicy.c new/stress-ng-0.10.13/stress-schedpolicy.c --- old/stress-ng-0.10.12/stress-schedpolicy.c 2019-11-27 20:41:37.000000000 +0100 +++ new/stress-ng-0.10.13/stress-schedpolicy.c 2019-12-09 13:42:13.000000000 +0100 @@ -162,7 +162,9 @@ * scheduling policies, silently ignore these * failures. */ - if ((errno != EPERM) && (errno != EINVAL)) { + if ((errno != EPERM) && + (errno != EINVAL) && + (errno != EBUSY)) { pr_fail("%s: sched_setscheduler " "failed: errno=%d (%s) " "for scheduler policy %s\n", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.10.12/stress-sock.c new/stress-ng-0.10.13/stress-sock.c --- old/stress-ng-0.10.12/stress-sock.c 2019-11-27 20:41:37.000000000 +0100 +++ new/stress-ng-0.10.13/stress-sock.c 2019-12-09 13:42:13.000000000 +0100 @@ -24,9 +24,10 @@ */ #include "stress-ng.h" -#define SOCKET_OPT_SEND 0x01 -#define SOCKET_OPT_SENDMSG 0x02 -#define SOCKET_OPT_SENDMMSG 0x03 +#define SOCKET_OPT_SEND 0x00 +#define SOCKET_OPT_SENDMSG 0x01 +#define SOCKET_OPT_SENDMMSG 0x02 +#define SOCKET_OPT_RANDOM 0x03 #define MSGVEC_SIZE (4) @@ -58,6 +59,7 @@ static int stress_set_socket_opts(const char *opt) { static const socket_opts_t socket_opts[] = { + { "random", SOCKET_OPT_RANDOM }, { "send", SOCKET_OPT_SEND }, { "sendmsg", SOCKET_OPT_SENDMSG }, #if defined(HAVE_SENDMMSG) @@ -156,6 +158,7 @@ static void stress_sock_client( const args_t *args, const pid_t ppid, + const int socket_opts, const int socket_type, const int socket_port, const int socket_domain) @@ -201,8 +204,44 @@ goto retry; } +#if defined(IP_MTU) + { + int mtu; + socklen_t optlen; + + (void)getsockopt(fd, IPPROTO_IP, IP_MTU, + &mtu, &optlen); + } +#endif +#if defined(IP_TOS) && defined(IPTOS_THROUGHPUT) + { + char tos = IPTOS_THROUGHPUT; + + (void)setsockopt(fd, IPPROTO_IP, IP_TOS, + &tos, sizeof(tos)); + } +#endif +#if defined(SO_INCOMING_CPU) + { + int cpu; + socklen_t optlen; + + (void)getsockopt(fd, SOL_SOCKET, SO_INCOMING_CPU, + &cpu, &optlen); + } +#endif + do { - ssize_t n; + ssize_t n = 0; + int opt; + size_t i, j; + char *recvfunc; + struct msghdr msg; + struct iovec vec[sizeof(buf)/16]; +#if defined(HAVE_RECVMMSG) + unsigned int msg_len = 0; + struct mmsghdr msgvec[MSGVEC_SIZE]; +#endif #if defined(FIONREAD) size_t bytes = sizeof(buf); /* @@ -231,16 +270,56 @@ (void)ioctl(fd, SIOCINQ, &pending); } #endif - n = recv(fd, buf, sizeof(buf), 0); + if (socket_opts == SOCKET_OPT_RANDOM) + opt = mwc8() % 3; + else + opt = socket_opts; + + /* + * Receive using equivalent receive method + * as the send + */ + switch (opt) { + case SOCKET_OPT_SEND: + recvfunc = "recv"; + n = recv(fd, buf, sizeof(buf), 0); + break; + case SOCKET_OPT_SENDMSG: + recvfunc = "recvmsg"; + for (j = 0, i = 16; i < sizeof(buf); i += 16, j++) { + vec[j].iov_base = buf; + vec[j].iov_len = i; + } + (void)memset(&msg, 0, sizeof(msg)); + msg.msg_iov = vec; + msg.msg_iovlen = j; + n = recvmsg(fd, &msg, 0); + break; +#if defined(HAVE_RECVMMSG) + case SOCKET_OPT_SENDMMSG: + recvfunc = "recvmmsg"; + (void)memset(msgvec, 0, sizeof(msgvec)); + for (j = 0, i = 16; i < sizeof(buf); i += 16, j++) { + vec[j].iov_base = buf; + vec[j].iov_len = i; + msg_len += i; + } + for (i = 0; i < MSGVEC_SIZE; i++) { + msgvec[i].msg_hdr.msg_iov = vec; + msgvec[i].msg_hdr.msg_iovlen = j; + } + n = recvmmsg(fd, msgvec, MSGVEC_SIZE, 0, NULL); + break; +#endif + } if (n == 0) break; if (n < 0) { if ((errno != EINTR) && (errno != ECONNRESET)) - pr_fail_dbg("recv"); + pr_fail_dbg(recvfunc); break; } } while (keep_stressing()); - #if defined(AF_INET) && \ defined(IPPROTO_IP) && \ defined(IP_MTU) @@ -350,6 +429,7 @@ struct sockaddr saddr; socklen_t len; int sndbuf; + int opt; struct msghdr msg; struct iovec vec[sizeof(buf)/16]; #if defined(HAVE_SENDMMSG) @@ -393,7 +473,13 @@ } #endif (void)memset(buf, 'A' + (get_counter(args) % 26), sizeof(buf)); - switch (socket_opts) { + + if (socket_opts == SOCKET_OPT_RANDOM) + opt = mwc8() % 3; + else + opt = socket_opts; + + switch (opt) { case SOCKET_OPT_SEND: for (i = 16; i < sizeof(buf); i += 16) { ssize_t ret = send(sfd, buf, i, 0); @@ -517,8 +603,8 @@ pr_fail_dbg("fork"); return EXIT_FAILURE; } else if (pid == 0) { - stress_sock_client(args, ppid, socket_type, - socket_port, socket_domain); + stress_sock_client(args, ppid, socket_opts, + socket_type, socket_port, socket_domain); _exit(EXIT_SUCCESS); } else { return stress_sock_server(args, pid, ppid, socket_opts, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.10.12/test/test-recvmmsg.c new/stress-ng-0.10.13/test/test-recvmmsg.c --- old/stress-ng-0.10.12/test/test-recvmmsg.c 1970-01-01 01:00:00.000000000 +0100 +++ new/stress-ng-0.10.13/test/test-recvmmsg.c 2019-12-09 13:42:13.000000000 +0100 @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2013-2019 Canonical, Ltd. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * This code is a complete clean re-write of the stress tool by + * Colin Ian King <colin.k...@canonical.com> and attempts to be + * backwardly compatible with the stress tool by Amos Waterland + * <a...@rossby.metr.ou.edu> but has more stress tests and more + * functionality. + * + */ + +#define _GNU_SOURCE + +#include <unistd.h> +#include <netinet/ip.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include <sys/socket.h> + +int main(void) +{ + int sockfd, ret; + struct sockaddr_in addr; + struct mmsghdr msg_hdr[2]; + struct iovec msg_iov1[2], msg_iov2[3]; + struct timespec timeout; + + (void)memset(&addr, 0, sizeof(addr)); + (void)memset(&msg_iov1, 0, sizeof(msg_iov1)); + (void)memset(&msg_iov2, 0, sizeof(msg_iov2)); + (void)memset(&msg_hdr, 0, sizeof(msg_hdr)); + + sockfd = socket(AF_INET, SOCK_DGRAM, 0); + if (sockfd < 0) + return 1; + + addr.sin_family = AF_INET; + addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + addr.sin_port = htons(9999); + if (bind(sockfd, (struct sockaddr *) &addr, sizeof(addr)) == -1) { + (void)close(sockfd); + return 1; + } + + timeout.tv_sec = 0; + timeout.tv_nsec = 0; + + msg_iov1[0].iov_base = "1"; + msg_iov1[0].iov_len = 1; + msg_iov1[1].iov_base = "2"; + msg_iov1[1].iov_len = 1; + + msg_iov2[0].iov_base = "3"; + msg_iov2[0].iov_len = 1; + msg_iov2[0].iov_base = "4"; + msg_iov2[0].iov_len = 1; + msg_iov2[0].iov_base = "5"; + msg_iov2[0].iov_len = 1; + + msg_hdr[0].msg_hdr.msg_iov = msg_iov1; + msg_hdr[0].msg_hdr.msg_iovlen = 2; + msg_hdr[1].msg_hdr.msg_iov = msg_iov2; + msg_hdr[1].msg_hdr.msg_iovlen = 3; + + ret = recvmmsg(sockfd, msg_hdr, 2, 0, &timeout); + (void)close(sockfd); + + return ret; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.10.12/test/test-serial-icounter.c new/stress-ng-0.10.13/test/test-serial-icounter.c --- old/stress-ng-0.10.12/test/test-serial-icounter.c 1970-01-01 01:00:00.000000000 +0100 +++ new/stress-ng-0.10.13/test/test-serial-icounter.c 2019-12-09 13:42:13.000000000 +0100 @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2013-2019 Canonical, Ltd. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * This code is a complete clean re-write of the stress tool by + * Colin Ian King <colin.k...@canonical.com> and attempts to be + * backwardly compatible with the stress tool by Amos Waterland + * <a...@rossby.metr.ou.edu> but has more stress tests and more + * functionality. + * + */ +#define _GNU_SOURCE + +#include <linux/serial.h> + +int main(void) +{ + struct serial_icounter_struct counter = { }; + + (void)counter; + + return 0; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.10.12/test/test-serial-struct.c new/stress-ng-0.10.13/test/test-serial-struct.c --- old/stress-ng-0.10.12/test/test-serial-struct.c 1970-01-01 01:00:00.000000000 +0100 +++ new/stress-ng-0.10.13/test/test-serial-struct.c 2019-12-09 13:42:13.000000000 +0100 @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2013-2019 Canonical, Ltd. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * This code is a complete clean re-write of the stress tool by + * Colin Ian King <colin.k...@canonical.com> and attempts to be + * backwardly compatible with the stress tool by Amos Waterland + * <a...@rossby.metr.ou.edu> but has more stress tests and more + * functionality. + * + */ +#define _GNU_SOURCE + +#include <linux/serial.h> + +int main(void) +{ + struct serial_struct serial; + + (void)serial; + + return 0; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.10.12/test/test-setproctitle.c new/stress-ng-0.10.13/test/test-setproctitle.c --- old/stress-ng-0.10.12/test/test-setproctitle.c 1970-01-01 01:00:00.000000000 +0100 +++ new/stress-ng-0.10.13/test/test-setproctitle.c 2019-12-09 13:42:13.000000000 +0100 @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2013-2019 Canonical, Ltd. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * This code is a complete clean re-write of the stress tool by + * Colin Ian King <colin.k...@canonical.com> and attempts to be + * backwardly compatible with the stress tool by Amos Waterland + * <a...@rossby.metr.ou.edu> but has more stress tests and more + * functionality. + * + */ +#define _GNU_SOURCE + +#include <unistd.h> + +#if !(defined(__APPLE__) || \ + defined(__DragonFly__) || \ + defined(__FreeBSD__) || \ + defined(__NetBSD__) || \ + defined(__OpenBSD__)) +#include <bsd/unistd.h> +#endif + +int main(int argc, char *argv[], char *envp[]) +{ + setproctitle_init(argc, argv, envp); + setproctitle("-%s", "this is a test"); + return 0; +}