Skip to Content.
Sympa Menu

ndt-dev - [ndt-dev] [ndt] r784 committed - Move to c99 and fix warnings

Subject: NDT-DEV email list created

List archive

[ndt-dev] [ndt] r784 committed - Move to c99 and fix warnings


Chronological Thread 
  • From:
  • To:
  • Subject: [ndt-dev] [ndt] r784 committed - Move to c99 and fix warnings
  • Date: Tue, 16 Oct 2012 15:23:26 +0000

Revision: 784
Author:

Date: Tue Oct 16 08:22:53 2012
Log: Move to c99 and fix warnings
http://code.google.com/p/ndt/source/detail?r=784

Modified:
/trunk/configure.ac
/trunk/src/fakewww.c
/trunk/src/heuristics.c
/trunk/src/logging.c
/trunk/src/mrange.c
/trunk/src/network.c
/trunk/src/test_c2s_srv.c
/trunk/src/test_mid_clt.c
/trunk/src/test_results_clt.c
/trunk/src/test_s2c_clt.c
/trunk/src/testoptions.c
/trunk/src/testoptions.h
/trunk/src/troute.c
/trunk/src/troute6.c
/trunk/src/viewtrace.c
/trunk/src/web100-admin.c
/trunk/src/web100-pcap.c
/trunk/src/web100-util.c
/trunk/src/web100clt.c
/trunk/src/web100srv.c
/trunk/src/web100srv.h

=======================================
--- /trunk/configure.ac Mon Aug 13 10:49:28 2012
+++ /trunk/configure.ac Tue Oct 16 08:22:53 2012
@@ -39,17 +39,20 @@

TOP_BUILD_DIRS=""

-CFLAGS="-pedantic -Wall -O2"
+# Note: -Werror is useful for debugging but a little strict.
+# Note: -Wno-unused-result is not supported on all platforms.
+# CFLAGS="-pedantic -Wall -Werror -Wno-unused-result -fno-strict-aliasing -std=gnu99"
+CFLAGS="-pedantic -Wall -fno-strict-aliasing -std=gnu99"

# Enabling/disabling asserts and debugging
AC_MSG_CHECKING(whether to enable debugging)
AC_ARG_ENABLE(debug, [ --enable-debug=[no/yes] turn on debugging
[default=no]],, enable_debug=no)
if test "x$enable_debug" = "xyes"; then
- CFLAGS="$CFLAGS -g"
+ CFLAGS="$CFLAGS -g -O0"
AC_MSG_RESULT(yes)
else
- CFLAGS="$CFLAGS -DNDEBUG"
+ CFLAGS="$CFLAGS -DNDEBUG -O2"
AC_MSG_RESULT(no)
fi

=======================================
--- /trunk/src/fakewww.c Mon Apr 30 13:46:39 2012
+++ /trunk/src/fakewww.c Tue Oct 16 08:22:53 2012
@@ -36,7 +36,7 @@
#include "logging.h"
#include "web100-admin.h"

-#define PORT "7123"
+#define LISTEN_PORT "7123"
#define AC_TIME_FORMAT "%d/%b/%Y:%H:%M:%S %z"
#define ER_TIME_FORMAT "%a %b %d %H:%M:%S %Y"
#define ACLOGFILE "access_log"
@@ -127,7 +127,7 @@
time_t tt;
socklen_t clilen;
char* srcname = NULL;
- char* listenport = PORT;
+ char* listenport = LISTEN_PORT;
int conn_options = 0;

char *ErLogFileName = BASEDIR
=======================================
--- /trunk/src/heuristics.c Tue Sep 25 06:49:57 2012
+++ /trunk/src/heuristics.c Tue Oct 16 08:22:53 2012
@@ -63,15 +63,14 @@
int max; // max speed bin counter value
int total; // total of the bin counts, used to calculate percentage
int ifspeedlocal; // local if-speed indicator
- FILE * fp; // log file pointer

