Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Feb 2015 13:56:39 +0000 (UTC)
From:      Peter Holm <pho@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r278208 - user/pho/stress2/misc
Message-ID:  <201502041356.t14DudB4051690@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pho
Date: Wed Feb  4 13:56:38 2015
New Revision: 278208
URL: https://svnweb.freebsd.org/changeset/base/278208

Log:
  Sort include files, fix trailing whitespace and add missing zero of
  inetaddr.
  
  Sponsored by:	 EMC / Isilon storage division

Modified:
  user/pho/stress2/misc/sendfile3.sh

Modified: user/pho/stress2/misc/sendfile3.sh
==============================================================================
--- user/pho/stress2/misc/sendfile3.sh	Wed Feb  4 13:50:50 2015	(r278207)
+++ user/pho/stress2/misc/sendfile3.sh	Wed Feb  4 13:56:38 2015	(r278208)
@@ -31,8 +31,7 @@
 # Test scenario for sendfile deadlock (processes stuck in sfbufa)
 
 # Variation of sendfile.sh
-
-. ../default.cfg
+# kern.ipc.nsfbufs should be low for this test
 
 odir=`pwd`
 
@@ -47,7 +46,6 @@ in=/tmp/inputFile
 out=/tmp/outputFile
 parallel=20
 
-[ `sysctl kern.ipc.nsfbufs | awk '{print $NF}'` -gt 512 ] && echo "kern.ipc.nsfbufs should be low for this test"
 for i in 50m 100m; do
 	rm -f $in
 	dd if=/dev/random of=$in bs=$i count=1 2>&1 | \
@@ -66,18 +64,20 @@ done
 rm -f $in /tmp/sendfile3
 exit
 EOF
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+
+#include <netinet/in.h>
+
 #include <err.h>
 #include <fcntl.h>
 #include <netdb.h>
-#include <netinet/in.h>
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
 #include <unistd.h>
 
 int port;
@@ -149,7 +149,7 @@ writer(void) {
 	off_t off = 0;
 
 	on = 1;
-	for (i = 1; i < 5; i++) {
+	for (i = 0; i < 5; i++) {
 		if ((tcpsock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
 			err(1, "socket(), %s:%d", __FILE__, __LINE__);
 
@@ -157,6 +157,7 @@ writer(void) {
 		    SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)) < 0)
 			err(1, "setsockopt(), %s:%d", __FILE__, __LINE__);
 
+		bzero((char *) &inetaddr, sizeof(inetaddr));
 		hostent = gethostbyname ("localhost");
 		memcpy (&inetaddr.sin_addr.s_addr, hostent->h_addr,
 			sizeof (struct in_addr));
@@ -184,8 +185,6 @@ writer(void) {
 
 	if (sendfile(fd, tcpsock, 0, statb.st_size, NULL, &off, 0) == -1)
 		err(1, "sendfile");
-
-	return;
 }
 
 int
@@ -209,7 +208,7 @@ main(int argc, char **argv)
 		reader();
 		kill(pid, SIGINT);
 		waitpid(pid, NULL, 0);
-	} else 
+	} else
 		err(1, "fork(), %s:%d",  __FILE__, __LINE__);
 
 	return (0);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502041356.t14DudB4051690>