From: Robert W. <ro...@us...> - 2002-04-10 16:12:35
|
FYI. Patch applied to CVS tree. - Robbie Robert V. Williamson Linux Test Project IBM Linux Technology Center Phone: (512) 838-9295 T/L: 638-9295 http://ltp.sourceforge.net "Hron, Randall" <x2...@so...> To: "'ltp...@li...'" <ltp...@li...> Sent by: cc: ltp...@li...ur Subject: [LTP] mtest01 patch for wrap around at 2gigs ceforge.net 04/04/2002 12:03 PM Patch for two things in mtest01.c: 1) Typo in printf puts an extra "d" in the output: diff mtest01.orig.out mtest01.new.out < Filling up 80% of ram which is 175587328d bytes --- > Filling up 80% of ram which is 175734784 bytes 2) bytecount wraps to negative value with verbose option: (snippet of wrap) allocated 2145386496 bytes chunksize is 1048576 allocated 2146435072 bytes chunksize is 1048576 allocated -2147483648 bytes chunksize is 1048576 allocated -2146435072 bytes chunksize is 1048576 Perhaps someone can improve on this: --- mtest01.c.orig Fri Nov 9 17:43:09 2001 +++ mtest01.c Thu Apr 4 12:42:59 2002 @@ -37,8 +37,8 @@ int main(int argc, char* argv[]) { char* mem; - unsigned int bytecount, maxpercent=0, dowrite=0, verbose=0, j, c; - unsigned long int maxbytes; + unsigned int maxpercent=0, dowrite=0, verbose=0, j, c; + unsigned long int bytecount, maxbytes; extern char* optarg; size_t chunksize = 1024*1024; /* one meg at a time by default */ struct sysinfo sstats; @@ -91,23 +91,23 @@ /* set maxbytes to the extra amount we want to allocate */ maxbytes = D-C; - printf("Filling up %d%% of ram which is %lud bytes\n",maxpercent,maxbytes); + printf("Filling up %d%% of ram which is %lu bytes\n",maxpercent,maxbytes); } bytecount=chunksize; while(1) { if((mem = (char*)malloc(chunksize)) == NULL) { - printf("stopped at %d bytes\n",bytecount); + printf("stopped at %lu bytes\n",bytecount); exit(1); } if(dowrite) for(j=0; j<chunksize; j++) *(mem+j)='a'; - if(verbose) printf("allocated %d bytes chunksize is %d\n",bytecount,chunksize); + if(verbose) printf("allocated %lu bytes chunksize is %d\n",bytecount,chunksize); bytecount+=chunksize; if(maxbytes && (bytecount >= maxbytes)) break; } - printf("PASS ... %d bytes allocated.\n",bytecount); + printf("PASS ... %lu bytes allocated.\n",bytecount); exit(0); } _______________________________________________ Ltp-list mailing list Ltp...@li... https://lists.sourceforge.net/lists/listinfo/ltp-list |