From owner-svn-src-stable@FreeBSD.ORG Tue Oct 12 21:40:43 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB85A106566B; Tue, 12 Oct 2010 21:40:43 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D6A088FC14; Tue, 12 Oct 2010 21:40:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9CLehOj062877; Tue, 12 Oct 2010 21:40:43 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9CLehrL062868; Tue, 12 Oct 2010 21:40:43 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201010122140.o9CLehrL062868@svn.freebsd.org> From: "George V. Neville-Neil" Date: Tue, 12 Oct 2010 21:40:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213750 - in stable/7/tools/tools: mcgrab mctest nanobsd netrate/http netrate/httpd netrate/juggle X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Oct 2010 21:40:44 -0000 Author: gnn Date: Tue Oct 12 21:40:43 2010 New Revision: 213750 URL: http://svn.freebsd.org/changeset/base/213750 Log: MFC 177387,177388,177872,178456,179528,180394,186456,203800,204310,213327: r177387 A multicast test. The mctest program acts as both a source and a sink for multicast packets. Parameters for the interface, packet size, number of packets, and interpacket gap may be given on the command line. The sink records how many packets were missed, and at what time each packet arrived. r177388 Add the correct license. r177872 Add a manual page and a Makefile. Add code to reflect packets back from the sink so that we can measure round trip at the source. r178456 Updated the test to handle multiple sinks. The sinks cut their transmissions by the number of them running so that they do not overwhelm the source. Added a simple shell script to kick off sinks on multiple hosts as well as a source on the host where the shell script is run. The script also collects the output of all the sinks and the source into files named for the host on which the tests are run. A date is appended to each output file to make it unique per run. r179528 Update mctest and its associated script to have a base port to listen on so that multiple copies can be run easily. Update documentation with group and port arguments which are optional. r180394 Add a new program to the multicast test suite. The mcgrab program is used to grab and hold some number of multicast addresses in order to test what happens when an interface goes over the number of multicast addresses it can filter in hardware. r186456 Fix a bug in the man page where we were not showing the correct flags in the explanation. Several of the flags were -i, since it was a copy/paste operation. r203800 Fixed error checking of pthread(3) functions. r204310 Moved mcgrab(1) into a separate directory -- our .mk infrastructure doesn't currently have support for building multiple programs in a single makefile. While here, fixed manpages and makefiles (missing dependencies). r213327 Change the output of mctest to give a summary of the results instead of printing a long list. Add a default base port, and default mulitcast address to the runner script. Add support for specifying a different local and remote interface in the runner script. Added: stable/7/tools/tools/mcgrab/ - copied from r204310, head/tools/tools/mcgrab/ stable/7/tools/tools/mctest/ - copied from r177387, head/tools/tools/mctest/ stable/7/tools/tools/mctest/Makefile - copied, changed from r177872, head/tools/tools/mctest/Makefile stable/7/tools/tools/mctest/mctest.1 - copied, changed from r177872, head/tools/tools/mctest/mctest.1 stable/7/tools/tools/mctest/mctest_run.sh - copied, changed from r178456, head/tools/tools/mctest/mctest_run.sh Modified: stable/7/tools/tools/mctest/mctest.cc stable/7/tools/tools/mctest/mctest.h stable/7/tools/tools/netrate/http/http.c stable/7/tools/tools/netrate/httpd/httpd.c stable/7/tools/tools/netrate/juggle/juggle.c Directory Properties: stable/7/tools/tools/ (props changed) stable/7/tools/tools/aac/ (props changed) stable/7/tools/tools/crypto/ (props changed) stable/7/tools/tools/editing/ (props changed) stable/7/tools/tools/nanobsd/ (props changed) stable/7/tools/tools/nanobsd/FlashDevice.sub (props changed) stable/7/tools/tools/nanobsd/nanobsd.sh (props changed) stable/7/tools/tools/umastat/ (props changed) stable/7/tools/tools/usb/ (props changed) Copied and modified: stable/7/tools/tools/mctest/Makefile (from r177872, head/tools/tools/mctest/Makefile) ============================================================================== --- head/tools/tools/mctest/Makefile Thu Apr 3 05:26:54 2008 (r177872, copy source) +++ stable/7/tools/tools/mctest/Makefile Tue Oct 12 21:40:43 2010 (r213750) @@ -1,9 +1,7 @@ -# # $FreeBSD$ -# -# A Makefile that builds both the mctest program and its manual page. -PROG_CXX= mctest -LDADD+= -lpthread +PROG_CXX= mctest +DPADD= ${LIBPTHREAD} +LDADD= -lpthread .include Copied and modified: stable/7/tools/tools/mctest/mctest.1 (from r177872, head/tools/tools/mctest/mctest.1) ============================================================================== --- head/tools/tools/mctest/mctest.1 Thu Apr 3 05:26:54 2008 (r177872, copy source) +++ stable/7/tools/tools/mctest/mctest.1 Tue Oct 12 21:40:43 2010 (r213750) @@ -25,7 +25,7 @@ .\" $FreeBSD$ .\" .Dd April 3, 2008 -.Dt mctest 1 +.Dt MCTEST 1 .Os .Sh NAME .Nm mctest @@ -33,38 +33,57 @@ .Sh SYNOPSIS .Nm .Op Fl i Ar interface +.Op Fl g Ar group +.Op Fl b Ar base port .Op Fl n Ar number .Op Fl s Ar size .Op Fl t Ar inter-packet gap +.Op Fl M Ar number of clients (source only) +.Op Fl m Ar my client number (sink only) .Op Fl r .Sh DESCRIPTION -The +The .Nm -command implements a multicast test which involved a source -and a sink. The source sends packets to a pre-configured -multicast address over the interface given as a command line -argument. The sink listens for multicast packets, records -the time at which they're received and then reflects them back -over unicast to the source. When the source has captured all +command implements a multicast test which involves a source +and a sink. +The source sends packets to a pre-configured +multicast address over the interface given as a command line +argument. +The sink listens for multicast packets, records +the time at which they are received and then reflects them back +over unicast to the source. +When the source has captured all the reflected packets it prints out the round trip time of each. .Pp +The source prints out the round trip time of packets sent to the +sinks. The sink prints out the time between the packets received. .Pp The options are as follows: -.Bl -tag -width ".Fl d Ar argument" +.Bl -tag -width ".Fl i Ar interface" .It Fl i Ar interface -Network interface, which can be found with ifconfig(1). +Network interface, which can be found with +.Xr ifconfig 8 . +.It Fl g Ar group +Multicast group. +.It Fl b Ar base port +Port on which to listen. .It Fl s Ar size Packet size in bytes. .It Fl n Ar number Number of packets. .It Fl t Ar gap Inter-packet gap in nanoseconds. +.It Fl M Ar clients +The number of clients that are listening. +.It Fl m Ar my number +The client's number 0, 1, etc. .It Fl r This version of .Nm -is the receiver aka the sink. This option MUST -only be used with one copy of the program at a time. +is the receiver aka the sink. +This option MUST +only be used with one copy of the program at a time. .El .Sh EXAMPLES The following is an example of a typical usage @@ -73,20 +92,21 @@ of the command: .Pp Source -.Dl "mctest -i em0 -s 1024 -n 100 -t 1" +.Dl "mctest -i em0 -M 1 -s 1024 -n 100 -t 1" Sink -.Dl "mctest -i em0 -s 1024 -n 100 -r" +.Dl "mctest -i em0 -m 0 -s 1024 -n 100 -r" .Pp Send 100 packets of 1024 bytes, with an inter-packet gap of 1 nanosecond. .Pp -Gaps are measured with +Gaps are measured with .Xr nanosleep 2 , and so are not accurate down to nanoseconds -but depend on the setting of kern.hz. +but depend on the setting of +.Va kern.hz . .Sh SEE ALSO -.Xr ifconfig 8 , .Xr netstat 1 , -.Xr nanosleep 2 . +.Xr nanosleep 2 , +.Xr ifconfig 8 .Sh HISTORY The .Nm @@ -97,4 +117,5 @@ This manual page was written by .An George V. Neville-Neil Aq gnn@FreeBSD.org . .Sh BUGS -Should be reported to the author or to net@freebsd.org. +Should be reported to the author or to +.Aq net@FreeBSD.org . Modified: stable/7/tools/tools/mctest/mctest.cc ============================================================================== --- head/tools/tools/mctest/mctest.cc Wed Mar 19 12:44:23 2008 (r177387) +++ stable/7/tools/tools/mctest/mctest.cc Tue Oct 12 21:40:43 2010 (r213750) @@ -1,7 +1,28 @@ // +// Copyright 2008, George V. Neville-Neil // All rights reserved. // -// Author: George V. Neville-Neil +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +// SUCH DAMAGE. // // This is a relatively simple multicast test which can act as a // source and sink. The purpose of this test is to determine the @@ -17,6 +38,8 @@ __FBSDID("$FreeBSD$"); // C++ STL and other related includes #include #include +#include +#include // Operating System and other C based includes #include @@ -40,7 +63,7 @@ using namespace std; // void usage() { - cout << "mctest -i interface -g multicast group -s packet size -n number -t inter-packet gap\n"; + cout << "mctest [-r] -M clients -m client number -i interface -g multicast group -s packet size -n number -t inter-packet gap\n"; exit(-1); } @@ -65,13 +88,16 @@ void usage(string message) // @param group ///< multicast group // @param pkt_size ///< packet Size // @param number ///< number of packets we're expecting +// @param clients ///< total number of clients (N) +// @param client ///< our client number (0..N) // // @return 0 for 0K, -1 for error, sets errno // -int sink(char *interface, struct in_addr *group, int pkt_size, int number) { +int sink(char *interface, struct in_addr *group, int pkt_size, int number, + int clients, int client, short base_port) { - int sock; + int sock, backchan; socklen_t recvd_len; struct sockaddr_in local, recvd; struct ip_mreq mreq; @@ -90,6 +116,11 @@ int sink(char *interface, struct in_addr return (-1); } + if ((backchan = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { + perror("failed to open back channel socket"); + return (-1); + } + strncpy(ifreq.ifr_name, interface, IFNAMSIZ); if (ioctl(sock, SIOCGIFADDR, &ifreq) < 0) { perror("no such interface"); @@ -138,6 +169,7 @@ int sink(char *interface, struct in_addr perror("setsockopt failed"); while (n < number) { + recvd_len = sizeof(recvd); if (recvfrom(sock, packet, pkt_size, 0, (struct sockaddr *)&recvd, &recvd_len) < 0) { if (errno == EWOULDBLOCK) @@ -145,6 +177,19 @@ int sink(char *interface, struct in_addr perror("recvfrom failed"); return -1; } + /* + * Bandwidth limiting. If there are N clients then we want + * 1/N packets from each, otherwise the clients will overwhelm + * the sender. + */ + if (n % clients == client) { + recvd.sin_port = htons(base_port + client); + if (sendto(backchan, packet, pkt_size, 0, + (struct sockaddr *)&recvd, sizeof(recvd)) < 0) { + perror("sendto failed"); + return -1; + } + } gettimeofday(&packets[ntohl(*(int *)packet)], 0); n++; } @@ -173,6 +218,73 @@ int sink(char *interface, struct in_addr } // +// Structure to hold thread arguments +// +struct server_args { + struct timeval *packets; ///< The timestamps of returning packets + int number; ///< Number of packets to expect. + int pkt_size; ///< Size of the packets + int client; ///< Which client we listen for +}; + +// +// server receives packets sent back from the sink +// +// @param passed ///< Arguments passed from the caller +// +// 0return always NULL +void* server(void *passed) { + + int sock, n =0; + struct timeval timeout; + struct sockaddr_in addr; + server_args *args = (server_args *)passed; + + timerclear(&timeout); + timeout.tv_sec = TIMEOUT; + + if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { + perror("could not open server socket"); + return NULL; + } + + bzero(&addr, sizeof(addr)); + addr.sin_family = AF_INET; + addr.sin_addr.s_addr = INADDR_ANY; + addr.sin_port = htons(args->client); + addr.sin_len = sizeof(addr); + + if (bind(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) { + perror("could not bind server socket"); + return NULL; + } + + if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, &timeout, + sizeof(timeout)) < 0) + perror("setsockopt failed"); + + char packet[args->pkt_size]; + while (n < args->number) { + if (recvfrom(sock, &packet, args->pkt_size, 0, NULL, 0) < 0) { + if (errno == EWOULDBLOCK) + break; + perror("recvfrom failed"); + return NULL; + } + gettimeofday(&args->packets[ntohl(*(int *)packet)], 0); + n++; + } + + cout << "Packet Reflection Complete" << endl; + + if (n < args->number) + cout << "Missed " << args->number - n << " packets." << endl; + + return NULL; + +} + +// // transmit packets for the multicast test // // @param interface ///< text name of the interface (em0 etc.) @@ -180,11 +292,12 @@ int sink(char *interface, struct in_addr // @param pkt_size ///< packet size // @param number ///< number of packets // @param gap ///< inter packet gap in nano-seconds +// @param clients ///< number of clients we intend to run // // @return 0 for OK, -1 for error, sets errno // int source(char *interface, struct in_addr *group, int pkt_size, - int number, int gap) { + int number, int gap, int clients, short base_port) { int sock; struct sockaddr_in addr; @@ -247,6 +360,22 @@ int source(char *interface, struct in_ad *(int *)packets[i] = htonl(i); } + struct timeval sent[number]; + struct timeval received[clients][number]; + server_args args[clients]; + pthread_t thread[clients]; + + for (int i = 0;i < clients; i++) { + args[i].pkt_size = pkt_size; + args[i].packets = received[i]; + args[i].number = number / clients; + args[i].client = base_port + i; + if (pthread_create(&thread[i], NULL, server, &args[i]) != 0) { + perror("failed to create server thread"); + return -1; + } + } + struct timespec sleeptime; sleeptime.tv_sec = 0; sleeptime.tv_nsec = gap; @@ -257,12 +386,49 @@ int source(char *interface, struct in_ad perror("sendto failed"); return -1; } + gettimeofday(&sent[i], 0); if (gap > 0) if (nanosleep(&sleeptime, NULL) < 0) { perror("nanosleep failed"); return -1; } } + + for (int i = 0; i < clients; i++) { + if (pthread_join(thread[i], NULL) != 0) { + perror("failed to join thread"); + return -1; + } + } + + timeval result; + vector deltas; + double idx[] = { .0001, .001, .01, .1, .5, .9, .99, .999, .9999, 0.0 }; + + for (int client = 0;client < clients; client++) { + deltas.clear(); + cout << "Results from client #" << client << endl; + cout << "in usecs" << endl; + for (int i = 0; i < number; i++) { +// if (i % clients != client) +// continue; + if (&args[client].packets[i].tv_sec == 0) + continue; + timersub(&args[client].packets[i], &sent[i], &result); + deltas.push_back(result.tv_usec); +// cout << "sec: " << result.tv_sec; +// cout << " usecs: " << result.tv_usec << endl; + } + cout << "comparing %lu deltas" << long(deltas.size()) << endl; + cout << "number represents usecs of round-trip time" << endl; + sort(deltas.begin(), deltas.end()); + for (int i = 0; idx[i] != 0; ++i) { + printf("%s% 5d", (i == 0) ? "" : " ", + deltas[(int) (idx[i] * deltas.size())]); + } + printf("\n"); + } + return 0; } @@ -284,17 +450,20 @@ int main(int argc, char**argv) char ch; ///< character from getopt() extern char* optarg; ///< option argument - char* interface; ///< Name of the interface + char* interface = 0; ///< Name of the interface struct in_addr *group = NULL; ///< the multicast group address - int pkt_size; ///< packet size - int gap; ///< inter packet gap (in nanoseconds) - int number; ///< number of packets to transmit - bool server = false; + int pkt_size = 0; ///< packet size + int gap = 0; ///< inter packet gap (in nanoseconds) + int number = 0; ///< number of packets to transmit + bool server = false; ///< are we on he receiving end of multicast + int client = 0; ///< for receivers which client are we + int clients = 1; ///< for senders how many clients are there + short base_port = SERVER_PORT; ///< to have multiple copies running at once - if (argc < 2 || argc > 11) + if (argc < 2 || argc > 16) usage(); - while ((ch = getopt(argc, argv, "g:i:n:s:t:rh")) != -1) { + while ((ch = getopt(argc, argv, "M:m:g:i:n:s:t:b:rh")) != -1) { switch (ch) { case 'g': group = new (struct in_addr ); @@ -307,7 +476,7 @@ int main(int argc, char**argv) break; case 'n': number = atoi(optarg); - if (number < 0 || number > 10000) + if (number < 0 || number > INT_MAX) usage(argv[0] + string(" Error: ") + optarg + string(" number of packets out of range")); break; @@ -326,6 +495,15 @@ int main(int argc, char**argv) case 'r': server = true; break; + case 'm': + client = atoi(optarg); + break; + case 'M': + clients = atoi(optarg); + break; + case 'b': + base_port = atoi(optarg); + break; case 'h': usage(string("Help\n")); break; @@ -333,9 +511,15 @@ int main(int argc, char**argv) } if (server) { - sink(interface, group, pkt_size, number); + if (clients <= 0 || client < 0) + usage("must specify client (-m) and number of clients (-M)"); + sink(interface, group, pkt_size, number, clients, client, + base_port); } else { - source(interface, group, pkt_size, number, gap); + if (clients <= 0) + usage("must specify number of clients (-M)"); + source(interface, group, pkt_size, number, gap, clients, + base_port); } } Modified: stable/7/tools/tools/mctest/mctest.h ============================================================================== --- head/tools/tools/mctest/mctest.h Wed Mar 19 12:44:23 2008 (r177387) +++ stable/7/tools/tools/mctest/mctest.h Tue Oct 12 21:40:43 2010 (r213750) @@ -28,5 +28,6 @@ // const char* DEFAULT_GROUP = "239.255.255.1"; +const int SERVER_PORT = 9999; const int DEFAULT_PORT = 6666; const int TIMEOUT = 10; Copied and modified: stable/7/tools/tools/mctest/mctest_run.sh (from r178456, head/tools/tools/mctest/mctest_run.sh) ============================================================================== --- head/tools/tools/mctest/mctest_run.sh Thu Apr 24 06:56:45 2008 (r178456, copy source) +++ stable/7/tools/tools/mctest/mctest_run.sh Tue Oct 12 21:40:43 2010 (r213750) @@ -7,18 +7,19 @@ # Defaults size=1024 number=100 -group="" +base=9999 +group="239.255.255.101" interface="cxgb0" remote="ssh" -command="/sources/FreeBSD.CURRENT/src/tools/tools/mctest/mctest" +command="/zoo/tank/users/gnn/svn/Projects/head-exar/src/tools/tools/mctest/mctest" gap=1000 # Arguments are s (size), g (group), n (number), and c (command) followed # by a set of hostnames. -args=`getopt s:g:n:c:i: $*` +args=`getopt s:g:n:c:l:f:b: $*` if [ $? != 0 ] then - echo 'Usage: mctest_run -s size -g group -n number -c remote command host1 host2 hostN' + echo 'Usage: mctest_run -l local_interface -f foreign_interface -s size -g group -n number -c remote command host1 host2 hostN' exit 2 fi set == $args @@ -39,8 +40,14 @@ do -c) command=$3; shift 2;; - -i) - interface=$3; + -l) + local_interface=$3; + shift 2;; + -f) + foreign_interface=$3; + shift 2;; + -b) + base=$3; shift 2;; --) shift; break;; @@ -56,7 +63,7 @@ now=`date "+%Y%m%d%H%M"` for host in $* do output=$host\_$interface\_$size\_$number\.$now - $remote $host $command -r -M $# -m $current -n $number -s $size -i $interface > $output & + $remote $host $command -r -M $# -b $base -g $group -m $current -n $number -s $size -i $foreign_interface > $output & sleep 1 current=`expr $current + 1 `; done @@ -64,4 +71,4 @@ done # # Start the source/collector on this machine # -$command -M $# -n $number -s $size -i le1 -t $gap > `uname -n`\_$size\_$number\.$now +$command -M $# -b $base -g $group -n $number -s $size -i $local_interface -t $gap > `uname -n`\_$size\_$number\.$now Modified: stable/7/tools/tools/netrate/http/http.c ============================================================================== --- stable/7/tools/tools/netrate/http/http.c Tue Oct 12 21:01:26 2010 (r213749) +++ stable/7/tools/tools/netrate/http/http.c Tue Oct 12 21:40:43 2010 (r213750) @@ -300,15 +300,15 @@ main(int argc, char *argv[]) if (threaded) { if (pthread_barrier_init(&statep->start_barrier, NULL, - numthreads) < 0) - err(-1, "pthread_mutex_init"); + numthreads) != 0) + err(-1, "pthread_barrier_init"); } for (i = 0; i < numthreads; i++) { statep->hwd[i].hwd_count = 0; if (threaded) { if (pthread_create(&statep->hwd[i].hwd_thread, NULL, - http_worker, &statep->hwd[i]) < 0) + http_worker, &statep->hwd[i]) != 0) err(-1, "pthread_create"); } else { curthread = i; @@ -339,7 +339,7 @@ main(int argc, char *argv[]) for (i = 0; i < numthreads; i++) { if (threaded) { if (pthread_join(statep->hwd[i].hwd_thread, NULL) - < 0) + != 0) err(-1, "pthread_join"); } else { pid = waitpid(statep->hwd[i].hwd_pid, NULL, 0); Modified: stable/7/tools/tools/netrate/httpd/httpd.c ============================================================================== --- stable/7/tools/tools/netrate/httpd/httpd.c Tue Oct 12 21:01:26 2010 (r213749) +++ stable/7/tools/tools/netrate/httpd/httpd.c Tue Oct 12 21:40:43 2010 (r213750) @@ -280,7 +280,7 @@ main(int argc, char *argv[]) for (i = 0; i < THREADS; i++) { if (threaded) { if (pthread_create(&statep->hts[i].hts_thread, NULL, - httpd_worker, &statep->hts[i]) < 0) + httpd_worker, &statep->hts[i]) != 0) err(-1, "pthread_create"); } else { pid = fork(); @@ -299,7 +299,7 @@ main(int argc, char *argv[]) for (i = 0; i < THREADS; i++) { if (threaded) { if (pthread_join(statep->hts[i].hts_thread, NULL) - < 0) + != 0) err(-1, "pthread_join"); } else { pid = waitpid(statep->hts[i].hts_pid, NULL, 0); Modified: stable/7/tools/tools/netrate/juggle/juggle.c ============================================================================== --- stable/7/tools/tools/netrate/juggle/juggle.c Tue Oct 12 21:01:26 2010 (r213749) +++ stable/7/tools/tools/netrate/juggle/juggle.c Tue Oct 12 21:40:43 2010 (r213750) @@ -301,15 +301,15 @@ juggling_thread(void *arg) fd2 = *(int *)arg; - if (pthread_mutex_lock(&threaded_mtx) < 0) + if (pthread_mutex_lock(&threaded_mtx) != 0) err(-1, "juggling_thread: pthread_mutex_lock"); threaded_child_ready = 1; - if (pthread_cond_signal(&threaded_cond) < 0) + if (pthread_cond_signal(&threaded_cond) != 0) err(-1, "juggling_thread: pthread_cond_signal"); - if (pthread_mutex_unlock(&threaded_mtx) < 0) + if (pthread_mutex_unlock(&threaded_mtx) != 0) err(-1, "juggling_thread: pthread_mutex_unlock"); for (i = 0; i < NUMCYCLES; i++) { @@ -334,21 +334,21 @@ thread_juggle(int fd1, int fd2, int pipe threaded_pipeline = pipeline; - if (pthread_mutex_init(&threaded_mtx, NULL) < 0) + if (pthread_mutex_init(&threaded_mtx, NULL) != 0) err(-1, "thread_juggle: pthread_mutex_init"); - if (pthread_create(&thread, NULL, juggling_thread, &fd2) < 0) + if (pthread_create(&thread, NULL, juggling_thread, &fd2) != 0) err(-1, "thread_juggle: pthread_create"); - if (pthread_mutex_lock(&threaded_mtx) < 0) + if (pthread_mutex_lock(&threaded_mtx) != 0) err(-1, "thread_juggle: pthread_mutex_lock"); while (!threaded_child_ready) { - if (pthread_cond_wait(&threaded_cond, &threaded_mtx) < 0) + if (pthread_cond_wait(&threaded_cond, &threaded_mtx) != 0) err(-1, "thread_juggle: pthread_cond_wait"); } - if (pthread_mutex_unlock(&threaded_mtx) < 0) + if (pthread_mutex_unlock(&threaded_mtx) != 0) err(-1, "thread_juggle: pthread_mutex_unlock"); if (clock_gettime(CLOCK_REALTIME, &tstart) < 0) @@ -369,7 +369,7 @@ thread_juggle(int fd1, int fd2, int pipe if (clock_gettime(CLOCK_REALTIME, &tfinish) < 0) err(-1, "thread_juggle: clock_gettime"); - if (pthread_join(thread, NULL) < 0) + if (pthread_join(thread, NULL) != 0) err(-1, "thread_juggle: pthread_join"); timespecsub(&tfinish, &tstart);