for (n = 0; n < spd_index; n++) {
- sscanf(spds + n,
- "%d %d %d %d %d %d %d %d %d %d %d %d %f %d %d %d
%d %d %d",
+ sscanf(spds[n],
+ "%d %d %d %d %d %d %d %d %d %d %d %d %f %u %u %u
%d %d %d",
&links[0], &links[1], &links[2], &links[3],
&links[4],
&links[5], &links[6], &links[7], &links[8],
&links[9],
- &links[10], &links[11], runave + n, &inc_cnt,
&dec_cnt,
- &same_cnt, timeout, dupack, &ifspeedlocal);
+ &links[10], &links[11], &runave[n], inc_cnt,
dec_cnt,
+ same_cnt, timeout, dupack, &ifspeedlocal);
log_println(log_lvl_heur, " **First ele: spd=%s, runave=%f",
spds[n],
runave[n]);
max = 0;
=======================================
--- /trunk/src/logging.c Tue Sep 25 06:49:57 2012
+++ /trunk/src/logging.c Tue Oct 16 08:22:53 2012
@@ -28,7 +28,6 @@
static int _debuglevel = 0;
static char* _programname = "";
static char* LogFileName = BASEDIR"/"LOGFILE;
-static char ProtocolLogFileName[FILENAME_SIZE] = BASEDIR"/"PROTOLOGFILE;
static char* ProtocolLogDirName = BASEDIR"/"LOGDIR;
static char protocollogfilestore[FILENAME_SIZE];
static char enableprotologging = 0;
@@ -397,14 +396,16 @@
* @return number or characters written to the output buffer
* */

-int quote_delimiters(char *line, int line_size, char *output_buf,
- int output_buf_size) {
- static quoted[4][2] = { { '\n', 'n' }, { '"', '"' }, { '\0', '0' }, { '\\',
- '\\' }, };
+int quote_delimiters(const char *line, int line_size, char *output_buf, int output_buf_size) {
+ static char quoted[4][2] = {
+ { '\n', 'n' },
+ { '"', '"' },
+ { '\0', '0' },
+ { '\\', '\\' },
+ };
char quote_char = '\\';

int i, j, k;
- int match;

for (i = j = 0; i < line_size && j < output_buf_size - 1; i++) {
// find any matching characters among the quoted
@@ -655,18 +656,17 @@
FILE * fp;

char msgtypedescarr[MSG_TYPE_DESC_SIZE];
- char *currenttestname, *currentmsgtype, *currentbodyfmt;
+ char *currenttestname, *currentmsgtype;
char isotime[64];
char logmessage[4096]; // message after replacing delimiter characters
char protologfile[FILENAME_SIZE];
char msgbodytype[MSG_BODY_FMT_SIZE];
- int is_bitmessage = 0;

// get descriptive strings for test name and direction
currenttestname = get_currenttestdesc();
currentmsgtype = get_msgtypedesc(type, msgtypedescarr);

- is_bitmessage = getMessageBodyFormat(type, len, msgbodytype, (char *) msg, logmessage, sizeof(logmessage));
+ getMessageBodyFormat(type, len, msgbodytype, (char *) msg, logmessage, sizeof(logmessage));

fp = fopen(get_protologfile(ctlSocket, protologfile), "a");
if (fp == NULL) {
@@ -881,18 +881,12 @@
* @return current time string
*/
char *get_currenttime(char *isoTime, int isotimearrsize) {
- struct timeval now;
- time_t timenow;
+ time_t rawtime;
struct tm *result;
- int rc;
-
- struct timeval tv;
-
- rc = gettimeofday(&now, NULL);
-
- if(rc==0) {
- timenow = now.tv_sec;
- result = gmtime(&now);
+ time_t rc;
+ rc = time(&rawtime);
+ if(rc!=-1) {
+ result = gmtime(&rawtime);
return (fill_ISOtime(result, isoTime, isotimearrsize));
}
return NULL;
@@ -911,7 +905,6 @@

struct tm *result;
time_t now;
- char tmpstr[16];

setenv("TZ", "UTC", 0);
now = get_timestamp();
@@ -1160,9 +1153,8 @@
char namebuf[256];
size_t namebuflen = 255;
char dir[128];
- DIR *dp;
char isoTime[64];
- char *socketaddrport;
+ int socketaddrport;

I2Addr sockAddr = I2AddrBySAddr(get_errhandle(), cliaddrarg,
clilenarg, 0,
0);
=======================================
--- /trunk/src/mrange.c Mon Apr 30 13:46:39 2012
+++ /trunk/src/mrange.c Tue Oct 16 08:22:53 2012
@@ -34,7 +34,7 @@
int mrange_parse(char* text) {
char tmp[300];
char* ptr, *sptr;
- Range* mr_ptr;
+ Range* mr_ptr = NULL;

assert(text);

=======================================
--- /trunk/src/network.c Mon Apr 30 13:46:39 2012
+++ /trunk/src/network.c Tue Oct 16 08:22:53 2012
@@ -6,9 +6,10 @@
*

*/

-#include <unistd.h>
#include <assert.h>
+#include <netdb.h>
#include <string.h>
+#include <unistd.h>

#include "network.h"
#include "logging.h"
@@ -81,8 +82,7 @@
if (!I2AddrSetSAddr(addr, ai->ai_addr, ai->ai_addrlen)
|| !I2AddrSetProtocol(addr,
ai->ai_protocol)
|| !I2AddrSetSocktype(addr,
ai->ai_socktype)) {
- log_println(1,
- "OpenSocket: Unable to set saddr
in address record");
+ log_println(1, "OpenSocket: Unable to set saddr in
address record");
return -1;
}
// set port if not already done, else return -1
@@ -101,9 +101,7 @@
}
// save socket file descriptor
if (!I2AddrSetFD(addr, fd, True)) {
- log_println(
- 1,
- "OpenSocket: Unable to set file
descriptor in address record");
+ log_println(1, "OpenSocket: Unable to set file descriptor in address record");
return -1;
}
// end setting values in "addr" structure
@@ -116,10 +114,9 @@
/* RAC debug statemement 10/11/06 */
onSize = sizeof(on);
getsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on,
&onSize);
- log_println(
- 1,
- "bind(%d) failed: Address already in use given as the reason, getsockopt() returned %d",
- fd, on);
+ log_println(1,
+ "bind(%d) failed: Address already in use given as the reason, getsockopt() returned %d",
+ fd, on);
return -2;
}

@@ -158,8 +155,7 @@
goto error;
}

- if ((!addr)
- && !(addr = I2AddrByWildcard(get_errhandle(),
SOCK_STREAM, serv))) {
+ if ((!addr) && !(addr = I2AddrByWildcard(get_errhandle(), SOCK_STREAM, serv))) {
log_println(1, "Unable to create I2Addr record by wildcard.");
goto error;
}
@@ -352,8 +348,7 @@
return 0;
}
// unable to save
- log_println(1,
- "I2Addr functions failed after successful
connection");
+ log_println(1, "I2Addr functions failed after successful
connection");
while ((close(*sockfd) < 0) && (errno == EINTR))
;
return 1;
@@ -381,7 +376,6 @@
int send_msg(int ctlSocket, int type, void* msg, int len) {
unsigned char buff[3];
int rc, i;
- FILE * fp;

assert(msg);
assert(len >= 0);
@@ -446,7 +440,6 @@
int recv_msg(int ctlSocket, int* type, void* msg, int* len) {
unsigned char buff[3];
int length;
- FILE * fp;

char *msgtemp = (char*) msg;

@@ -500,10 +493,9 @@
if (errno == EINTR) // interrupted, retry writing
again
continue;
if (errno != EAGAIN) { // some genuine socket write
error
- log_println(
- 6,
- "writen() Error! write(%d) failed
with err='%s(%d) pic=%d'",
- fd, strerror(errno), errno,
getpid());
+ log_println(6,
+ "writen() Error! write(%d) failed with err='%s(%d) pic=%d'",
+ fd, strerror(errno), errno, getpid());
return -1;
}
}
@@ -547,9 +539,7 @@
// check if fd+1 socket is ready to be read
rc = select(fd + 1, &rfd, NULL, NULL, &sel_tv);
if (rc == 0) { /* A timeout occurred, nothing to read from socket after 3 seconds */
- log_println(
- 6,
- "readn() routine timeout occurred, return error signal and kill off child");
+ log_println(6, "readn() routine timeout occurred, return error signal and kill off child");
return received;
}
if ((rc == -1) && (errno == EINTR)) /* a signal was processed, ignore it */
=======================================
--- /trunk/src/test_c2s_srv.c Tue Sep 25 06:49:57 2012
+++ /trunk/src/test_c2s_srv.c Tue Oct 16 08:22:53 2012
@@ -85,8 +85,8 @@
pthread_t workerThreadId;

// web_100 related variables
- web100_group* group;
- web100_connection* conn;
+ web100_group* group = NULL;
+ web100_connection* conn = NULL;

// snap related variables
SnapArgs snapArgs;
@@ -101,7 +101,6 @@
enum PROCESS_STATUS_INT procstatusenum = UNKNOWN;
enum PROCESS_TYPE_INT proctypeenum = CONNECT_TYPE;
char namesuffix[256] = "c2s_snaplog";
- char currenttestdesc[TEST_NAME_DESC_SIZE] = "c2s" ;

if (testOptions->c2sopt) {
setCurrentTest(TEST_C2S);
@@ -269,7 +268,7 @@
5,
"C2S test Child %d thinks pipe()
returned fd0=%d, fd1=%d",
testOptions->child0,
mon_pipe1[0], mon_pipe1[1]);
- log_println(2, "C2S test calling init_pkttrace() with pd=0x%x", (int) &cli_addr);
+ log_println(2, "C2S test calling init_pkttrace() with pd=%p", &cli_addr);
init_pkttrace(src_addr, (struct sockaddr *)
&cli_addr, clilen,
mon_pipe1, device, &pair, "c2s",
options->compress);
exit(0); /* Packet trace finished, terminate
gracefully */
=======================================
--- /trunk/src/test_mid_clt.c Tue Sep 25 06:49:57 2012
+++ /trunk/src/test_mid_clt.c Tue Oct 16 08:22:53 2012
@@ -51,7 +51,7 @@
int msgLen, msgType;
int midport = atoi(PORT3);
I2Addr sec_addr = NULL;
- int retcode, one=1, i, inlth;
+ int retcode, inlth;
int in2Socket;
double t, spdin;
uint32_t bytes;
@@ -119,7 +119,6 @@
printf("Checking for Middleboxes . . . . . . . . . . . . . . . . .
. ");
fflush(stdout);
testresult_str[0] = '\0';
- i = 0;
bytes = 0;
t = secs() + 5.0; // set timer for 5 seconds, and read for 5
seconds
sel_tv.tv_sec = 6; // Time out the socket after 6.5 seconds
=======================================
--- /trunk/src/test_results_clt.c Mon Apr 30 13:46:39 2012
+++ /trunk/src/test_results_clt.c Tue Oct 16 08:22:53 2012
@@ -87,20 +87,16 @@
printf("Alarm: Duplex Mismatch condition detected. Switch=Full and Host=Half\n");
break;
case DUPLEX_SWITCH_FULL_HOST_HALF_POSS:
- printf(
- "Alarm: Possible Duplex Mismatch condition detected. Switch=Full and Host=Half\n");
+ printf("Alarm: Possible Duplex Mismatch condition detected. Switch=Full and Host=Half\n");
break;
case DUPLEX_SWITCH_HALF_HOST_FULL:
- printf(
- "Alarm: Duplex Mismatch condition detected. Switch=Half and Host=Full\n");
+ printf("Alarm: Duplex Mismatch condition detected. Switch=Half and Host=Full\n");
break;
case DUPLEX_SWITCH_HALF_HOST_FULL_POSS:
- printf(
- "Alarm: Possible Duplex Mismatch condition detected. Switch=Half and Host=Full\n");
+ printf("Alarm: Possible Duplex Mismatch condition detected. Switch=Half and Host=Full\n");
break;
case DUPLEX_SWITCH_HALF_HOST_FULL_WARN:
- printf(
- "Warning: Possible Duplex Mismatch condition detected. Switch=Half and Host=Full\n");
+ printf("Warning: Possible Duplex Mismatch condition detected. Switch=Half and Host=Full\n");
break;
}
}
@@ -126,7 +122,7 @@
if (((rwin*2)/rttsec) < mylink) {
j = (float)((mylink * avgrtt)*1000) / 8;
if ((int)j > max_RwinRcvd) {
- printf("Information: The receive buffer should be %0.0f
", j/1024);
+ printf("Information: The receive buffer should be %0.0f
", j/1024.0f);
printf("kbytes to maximize throughput\n");
}
}
@@ -148,7 +144,7 @@
* */
void check_congestion(int is_congested) {
if (is_congested == POSSIBLE_CONGESTION) {
- printf("Information: Other network traffic is congesting the link\n");
+ printf("Information: Other network traffic is congesting the link\n");
}
}

@@ -225,8 +221,7 @@
printf("The connection stalled %d times due to packet
loss.\n",
Timeouts);
if (waitsec > 0)
- printf(
- "The connection was idle %0.2f seconds
(%0.2f%%) of the time.\n",
+ printf("The connection was idle %0.2f seconds (%0.2f%%) of
the time.\n",
waitsec, (100 * waitsec /
totaltesttime));
} else if (DupAcksIn > 0) {
printf("No packet loss - ");
@@ -263,16 +258,14 @@
printf("This connection is receiver limited %0.2f%% of the
time.\n",
rwintime * 100);
if ((2 * (rwin / rttsec)) < mylinkspeed)
- printf(
- " Increasing the current receive buffer (%0.2f KB) will improve performance\n",
+ printf(" Increasing the current receive buffer (%0.2f KB) will improve performance\n",
(float) max_rwinrcvd / KILO_BITS);
}
if (sendtime > .015) {
printf("This connection is sender limited %0.2f%% of the
time.\n",
sendtime * 100);
if ((2 * (swin / rttsec)) < mylinkspeed)
- printf(
- " Increasing the current send buffer (%0.2f KB) will improve performance\n",
+ printf(" Increasing the current send buffer (%0.2f KB) will improve performance\n",
(float) sndbuf / KILO_BITS);
}
if (cwndtime > .005) {
@@ -289,8 +282,7 @@
*/
void print_packetloss_excess(double spd, double loss) {
if ((spd < 4) && (loss > .01)) {
- printf(
- "Excessive packet loss is impacting your
performance, check the ");
+ printf("Excessive packet loss is impacting your performance, check the ");
printf("auto-negotiate function on your local PC and network
switch\n");
}
}
@@ -388,16 +380,13 @@

printf("The theoretical network limit is %0.2f Mbps\n", estimate);

- printf(
- "The NDT server has a %0.0f KByte buffer which limits the throughput to %0.2f Mbps\n",
+ printf("The NDT server has a %0.0f KByte buffer which limits the throughput to %0.2f Mbps\n",
(float) tempsendbuf / KILO_BITS, (float) s_win /
rttsec);

- printf(
- "Your PC/Workstation has a %0.0f KByte buffer which limits the throughput to %0.2f Mbps\n",
+ printf("Your PC/Workstation has a %0.0f KByte buffer which limits the throughput to %0.2f Mbps\n",
(float) max_rwinrcvd / KILO_BITS, (float) r_win /
rttsec);

- printf(
- "The network based flow control limits the throughput to
%0.2f Mbps\n",
+ printf("The network based flow control limits the throughput to %0.2f Mbps\n",
(float) c_win / rttsec);

}
@@ -415,12 +404,10 @@
void print_linkspeed_dataacks(int isC2S_enabled, int c2s_linkspeed_data,
int c2s_linkspeed_ack, int s2c_linkspeed_data, int
s2c_linkspeed_ack) {
if (isC2S_enabled) {
- printf(
- "\nClient Data reports link is '%3d', Client Acks report link is '%3d'\n",
+ printf("\nClient Data reports link is '%3d', Client Acks report link is '%3d'\n",
c2s_linkspeed_data, c2s_linkspeed_ack);
}
- printf(
- "Server Data reports link is '%3d', Server Acks report
link is '%3d'\n",
+ printf("Server Data reports link is '%3d', Server Acks report link is '%3d'\n",
s2c_linkspeed_data, s2c_linkspeed_ack);

}
@@ -473,8 +460,7 @@
if (*mssvalue == 1456)
printf("Packet size is preserved End-to-End\n");
else
- printf(
- "Information: Network Middlebox is modifying MSS variable (changed to %d)\n",
+ printf("Information: Network Middlebox is modifying MSS variable (changed to %d)\n",
*mssvalue);

}
=======================================
--- /trunk/src/test_s2c_clt.c Tue Sep 25 06:49:57 2012
+++ /trunk/src/test_s2c_clt.c Tue Oct 16 08:22:53 2012
@@ -57,8 +57,6 @@
// variables used for protocol validation logs
enum TEST_STATUS_INT teststatuses = TEST_NOT_STARTED;
enum TEST_ID testids = S2C;
- enum PROCESS_STATUS_INT procstatusenum = UNKNOWN;
- enum PROCESS_TYPE_INT proctypeenum = CONNECT_TYPE;

if (tests & TEST_S2C) {
setCurrentTest(TEST_S2C);
=======================================
--- /trunk/src/testoptions.c Tue Sep 25 06:49:57 2012
+++ /trunk/src/testoptions.c Tue Oct 16 08:22:53 2012
@@ -312,8 +312,7 @@
* @param snaplogenabled boolean indication whether snap logging is enabled
* @param snapArgs_ptr pointer to a snapArgs object
* */
-void stop_snap_worker(int *workerThreadId, char snaplogenabled,
- SnapArgs* snapArgs_ptr) {
+void stop_snap_worker(pthread_t *workerThreadId, char snaplogenabled, SnapArgs* snapArgs_ptr) {
if (*workerThreadId) {
pthread_mutex_lock(&mainmutex);
workerLoop = 0;
@@ -362,7 +361,7 @@
testindicatorarg, imonarg[0], imonarg[1]);

init_pkttrace(src_addr, cliaddrarg, clilenarg, imonarg,
device,
- &pairarg, testindicatorarg,
iscompressionenabled);
+ pairarg, testindicatorarg,
iscompressionenabled);

exit(0); // Packet trace finished, terminate gracefully
}
=======================================
--- /trunk/src/testoptions.h Tue Sep 25 06:49:57 2012
+++ /trunk/src/testoptions.h Tue Oct 16 08:22:53 2012
@@ -74,8 +74,7 @@
char *metafilevariablename, char *metafilename, web100_connection* conn,
web100_group* group);

-void stop_snap_worker(int *workerThreadId, char snaplogenabled,
- SnapArgs* snapArgs_ptr);
+void stop_snap_worker(pthread_t *workerThreadId, char snaplogenabled, SnapArgs* snapArgs_ptr);

void setCwndlimit(web100_connection* connarg, web100_group* grouparg,
web100_agent* agentarg, Options* optionsarg);
=======================================
--- /trunk/src/troute.c Mon Apr 30 13:46:39 2012
+++ /trunk/src/troute.c Tue Oct 16 08:22:53 2012
@@ -398,7 +398,7 @@
* Subtract 2 timeval structs: out = out - in.
* Out is assumed to be >= in.
*/
-voidtvsub (out, in)
+void tvsub (out, in)
register struct timeval *out, *in; {
if ((out->tv_usec -= in->tv_usec) < 0) {
out->tv_sec--;
@@ -406,4 +406,3 @@
}
out->tv_sec -= in->tv_sec;
}
-
=======================================
--- /trunk/src/troute6.c Mon Apr 30 13:46:39 2012
+++ /trunk/src/troute6.c Tue Oct 16 08:22:53 2012
@@ -303,19 +303,19 @@

struct ipv6hdr {
#if defined(__LITTLE_ENDIAN_BITFIELD)
- __u8 priority:4,
+__extension__ __u8 priority:4,
version:4;
#elif defined(__BIG_ENDIAN_BITFIELD)
- __u8 version:4,
+__extension__ __u8 version:4,
priority:4;
#else
#error "Please fix <asm/byteorder.h>"
#endif
- __u8 flow_lbl[3];
+__extension__ __u8 flow_lbl[3];

- __u16 payload_len;
- __u8 nexthdr;
- __u8 hop_limit;
+__extension__ __u16 payload_len;
+__extension__ __u8 nexthdr;
+__extension__ __u8 hop_limit;

struct in6_addr saddr;
struct in6_addr daddr;
@@ -644,9 +644,10 @@
return (ttab1[t]);
}

- if (t >= 128 && t <= 131)
+ unsigned char newt = t - 128;
+ if (newt < 5)
{
- return (ttab2[t]);
+ return (ttab2[newt]);
}

return("OUT-OF-RANGE");
=======================================
--- /trunk/src/viewtrace.c Mon Apr 30 13:46:39 2012
+++ /trunk/src/viewtrace.c Tue Oct 16 08:22:53 2012
@@ -23,6 +23,7 @@
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/errno.h>
+#include <getopt.h>

#include <netinet/ip.h>
#include <netinet/tcp.h>
=======================================
--- /trunk/src/web100-admin.c Tue Sep 25 06:49:57 2012
+++ /trunk/src/web100-admin.c Tue Oct 16 08:22:53 2012
@@ -551,7 +551,7 @@
return;
}
lock.l_type = F_WRLCK;
- i = fcntl((int) fp, F_SETLKW, lock);
+ i = fcntl(fileno(fp), F_SETLKW, lock);
log_println(1, "successfully locked '/tmp/view.string' for updating");
sprintf(
view_string,
@@ -564,7 +564,7 @@
log_println(1, "sending '%s' to tmp file", view_string);
fprintf(fp, "%s\n", view_string);
lock.l_type = F_UNLCK;
- fcntl((int) fp, F_SETLK, lock);
+ fcntl(fileno(fp), F_SETLK, lock);
fclose(fp);
}

=======================================
--- /trunk/src/web100-pcap.c Tue Sep 25 06:49:57 2012
+++ /trunk/src/web100-pcap.c Tue Oct 16 08:22:53 2012
@@ -795,11 +795,9 @@
struct sockaddr *src_addr;
pcap_if_t *alldevs, *dp;
pcap_addr_t *curAddr;
- DIR *dip;
int rc;

char logdir[256];
- char logfilesuffix[256] = "ndttrace"; // logfile suffix

cnt = -1; /* read forever, or until end of file */
sig1 = 0;
@@ -963,7 +961,7 @@
fprintf(stderr, "pcap_open_live failed: %s\n", errbuf);
}

- log_println(2, "pcap_open_live() returned pointer 0x%x", (int) pd);
+ log_println(2, "pcap_open_live() returned pointer %p", pd);

memset(namebuf, 0, 200);
I2AddrNodeName(sockAddr, namebuf, &nameBufLen);
@@ -971,7 +969,7 @@
sprintf(cmdbuf, "host %s and port %d", namebuf, I2AddrPort(sockAddr));

log_println(1, "installing pkt filter for '%s'", cmdbuf);
- log_println(1, "Initial pkt src data = %x", (int) fwd.saddr);
+ log_println(1, "Initial pkt src data = %p", fwd.saddr);

if (pcap_compile(pd, &fcode, cmdbuf, 0, 0xFFFFFF00) < 0) {
fprintf(stderr, "pcap_compile failed %s\n", pcap_geterr(pd));
=======================================
--- /trunk/src/web100-util.c Mon Apr 30 13:46:39 2012
+++ /trunk/src/web100-util.c Tue Oct 16 08:22:53 2012
@@ -682,8 +682,8 @@
* @return Integer, 0 on success, -1 on failure
*/

-int CwndDecrease(web100_agent* agent, char* logname, int *dec_cnt,
- int *same_cnt, int *inc_cnt) {
+int CwndDecrease(web100_agent* agent, char* logname, u_int32_t *dec_cnt,
+ u_int32_t *same_cnt, u_int32_t *inc_cnt) {

web100_var* var;
char buff[256];
@@ -719,8 +719,7 @@
rt = web100_snap_read(var, snap, buff);
s2 = atoi(web100_value_to_text(web100_get_var_type(var),
buff));
if (cnt < 20) {
- log_println(7, "Reading snaplog 0x%x (%d), var = %s",
(int) snap,
- cnt, (char*) var);
+ log_println(7, "Reading snaplog %p (%d), var = %s", snap, cnt, (char*) var);
log_println(
7,
"Checking for Cwnd decreases. rt=%d,
s1=%d, s2=%d (%s), dec-cnt=%d",
=======================================
--- /trunk/src/web100clt.c Mon Aug 13 10:49:28 2012
+++ /trunk/src/web100clt.c Tue Oct 16 08:22:53 2012
@@ -1,12 +1,12 @@
#include "../config.h"

+#include <ctype.h>
#include <errno.h>
-#include <string.h>
#include <getopt.h>
#include <stdlib.h>
-#include <unistd.h>
+#include <string.h>
#include <time.h>
-#include <ctype.h>
+#include <unistd.h>

#include "network.h"
#include "usage.h"
@@ -828,7 +828,7 @@
for (;;) {
msgLen = sizeof(buff);
memset(buff, 0, msgLen); // reset buff and msgLen
- if (retcode = (recv_msg(ctlSocket, &msgType, buff, &msgLen)))
{
+ if ((retcode = (recv_msg(ctlSocket, &msgType, buff,
&msgLen)))) {
if (errno == ECONNRESET)
log_println(0,
"Connection closed by server, No
test performed.");
=======================================
--- /trunk/src/web100srv.c Tue Sep 25 06:49:57 2012
+++ /trunk/src/web100srv.c Tue Oct 16 08:22:53 2012
@@ -64,10 +64,11 @@

#include <time.h>
#include <ctype.h>
+#include <getopt.h>
#include <math.h>
#define SYSLOG_NAMES
-#include <syslog.h>
#include <pthread.h>
+#include <syslog.h>
#include <sys/times.h>

#include "web100srv.h"
@@ -993,7 +994,8 @@
//int j; // commented out -> calc_linkspeed
int totalcnt;
int autotune;
- int dec_cnt, same_cnt, inc_cnt, timeout, dupack; // values collected from the speed tests
+ u_int32_t dec_cnt, same_cnt, inc_cnt; // values collected from the speed tests
+ int timeout, dupack;
//int ifspeed;

time_t stime;
@@ -1476,7 +1478,7 @@
* @param argv string command line arguments
* */
int main(int argc, char** argv) {
- pid_t chld_pid;
+ pid_t chld_pid = -1;
int retcode;
int tpid, mwaiting = 0;
int ctlsockfd = -1;
@@ -1502,7 +1504,6 @@
char isoTime[64], dir[256];
int debug = 0;

- DIR *dp;
int j;
char *name;

@@ -2722,4 +2723,3 @@
char *get_remotehost() {
return rmt_host;
}
-
=======================================
--- /trunk/src/web100srv.h Mon Aug 13 10:49:28 2012
+++ /trunk/src/web100srv.h Tue Oct 16 08:22:53 2012
@@ -24,9 +24,8 @@
#endif
#include <stdlib.h>
#include <string.h>
+#include <fcntl.h>
#include <unistd.h>
-#include <fcntl.h>
-#include <getopt.h>

#include <sys/types.h>
#include <sys/socket.h>
@@ -207,7 +206,8 @@
int web100_setbuff(int sock, web100_agent* agent, web100_connection* cn, int autotune);
void web100_get_data_recv(int sock, web100_agent* agent, web100_connection* cn, int count_vars);
int web100_get_data(web100_snapshot* snap, int ctlsock, web100_agent* agent, int count_vars);
-int CwndDecrease(web100_agent* agent, char* logname, int *dec_cnt, int *same_cnt, int *inc_cnt);
+int CwndDecrease(web100_agent* agent, char* logname,
+ u_int32_t *dec_cnt, u_int32_t *same_cnt, u_int32_t *inc_cnt);
int web100_logvars(int *Timeouts, int *SumRTT, int *CountRTT,
int *PktsRetrans, int *FastRetran, int *DataPktsOut, int
*AckPktsOut,
int *CurrentMSS, int *DupAcksIn, int *AckPktsIn, int
*MaxRwinRcvd,


  • [ndt-dev] [ndt] r784 committed - Move to c99 and fix warnings, ndt, 10/16/2012

Archive powered by MHonArc 2.6.16.

Top of Page