"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "stress-dccp.c" between
stress-ng-0.12.09.tar.xz and stress-ng-0.12.10.tar.xz

About: stress-ng will stress test a computer system in various selectable ways. It was designed to exercise various physical subsystems of a computer as well as the various operating system kernel interfaces.

stress-dccp.c  (stress-ng-0.12.09.tar.xz):stress-dccp.c  (stress-ng-0.12.10.tar.xz)
skipping to change at line 225 skipping to change at line 225
const int dccp_domain, const int dccp_domain,
const int dccp_opts) const int dccp_opts)
{ {
char buf[DCCP_BUF]; char buf[DCCP_BUF];
int fd, status; int fd, status;
int so_reuseaddr = 1; int so_reuseaddr = 1;
socklen_t addr_len = 0; socklen_t addr_len = 0;
struct sockaddr *addr = NULL; struct sockaddr *addr = NULL;
uint64_t msgs = 0; uint64_t msgs = 0;
int rc = EXIT_SUCCESS; int rc = EXIT_SUCCESS;
double t1 = 0.0, t2 = 0.0, dt;
(void)setpgid(pid, g_pgrp); (void)setpgid(pid, g_pgrp);
if (stress_sig_stop_stressing(args->name, SIGALRM) < 0) { if (stress_sig_stop_stressing(args->name, SIGALRM) < 0) {
rc = EXIT_FAILURE; rc = EXIT_FAILURE;
goto die; goto die;
} }
if ((fd = socket(dccp_domain, SOCK_DCCP, IPPROTO_DCCP)) < 0) { if ((fd = socket(dccp_domain, SOCK_DCCP, IPPROTO_DCCP)) < 0) {
if (errno == ESOCKTNOSUPPORT) { if (errno == ESOCKTNOSUPPORT) {
/* /*
skipping to change at line 272 skipping to change at line 273
args->name, errno, strerror(errno)); args->name, errno, strerror(errno));
goto die_close; goto die_close;
} }
if (listen(fd, 10) < 0) { if (listen(fd, 10) < 0) {
pr_fail("%s: listen failed, errno=%d (%s)\n", pr_fail("%s: listen failed, errno=%d (%s)\n",
args->name, errno, strerror(errno)); args->name, errno, strerror(errno));
rc = EXIT_FAILURE; rc = EXIT_FAILURE;
goto die_close; goto die_close;
} }
t1 = stress_time_now();
do { do {
int sfd; int sfd;
if (!keep_stressing(args)) if (!keep_stressing(args))
break; break;
sfd = accept(fd, (struct sockaddr *)NULL, NULL); sfd = accept(fd, (struct sockaddr *)NULL, NULL);
if (sfd >= 0) { if (sfd >= 0) {
size_t i, j; size_t i, j;
struct sockaddr saddr; struct sockaddr saddr;
skipping to change at line 383 skipping to change at line 385
} }
#endif #endif
(void)close(sfd); (void)close(sfd);
} }
inc_counter(args); inc_counter(args);
} while (keep_stressing(args)); } while (keep_stressing(args));
die_close: die_close:
(void)close(fd); (void)close(fd);
die: die:
t2 = stress_time_now();
#if defined(AF_UNIX) && \ #if defined(AF_UNIX) && \
defined(HAVE_SOCKADDR_UN) defined(HAVE_SOCKADDR_UN)
if (addr && (dccp_domain == AF_UNIX)) { if (addr && (dccp_domain == AF_UNIX)) {
struct sockaddr_un *addr_un = (struct sockaddr_un *)addr; struct sockaddr_un *addr_un = (struct sockaddr_un *)addr;
(void)unlink(addr_un->sun_path); (void)unlink(addr_un->sun_path);
} }
#endif #endif
if (pid) { if (pid) {
(void)kill(pid, SIGKILL); (void)kill(pid, SIGKILL);
(void)shim_waitpid(pid, &status, 0); (void)shim_waitpid(pid, &status, 0);
} }
pr_dbg("%s: %" PRIu64 " messages sent\n", args->name, msgs); pr_dbg("%s: %" PRIu64 " messages sent\n", args->name, msgs);
dt = t2 - t1;
if (dt > 0.0)
stress_misc_stats_set(args->misc_stats, 0, "messages per sec", (d
ouble)msgs / dt);
return rc; return rc;
} }
/* /*
* stress_dccp * stress_dccp
* stress by heavy dccp I/O * stress by heavy dccp I/O
*/ */
static int stress_dccp(const stress_args_t *args) static int stress_dccp(const stress_args_t *args)
{ {
pid_t pid, ppid = getppid(); pid_t pid, ppid = getppid();
 End of changes. 5 change blocks. 
0 lines changed or deleted 9 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)