From: Xiao F. S. <xi...@se...> - 2002-08-23 18:44:55
|
Hi: This is a patch for some format string compiler warnings. I haven't tested it yet, but it seems like it should be fine. Kent Shi diff -aur ltp-20020807.orig/testcases/kernel/sched/pthreads/pth_str01.c ltp-20020807/testcases/kernel/sched/pthreads/pth_str01.c --- ltp-20020807.orig/testcases/kernel/sched/pthreads/pth_str01.c Wed Apr 10 09:10:41 2002 +++ ltp-20020807/testcases/kernel/sched/pthreads/pth_str01.c Fri Aug 23 11:02:00 2002 @@ -364,7 +364,7 @@ for ( child = 0; child < breadth; child++ ) { if ( debug ) { printf( "thread %d making child %d, ptr=%p\n", my_index, - child, (unsigned int)&(info_p->threads[child]) ); + child, &(info_p->threads[child]) ); fflush( stdout ); } if ((rc = pthread_create(&(info_p->threads[child]), &attr, @@ -374,7 +374,7 @@ exit( 3 ); } else { if ( debug ) { - printf( "pthread_create made thread %lx\n", + printf( "pthread_create made thread %p\n", &(info_p->threads[child]) ); fflush( stdout ); } diff -aur ltp-20020807.orig/testcases/kernel/sched/sched_stress/sched.c ltp-20020807/testcases/kernel/sched/sched_stress/sched.c --- ltp-20020807.orig/testcases/kernel/sched/sched_stress/sched.c Fri Jan 4 12:28:52 2002 +++ ltp-20020807/testcases/kernel/sched/sched_stress/sched.c Fri Aug 23 11:02:00 2002 @@ -55,6 +55,7 @@ #include <stdarg.h> #include <stdio.h> +#include <string.h> #include "sched.h" #if 0 diff -aur ltp-20020807.orig/testcases/kernel/sched/sched_stress/sched_driver.c ltp-20020807/testcases/kernel/sched/sched_stress/sched_driver.c --- ltp-20020807.orig/testcases/kernel/sched/sched_stress/sched_driver.c Fri Jan 4 12:28:52 2002 +++ ltp-20020807/testcases/kernel/sched/sched_stress/sched_driver.c Fri Aug 23 11:09:28 2002 @@ -84,6 +84,7 @@ #include <stdlib.h> #include <signal.h> +#include <time.h> #include "sched.h" /* @@ -112,7 +113,7 @@ #define DEFAULT_STRESS_PERCENTAGE 0.5 #define DEFAULT_PROCESS_SLOTS 16 #define DEFAULT_TIME 1.00 -#define USAGE "Usage: sched [-s n] [-p n] [-t n] [-d] [-v] \n" \ +#define USAGE "Usage: %s [-s n] [-p n] [-t n] [-d] [-v] \n" \ " -s n stress percentage [0.0<n<1.0] (default 0.5) \n" \ " -p n process slots (default 16) \n" \ " -t n execution time in hours (default 1.0 hrs) \n" \ @@ -206,7 +207,7 @@ printf ("workslots available: %d\n", workslots); printf ("stress_percent: %f\n", stress_percent); printf ("run-hours: %f (hrs)\n", execution_time); - printf ("runseconds: %d (sec)\n", runseconds); + printf ("runseconds: %ld (sec)\n", runseconds); } /* diff -aur ltp-20020807.orig/testcases/kernel/sched/sched_stress/sched_tc0.c ltp-20020807/testcases/kernel/sched/sched_stress/sched_tc0.c --- ltp-20020807.orig/testcases/kernel/sched/sched_stress/sched_tc0.c Fri Jan 4 12:28:52 2002 +++ ltp-20020807/testcases/kernel/sched/sched_stress/sched_tc0.c Fri Aug 23 11:02:00 2002 @@ -78,7 +78,7 @@ */ #define DEFAULT_PRIORITY_TYPE "variable" #define DEFAULT_EXECUTION_TIME 1800 -#define USAGE "Usage: sched_tc0 [-p priority] [-t sec] [-v] [-d] \n" \ +#define USAGE "Usage: %s [-p priority] [-t sec] [-v] [-d] \n" \ " -t sec execution time (default 1800 sec) \n" \ " -p priority priority (default variable) \n" \ " -v verbose \n" \ diff -aur ltp-20020807.orig/testcases/kernel/sched/sched_stress/sched_tc1.c ltp-20020807/testcases/kernel/sched/sched_stress/sched_tc1.c --- ltp-20020807.orig/testcases/kernel/sched/sched_stress/sched_tc1.c Fri Jan 4 12:28:52 2002 +++ ltp-20020807/testcases/kernel/sched/sched_stress/sched_tc1.c Fri Aug 23 11:02:00 2002 @@ -77,7 +77,7 @@ * */ #define DEFAULT_PRIORITY_TYPE "variable" -#define USAGE "Usage: sched_tc1 [-p priority] [-v] [-d] \n" \ +#define USAGE "Usage: %s [-p priority] [-v] [-d] \n" \ " -p priority priority (default variable) \n" \ " -v verbose \n" \ " -d enable debugging messages \n" diff -aur ltp-20020807.orig/testcases/kernel/sched/sched_stress/sched_tc2.c ltp-20020807/testcases/kernel/sched/sched_stress/sched_tc2.c --- ltp-20020807.orig/testcases/kernel/sched/sched_stress/sched_tc2.c Fri Jan 4 12:28:52 2002 +++ ltp-20020807/testcases/kernel/sched/sched_stress/sched_tc2.c Fri Aug 23 11:02:00 2002 @@ -81,7 +81,7 @@ #define DEFAULT_PRIORITY_TYPE "variable" #define DEFAULT_EXECUTION_TIME 1800 #define MATRIX_SIZE 100 -#define USAGE "Usage: sched_tc2 [-p priority] [-t sec] [-v] [-d] \n" \ +#define USAGE "Usage: %s [-p priority] [-t sec] [-v] [-d] \n" \ " -t sec execution time (default 1800 sec) \n" \ " -p priority priority (default variable) \n" \ " -v verbose \n" \ diff -aur ltp-20020807.orig/testcases/kernel/sched/sched_stress/sched_tc3.c ltp-20020807/testcases/kernel/sched/sched_stress/sched_tc3.c --- ltp-20020807.orig/testcases/kernel/sched/sched_stress/sched_tc3.c Fri Jan 4 12:28:52 2002 +++ ltp-20020807/testcases/kernel/sched/sched_stress/sched_tc3.c Fri Aug 23 11:06:41 2002 @@ -60,6 +60,7 @@ | | +---------------------------------------------------------------------*/ +#include <stdlib.h> #include <signal.h> #include <sys/time.h> #include <sys/resource.h> @@ -81,7 +82,7 @@ #define DEFAULT_PRIORITY_TYPE "variable" #define DEFAULT_EXECUTION_TIME 1800 #define MATRIX_SIZE 100 -#define USAGE "Usage: sched_tc3 [-p priority] [-v] [-d] \n" \ +#define USAGE "Usage: %s [-p priority] [-v] [-d] \n" \ " -p priority priority (default variable) \n" \ " -v verbose \n" \ " -d enable debugging messages \n" diff -aur ltp-20020807.orig/testcases/kernel/sched/sched_stress/sched_tc4.c ltp-20020807/testcases/kernel/sched/sched_stress/sched_tc4.c --- ltp-20020807.orig/testcases/kernel/sched/sched_stress/sched_tc4.c Tue Jan 8 08:48:09 2002 +++ ltp-20020807/testcases/kernel/sched/sched_stress/sched_tc4.c Fri Aug 23 11:02:00 2002 @@ -83,7 +83,7 @@ #define DEFAULT_LOGFILE "sched_tc4.log" #define BLOCK_SIZE 512 #define TIMES 5000 -#define USAGE "Usage: sched_tc4 [-l log] [-t type] [-p priority] [-v] [-d]\n" \ +#define USAGE "Usage: %s [-l log] [-t type] [-p priority] [-v] [-d]\n" \ " -l log log file \n" \ " -t type priority type 'variable' or 'fixed' \n" \ " -p priority priority value \n" \ diff -aur ltp-20020807.orig/testcases/kernel/sched/sched_stress/sched_tc5.c ltp-20020807/testcases/kernel/sched/sched_stress/sched_tc5.c --- ltp-20020807.orig/testcases/kernel/sched/sched_stress/sched_tc5.c Fri Jan 4 12:28:52 2002 +++ ltp-20020807/testcases/kernel/sched/sched_stress/sched_tc5.c Fri Aug 23 11:02:00 2002 @@ -84,7 +84,7 @@ #define DEFAULT_LOGFILE "sched_tc5.log" #define TIMES 20 #define MATRIX_SIZE 50 -#define USAGE "Usage: sched_tc5 [-l log] [-t type] [-p priority] [-v] [-d]\n" \ +#define USAGE "Usage: %s [-l log] [-t type] [-p priority] [-v] [-d]\n" \ " -l log log file \n" \ " -t type priority type 'variable' or 'fixed' \n" \ " -p priority priority value \n" \ diff -aur ltp-20020807.orig/testcases/kernel/sched/sched_stress/sched_tc6.c ltp-20020807/testcases/kernel/sched/sched_stress/sched_tc6.c --- ltp-20020807.orig/testcases/kernel/sched/sched_stress/sched_tc6.c Fri Jan 4 12:28:52 2002 +++ ltp-20020807/testcases/kernel/sched/sched_stress/sched_tc6.c Fri Aug 23 11:13:34 2002 @@ -96,7 +96,7 @@ #define NAPTIME 1 #define REAL_TIME "1" #define NO_FORK "0" -#define USAGE "Usage: sched_tc6 [-l log] [-t type] [-p priority] [-f] [-v] [-d]\n" \ +#define USAGE "Usage: %s [-l log] [-t type] [-p priority] [-f] [-v] [-d]\n" \ " -l log log file \n" \ " -t type priority type 'variable' or 'fixed' \n" \ " -p priority priority value \n" \ @@ -341,7 +341,7 @@ { int bytes_read; int loop_count; - int total_bytes; + long total_bytes; off_t lseek(); off_t file_offset = 0; int whence = 0; diff -aur ltp-20020807.orig/testcases/kernel/syscalls/chroot/chroot04.c ltp-20020807/testcases/kernel/syscalls/chroot/chroot04.c --- ltp-20020807.orig/testcases/kernel/syscalls/chroot/chroot04.c Thu Apr 25 08:38:20 2002 +++ ltp-20020807/testcases/kernel/syscalls/chroot/chroot04.c Fri Aug 23 11:02:00 2002 @@ -125,7 +125,7 @@ tst_brkm(TBROK, cleanup, "Couldn't get current directory name"); } - sprintf(test_dir, "%s.%d\0", cur_dir, getpid()); + sprintf(test_dir, "%s.%d", cur_dir, getpid()); /* * create a temporary directory diff -aur ltp-20020807.orig/testcases/kernel/syscalls/fchdir/fchdir03.c ltp-20020807/testcases/kernel/syscalls/fchdir/fchdir03.c --- ltp-20020807.orig/testcases/kernel/syscalls/fchdir/fchdir03.c Thu Apr 25 08:29:56 2002 +++ ltp-20020807/testcases/kernel/syscalls/fchdir/fchdir03.c Fri Aug 23 11:02:00 2002 @@ -192,7 +192,7 @@ tst_brkm(TBROK, cleanup, "Couldn't get current directory name"); } - sprintf(good_dir, "%s.%d\0", cur_dir, getpid()); + sprintf(good_dir, "%s.%d", cur_dir, getpid()); ltpuser1 = my_getpwnam(user1name); } diff -aur ltp-20020807.orig/testcases/kernel/syscalls/lchown/create_link.c ltp-20020807/testcases/kernel/syscalls/lchown/create_link.c --- ltp-20020807.orig/testcases/kernel/syscalls/lchown/create_link.c Tue Sep 18 13:38:40 2001 +++ ltp-20020807/testcases/kernel/syscalls/lchown/create_link.c Fri Aug 23 11:02:00 2002 @@ -33,6 +33,7 @@ #include <pwd.h> #include <grp.h> #include <errno.h> +#include <string.h> #define LTPUSER "bin" #define LTPGRP "bin" diff -aur ltp-20020807.orig/testcases/kernel/syscalls/mkdir/mkdir03.c ltp-20020807/testcases/kernel/syscalls/mkdir/mkdir03.c --- ltp-20020807.orig/testcases/kernel/syscalls/mkdir/mkdir03.c Tue Jul 23 06:11:18 2002 +++ ltp-20020807/testcases/kernel/syscalls/mkdir/mkdir03.c Fri Aug 23 11:02:00 2002 @@ -216,7 +216,7 @@ struct stat statbuf; /* Initialize the test directory name */ - sprintf(tstdir, "tstdir4.d", getpid()); + sprintf(tstdir, "tstdir4.%d", getpid()); sprintf(tstdir4, "%s/tst", tstdir); /* sprintf(tstdir4, "%s/tst", tstdir4); diff -aur ltp-20020807.orig/testcases/kernel/syscalls/pread/pread03.c ltp-20020807/testcases/kernel/syscalls/pread/pread03.c --- ltp-20020807.orig/testcases/kernel/syscalls/pread/pread03.c Wed Jun 12 10:38:50 2002 +++ ltp-20020807/testcases/kernel/syscalls/pread/pread03.c Fri Aug 23 11:02:00 2002 @@ -174,7 +174,7 @@ tst_brkm(TBROK, cleanup, "Couldn't get current directory name"); } - sprintf(test_dir, "%s.%d\0", cur_dir, getpid()); + sprintf(test_dir, "%s.%d", cur_dir, getpid()); /* * create a temporary directory diff -aur ltp-20020807.orig/testcases/kernel/syscalls/sysinfo/sysinfo01.c ltp-20020807/testcases/kernel/syscalls/sysinfo/sysinfo01.c --- ltp-20020807.orig/testcases/kernel/syscalls/sysinfo/sysinfo01.c Mon Aug 27 15:15:15 2001 +++ ltp-20020807/testcases/kernel/syscalls/sysinfo/sysinfo01.c Fri Aug 23 11:02:00 2002 @@ -138,9 +138,9 @@ printf("load1 %lu\n", sys_buf->loads[0]); printf("load2 %lu\n", sys_buf->loads[1]); printf("load3 %lu\n", sys_buf->loads[2]); - printf("l1 %d\n", l1_up); - printf("l2 %d\n", l2_up); - printf("l3 %d\n", l3_up); + printf("l1 %lu\n", l1_up); + printf("l2 %lu\n", l2_up); + printf("l3 %lu\n", l3_up); printf("totalram %lu\n", sys_buf->totalram); printf("freeram %lu\n", sys_buf->freeram); printf("sharedram %lu\n", sys_buf->sharedram); @@ -148,7 +148,7 @@ printf("totalswap %lu\n", sys_buf->totalswap/(1024*1024)); printf("freeswap %lu\n", sys_buf->freeswap); - printf("procs %lu\n", sys_buf->procs); + printf("procs %lu\n", (unsigned long)sys_buf->procs); } else { tst_resm(TPASS, "Test to check the return code", |