From: Subrata <sub...@us...> - 2009-03-23 14:45:19
|
Update of /cvsroot/ltp/ltp/testcases/kernel/syscalls/getsid In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14647/ltp/testcases/kernel/syscalls/getsid Modified Files: getsid01.c getsid02.c Log Message: Coding Syle Cleanups. Signed-Off-By: <mic...@pe...>. Index: getsid02.c =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/getsid/getsid02.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** getsid02.c 26 Feb 2009 12:15:43 -0000 1.15 --- getsid02.c 23 Mar 2009 13:35:45 -0000 1.16 *************** *** 73,77 **** #ifdef _LTP_TASKS_H ! #include <linux/tasks.h> /* for PID_MAX - old */ #endif --- 73,77 ---- #ifdef _LTP_TASKS_H ! #include <linux/tasks.h> /* for PID_MAX - old */ #endif *************** *** 83,108 **** #endif - void cleanup(void); void setup(void); ! char *TCID= "getsid02"; int TST_TOTAL = 1; extern int Tst_count; ! int pid_max=32768; /* Default value for PID_MAX */ ! int exp_enos[] = {ESRCH, 0}; /* 0 terminated list of expected errnos */ int main(int ac, char **av) { ! int lc; /* loop counter */ ! char *msg; /* message returned from parse_opts */ /* parse standard options */ ! if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); } ! setup(); /* global setup */ /* The following loop checks looping state if -i option given */ --- 83,107 ---- #endif void cleanup(void); void setup(void); ! char *TCID = "getsid02"; int TST_TOTAL = 1; extern int Tst_count; ! int pid_max = 32768; /* Default value for PID_MAX */ ! int exp_enos[] = { ESRCH, 0 }; /* 0 terminated list of expected errnos */ int main(int ac, char **av) { ! int lc; /* loop counter */ ! char *msg; /* message returned from parse_opts */ /* parse standard options */ ! if ((msg = parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *)NULL) { tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); } ! setup(); /* global setup */ /* The following loop checks looping state if -i option given */ *************** *** 118,122 **** TEST(getsid(pid_max + 1)); ! if (TEST_RETURN == 0) { tst_resm(TFAIL, "call succeed when failure expected"); continue; --- 117,121 ---- TEST(getsid(pid_max + 1)); ! if (TEST_RETURN == 0) { tst_resm(TFAIL, "call succeed when failure expected"); continue; *************** *** 140,145 **** cleanup(); ! /*NOTREACHED*/ ! return 0; } --- 139,143 ---- cleanup(); ! /*NOTREACHED*/ return 0; } *************** *** 147,172 **** * setup() - performs all the ONE TIME setup for this test. */ ! void ! setup(void) { #if !defined PID_MAX_DEFAULT && !defined PID_MAX ! FILE *fp; #endif #ifdef PID_MAX_DEFAULT ! pid_max = PID_MAX_DEFAULT; #elif defined(PID_MAX) ! pid_max = PID_MAX; #else ! if((fp = fopen("/proc/sys/kernel/pid_max", "r")) != NULL) ! { ! fscanf(fp,"%d",&pid_max); ! fclose(fp); ! } ! else ! { ! tst_resm(TFAIL, "Cannot open /proc/sys/kernel/pid_max"); ! exit(0); } #endif --- 145,166 ---- * setup() - performs all the ONE TIME setup for this test. */ ! void setup(void) { #if !defined PID_MAX_DEFAULT && !defined PID_MAX ! FILE *fp; #endif #ifdef PID_MAX_DEFAULT ! pid_max = PID_MAX_DEFAULT; #elif defined(PID_MAX) ! pid_max = PID_MAX; #else ! if ((fp = fopen("/proc/sys/kernel/pid_max", "r")) != NULL) { ! fscanf(fp, "%d", &pid_max); ! fclose(fp); ! } else { ! tst_resm(TFAIL, "Cannot open /proc/sys/kernel/pid_max"); ! exit(0); } #endif *************** *** 185,190 **** * or premature exit. */ ! void ! cleanup(void) { /* --- 179,183 ---- * or premature exit. */ ! void cleanup(void) { /* *************** *** 197,199 **** tst_exit(); } - --- 190,191 ---- Index: getsid01.c =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/getsid/getsid01.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** getsid01.c 26 Feb 2009 12:15:43 -0000 1.5 --- getsid01.c 23 Mar 2009 13:35:45 -0000 1.6 *************** *** 67,71 **** void setup(void); ! char *TCID= "getsid01"; int TST_TOTAL = 1; extern int Tst_count; --- 67,71 ---- void setup(void); ! char *TCID = "getsid01"; int TST_TOTAL = 1; extern int Tst_count; *************** *** 75,88 **** int main(int ac, char **av) { ! int lc; /* loop counter */ ! char *msg; /* message returned from parse_opts */ pid_t pid, c_pid, c_sid; /* parse standard options */ ! if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){ tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); } ! setup(); /* global setup */ /* The following loop checks looping state if -i option given */ --- 75,88 ---- int main(int ac, char **av) { ! int lc; /* loop counter */ ! char *msg; /* message returned from parse_opts */ pid_t pid, c_pid, c_sid; /* parse standard options */ ! if ((msg = parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *)NULL) { tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); } ! setup(); /* global setup */ /* The following loop checks looping state if -i option given */ *************** *** 111,115 **** } ! if (pid == 0) { /* child */ if ((c_pid = getpid()) == -1) { tst_resm(TINFO, "getpid failed in " --- 111,115 ---- } ! if (pid == 0) { /* child */ if ((c_pid = getpid()) == -1) { tst_resm(TINFO, "getpid failed in " *************** *** 148,153 **** cleanup(); ! /*NOTREACHED*/ ! return 0; } --- 148,152 ---- cleanup(); ! /*NOTREACHED*/ return 0; } *************** *** 155,160 **** * setup() - performs all the ONE TIME setup for this test. */ ! void ! setup(void) { /* capture signals */ --- 154,158 ---- * setup() - performs all the ONE TIME setup for this test. */ ! void setup(void) { /* capture signals */ *************** *** 169,174 **** * or premature exit. */ ! void ! cleanup(void) { /* --- 167,171 ---- * or premature exit. */ ! void cleanup(void) { /* *************** *** 181,183 **** tst_exit(); } - --- 178,179 ---- |