aboutsummaryrefslogtreecommitdiff
path: root/testcases/open_posix_testsuite/stress
diff options
context:
space:
mode:
authorGarrett Cooper <yanegomi@gmail.com>2010-11-23 22:58:51 -0800
committerGarrett Cooper <yanegomi@gmail.com>2010-11-23 22:58:51 -0800
commita1262411bc2cc97541830aa543ac6f7c9cffc074 (patch)
treeaf1228c4c088f20cb319ba46687270ca8c2311ed /testcases/open_posix_testsuite/stress
parent1964f86b4b5548fa8ae720cad4135cb1b004640d (diff)
parente9f9b888e4a3c08e654759d9dd3345f91c996226 (diff)
downloadltp-a1262411bc2cc97541830aa543ac6f7c9cffc074.tar.gz
Merge remote branch 'origin' into ltp-broom
Conflicts: testcases/kernel/syscalls/lchown/lchown01.c testcases/kernel/syscalls/lchown/lchown02.c testcases/mce-test/tsrc/tinjpage.c testcases/open_posix_testsuite/conformance/interfaces/aio_cancel/5-1.c testcases/open_posix_testsuite/conformance/interfaces/clock_settime/1-1.c testcases/open_posix_testsuite/conformance/interfaces/clock_settime/5-1.c testcases/open_posix_testsuite/conformance/interfaces/clock_settime/5-2.c testcases/open_posix_testsuite/conformance/interfaces/fork/11-1.c testcases/open_posix_testsuite/conformance/interfaces/fork/12-1.c testcases/open_posix_testsuite/conformance/interfaces/fork/13-1.c testcases/open_posix_testsuite/conformance/interfaces/fork/14-1.c testcases/open_posix_testsuite/conformance/interfaces/fork/16-1.c testcases/open_posix_testsuite/conformance/interfaces/fork/17-1.c testcases/open_posix_testsuite/conformance/interfaces/fork/17-2.c testcases/open_posix_testsuite/conformance/interfaces/fork/18-1.c testcases/open_posix_testsuite/conformance/interfaces/fork/19-1.c testcases/open_posix_testsuite/conformance/interfaces/fork/2-1.c testcases/open_posix_testsuite/conformance/interfaces/fork/21-1.c testcases/open_posix_testsuite/conformance/interfaces/fork/22-1.c testcases/open_posix_testsuite/conformance/interfaces/fork/6-1.c testcases/open_posix_testsuite/conformance/interfaces/fork/7-1.c testcases/open_posix_testsuite/conformance/interfaces/fork/8-1.c testcases/open_posix_testsuite/conformance/interfaces/fork/9-1.c testcases/open_posix_testsuite/conformance/interfaces/mlock/10-1.c testcases/open_posix_testsuite/conformance/interfaces/mlock/12-1.c testcases/open_posix_testsuite/conformance/interfaces/mlock/5-1.c testcases/open_posix_testsuite/conformance/interfaces/mlock/speculative/12-1.c testcases/open_posix_testsuite/conformance/interfaces/mlockall/15-1.c testcases/open_posix_testsuite/conformance/interfaces/mlockall/3-6.c testcases/open_posix_testsuite/conformance/interfaces/mlockall/3-7.c testcases/open_posix_testsuite/conformance/interfaces/mlockall/8-1.c testcases/open_posix_testsuite/conformance/interfaces/mlockall/speculative/15-1.c testcases/open_posix_testsuite/conformance/interfaces/mmap/18-1.c testcases/open_posix_testsuite/conformance/interfaces/munlock/11-1.c testcases/open_posix_testsuite/conformance/interfaces/munlock/7-1.c testcases/open_posix_testsuite/conformance/interfaces/munlockall/5-1.c testcases/open_posix_testsuite/conformance/interfaces/nanosleep/2-1.c testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/1-2.c testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/2-2.c testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/3-2.c testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/3-3.c testcases/open_posix_testsuite/conformance/interfaces/pthread_atfork/4-1.c testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setschedparam/1-4.c testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/5-2.c testcases/open_posix_testsuite/conformance/interfaces/pthread_create/8-1.c testcases/open_posix_testsuite/conformance/interfaces/pthread_getschedparam/1-3.c testcases/open_posix_testsuite/conformance/interfaces/pthread_getschedparam/4-1.c testcases/open_posix_testsuite/conformance/interfaces/pthread_join/1-2.c testcases/open_posix_testsuite/conformance/interfaces/pthread_join/6-3.c testcases/open_posix_testsuite/conformance/interfaces/pthread_join/threads_scenarii.c testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/1-2.c testcases/open_posix_testsuite/conformance/interfaces/pthread_kill/8-1.c testcases/open_posix_testsuite/conformance/interfaces/pthread_setschedparam/1-2.c testcases/open_posix_testsuite/conformance/interfaces/pthread_setschedparam/5-1.c testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/18-1.c testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/5-1.c testcases/open_posix_testsuite/conformance/interfaces/pthread_sigmask/7-1.c testcases/open_posix_testsuite/conformance/interfaces/pthread_spin_lock/1-1.c testcases/open_posix_testsuite/conformance/interfaces/raise/2-1.c testcases/open_posix_testsuite/conformance/interfaces/sched_getparam/4-1.c testcases/open_posix_testsuite/conformance/interfaces/sched_getparam/6-1.c testcases/open_posix_testsuite/conformance/interfaces/sched_getscheduler/3-1.c testcases/open_posix_testsuite/conformance/interfaces/sched_getscheduler/5-1.c testcases/open_posix_testsuite/conformance/interfaces/sched_getscheduler/7-1.c testcases/open_posix_testsuite/conformance/interfaces/sched_rr_get_interval/3-1.c testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/1-1.c testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/10-1.c testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/2-1.c testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/2-2.c testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/20-1.c testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/21-1.c testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/21-2.c testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/23-1.c testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/23-2.c testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/23-3.c testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/23-4.c testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/23-5.c testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/23-6.c testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/23-7.c testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/25-1.c testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/25-2.c testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/25-3.c testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/25-4.c testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/26-1.c testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/27-1.c testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/5-1.c testcases/open_posix_testsuite/conformance/interfaces/sched_setparam/9-1.c testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/1-1.c testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/15-1.c testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/15-2.c testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/16-1.c testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/17-1.c testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/17-2.c testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/17-6.c testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/17-7.c testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/19-1.c testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/19-2.c testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/19-3.c testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/19-4.c testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/19-5.c testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/20-1.c testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/21-1.c testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/22-1.c testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/22-2.c testcases/open_posix_testsuite/conformance/interfaces/sched_setscheduler/4-1.c testcases/open_posix_testsuite/conformance/interfaces/sched_yield/1-1.c testcases/open_posix_testsuite/conformance/interfaces/sem_close/3-2.c testcases/open_posix_testsuite/conformance/interfaces/sem_destroy/3-1.c testcases/open_posix_testsuite/conformance/interfaces/sem_init/3-2.c testcases/open_posix_testsuite/conformance/interfaces/sem_init/3-3.c testcases/open_posix_testsuite/conformance/interfaces/sem_init/7-1.c testcases/open_posix_testsuite/conformance/interfaces/sem_open/2-1.c testcases/open_posix_testsuite/conformance/interfaces/sem_open/3-1.c testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/1-1.c testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/11-1.c testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/6-1.c testcases/open_posix_testsuite/conformance/interfaces/sem_timedwait/6-2.c testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/2-2.c testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/3-1.c testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/6-1.c testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/7-1.c testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/9-1.c testcases/open_posix_testsuite/conformance/interfaces/sem_wait/13-1.c testcases/open_posix_testsuite/conformance/interfaces/sem_wait/5-1.c testcases/open_posix_testsuite/conformance/interfaces/shm_open/11-1.c testcases/open_posix_testsuite/conformance/interfaces/shm_open/13-1.c testcases/open_posix_testsuite/conformance/interfaces/shm_open/16-1.c testcases/open_posix_testsuite/conformance/interfaces/shm_open/17-1.c testcases/open_posix_testsuite/conformance/interfaces/shm_open/18-1.c testcases/open_posix_testsuite/conformance/interfaces/shm_open/20-1.c testcases/open_posix_testsuite/conformance/interfaces/shm_open/20-2.c testcases/open_posix_testsuite/conformance/interfaces/shm_open/20-3.c testcases/open_posix_testsuite/conformance/interfaces/shm_open/23-1.c testcases/open_posix_testsuite/conformance/interfaces/shm_open/26-2.c testcases/open_posix_testsuite/conformance/interfaces/shm_open/32-1.c testcases/open_posix_testsuite/conformance/interfaces/shm_open/34-1.c testcases/open_posix_testsuite/conformance/interfaces/shm_unlink/8-1.c testcases/open_posix_testsuite/conformance/interfaces/shm_unlink/9-1.c testcases/open_posix_testsuite/conformance/interfaces/sigaction/28-1.c testcases/open_posix_testsuite/conformance/interfaces/sigaction/28-10.c testcases/open_posix_testsuite/conformance/interfaces/sigaction/28-11.c testcases/open_posix_testsuite/conformance/interfaces/sigaction/28-12.c testcases/open_posix_testsuite/conformance/interfaces/sigaction/28-13.c testcases/open_posix_testsuite/conformance/interfaces/sigaction/28-14.c testcases/open_posix_testsuite/conformance/interfaces/sigaction/28-15.c testcases/open_posix_testsuite/conformance/interfaces/sigaction/28-16.c testcases/open_posix_testsuite/conformance/interfaces/sigaction/28-17.c testcases/open_posix_testsuite/conformance/interfaces/sigaction/28-18.c testcases/open_posix_testsuite/conformance/interfaces/sigaction/28-19.c testcases/open_posix_testsuite/conformance/interfaces/sigaction/28-2.c testcases/open_posix_testsuite/conformance/interfaces/sigaction/28-20.c testcases/open_posix_testsuite/conformance/interfaces/sigaction/28-21.c testcases/open_posix_testsuite/conformance/interfaces/sigaction/28-22.c testcases/open_posix_testsuite/conformance/interfaces/sigaction/28-23.c testcases/open_posix_testsuite/conformance/interfaces/sigaction/28-24.c testcases/open_posix_testsuite/conformance/interfaces/sigaction/28-25.c testcases/open_posix_testsuite/conformance/interfaces/sigaction/28-26.c testcases/open_posix_testsuite/conformance/interfaces/sigaction/28-3.c testcases/open_posix_testsuite/conformance/interfaces/sigaction/28-4.c testcases/open_posix_testsuite/conformance/interfaces/sigaction/28-5.c testcases/open_posix_testsuite/conformance/interfaces/sigaction/28-6.c testcases/open_posix_testsuite/conformance/interfaces/sigaction/28-7.c testcases/open_posix_testsuite/conformance/interfaces/sigaction/28-8.c testcases/open_posix_testsuite/conformance/interfaces/sigaction/28-9.c testcases/open_posix_testsuite/conformance/interfaces/sigpending/1-3.c testcases/open_posix_testsuite/conformance/interfaces/sigqueue/12-1.c testcases/open_posix_testsuite/conformance/interfaces/sigqueue/3-1.c testcases/open_posix_testsuite/conformance/interfaces/sigwait/1-1.c testcases/open_posix_testsuite/conformance/interfaces/sigwait/2-1.c testcases/open_posix_testsuite/conformance/interfaces/sigwait/3-1.c testcases/open_posix_testsuite/conformance/interfaces/sigwait/4-1.c testcases/open_posix_testsuite/conformance/interfaces/sigwait/6-2.c testcases/open_posix_testsuite/conformance/interfaces/sigwait/8-1.c testcases/open_posix_testsuite/conformance/interfaces/timer_gettime/1-4.c testcases/open_posix_testsuite/conformance/interfaces/timer_gettime/2-1.c testcases/open_posix_testsuite/conformance/interfaces/timer_gettime/2-2.c testcases/open_posix_testsuite/functional/semaphores/sem_lock.c testcases/open_posix_testsuite/functional/threads/pi_test/pitest-5.c testcases/open_posix_testsuite/functional/timers/clocks/invaliddates.c testcases/open_posix_testsuite/functional/timers/clocks/twopsetclock.c testcases/open_posix_testsuite/functional/timers/timers/twoevtimers.c testcases/open_posix_testsuite/stress/mqueues/multi_send_rev_1.c testcases/open_posix_testsuite/stress/mqueues/multi_send_rev_2.c testcases/open_posix_testsuite/stress/semaphores/multi_con_pro.c testcases/open_posix_testsuite/stress/threads/fork/s-c1.c testcases/open_posix_testsuite/stress/threads/pthread_cancel/stress.c testcases/open_posix_testsuite/stress/threads/pthread_getschedparam/stress.c testcases/open_posix_testsuite/stress/threads/pthread_kill/stress.c testcases/open_posix_testsuite/stress/threads/pthread_once/stress.c testcases/open_posix_testsuite/stress/threads/sem_getvalue/stress.c testcases/open_posix_testsuite/stress/threads/sem_init/s-c1.c testcases/open_posix_testsuite/stress/threads/sem_open/s-c1.c
Diffstat (limited to 'testcases/open_posix_testsuite/stress')
-rw-r--r--testcases/open_posix_testsuite/stress/mqueues/multi_send_rev_1.c2
-rw-r--r--testcases/open_posix_testsuite/stress/mqueues/multi_send_rev_2.c4
-rw-r--r--testcases/open_posix_testsuite/stress/semaphores/multi_con_pro.c2
-rw-r--r--testcases/open_posix_testsuite/stress/threads/fork/s-c1.c263
-rw-r--r--testcases/open_posix_testsuite/stress/threads/fork/testfrmw.c4
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_cancel/stress.c66
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_cancel/testfrmw.c4
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_cond_init/testfrmw.c4
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/s-c.c38
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/stress1.c10
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/stress2.c8
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/testfrmw.c4
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/stress.c8
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/stress1.c10
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/stress2.c8
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/testfrmw.c4
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_create/s-c1.c34
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_create/testfrmw.c4
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_create/threads_scenarii.c66
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_exit/testfrmw.c4
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_exit/threads_scenarii.c66
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_getschedparam/stress.c98
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_getschedparam/testfrmw.c4
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_kill/stress.c119
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_kill/testfrmw.c4
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_mutex_init/testfrmw.c4
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_mutex_lock/testfrmw.c4
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_mutex_trylock/testfrmw.c4
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_once/stress.c68
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_once/testfrmw.c4
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_self/testfrmw.c4
-rw-r--r--testcases/open_posix_testsuite/stress/threads/pthread_self/threads_scenarii.c138
-rw-r--r--testcases/open_posix_testsuite/stress/threads/sem_getvalue/stress.c108
-rw-r--r--testcases/open_posix_testsuite/stress/threads/sem_getvalue/testfrmw.c4
-rw-r--r--testcases/open_posix_testsuite/stress/threads/sem_init/s-c1.c268
-rw-r--r--testcases/open_posix_testsuite/stress/threads/sem_init/testfrmw.c4
-rw-r--r--testcases/open_posix_testsuite/stress/threads/sem_open/s-c1.c271
-rw-r--r--testcases/open_posix_testsuite/stress/threads/sem_open/testfrmw.c4
38 files changed, 862 insertions, 861 deletions
diff --git a/testcases/open_posix_testsuite/stress/mqueues/multi_send_rev_1.c b/testcases/open_posix_testsuite/stress/mqueues/multi_send_rev_1.c
index bc965d69d..4d68aff71 100644
--- a/testcases/open_posix_testsuite/stress/mqueues/multi_send_rev_1.c
+++ b/testcases/open_posix_testsuite/stress/mqueues/multi_send_rev_1.c
@@ -88,7 +88,7 @@ int main(int argc, char *argv[])
printf("_POSIX_MESSAGE_PASSING is not defined \n");
return PTS_UNRESOLVED;
#endif */
- if ((2 != argc) || (( num = atoi(argv[1])) <= 0)) {
+ if ((2 != argc) || ((num = atoi(argv[1])) <= 0)) {
fprintf(stderr, "Usage: %s number_of_threads\n", argv[0]);
return PTS_FAIL;
}
diff --git a/testcases/open_posix_testsuite/stress/mqueues/multi_send_rev_2.c b/testcases/open_posix_testsuite/stress/mqueues/multi_send_rev_2.c
index 98c1c3bd4..a4733b7aa 100644
--- a/testcases/open_posix_testsuite/stress/mqueues/multi_send_rev_2.c
+++ b/testcases/open_posix_testsuite/stress/mqueues/multi_send_rev_2.c
@@ -50,7 +50,7 @@ int *send(void * ID)
pthread_exit((void *)0);
}
-int *receive(void * ID )
+int *receive(void * ID)
{
int i;
int ThreadID = *(int *)ID;
@@ -79,7 +79,7 @@ int main(int argc, char *argv[])
printf("_POSIX_MESSAGE_PASSING is not defined \n");
return PTS_UNRESOLVED;
#endif */
- if ((2 != argc) || (( num = atoi(argv[1])) <= 0)) {
+ if ((2 != argc) || ((num = atoi(argv[1])) <= 0)) {
fprintf(stderr, "Usage: %s number_of_threads\n", argv[0]);
return PTS_FAIL;
}
diff --git a/testcases/open_posix_testsuite/stress/semaphores/multi_con_pro.c b/testcases/open_posix_testsuite/stress/semaphores/multi_con_pro.c
index 4984ec677..05b15cbe9 100644
--- a/testcases/open_posix_testsuite/stress/semaphores/multi_con_pro.c
+++ b/testcases/open_posix_testsuite/stress/semaphores/multi_con_pro.c
@@ -158,7 +158,7 @@ int main(int argc, char *argv[])
buf = (buf_t *)malloc(sizeof(buf_t));
- if ((2 != argc) || (( num = atoi(argv[1])) <= 0)) {
+ if ((2 != argc) || ((num = atoi(argv[1])) <= 0)) {
fprintf(stderr, "Usage: %s number_of_threads\n", argv[0]);
return PTS_FAIL;
}
diff --git a/testcases/open_posix_testsuite/stress/threads/fork/s-c1.c b/testcases/open_posix_testsuite/stress/threads/fork/s-c1.c
index 9eeeb7a36..132e7a894 100644
--- a/testcases/open_posix_testsuite/stress/threads/fork/s-c1.c
+++ b/testcases/open_posix_testsuite/stress/threads/fork/s-c1.c
@@ -109,14 +109,14 @@ typedef struct __mes_t
mes_t;
/* Forward declaration */
-int parse_measure( mes_t * measures );
+int parse_measure(mes_t * measures);
sem_t *sem_synchro;
sem_t *sem_ending;
-int main ( int argc, char *argv[] )
+int main (int argc, char *argv[])
{
int ret, status;
pid_t pidctl;
@@ -129,7 +129,7 @@ int main ( int argc, char *argv[] )
mes_t sentinel;
mes_t *m_cur, *m_tmp;
- long CHILD_MAX = sysconf( _SC_CHILD_MAX );
+ long CHILD_MAX = sysconf(_SC_CHILD_MAX);
long my_max = 1000 * SCALABILITY_FACTOR ;
/* Initialize the measure list */
@@ -142,41 +142,41 @@ int main ( int argc, char *argv[] )
if (CHILD_MAX > 0)
my_max = CHILD_MAX;
- pr = ( pid_t * ) calloc( 1 + my_max, sizeof( pid_t ) );
+ pr = (pid_t *) calloc(1 + my_max, sizeof(pid_t));
if (pr == NULL)
{
- UNRESOLVED( errno, "Not enough memory for process IDs storage" );
+ UNRESOLVED(errno, "Not enough memory for process IDs storage");
}
#if VERBOSE > 1
- output( "CHILD_MAX: %d\n", CHILD_MAX );
+ output("CHILD_MAX: %d\n", CHILD_MAX);
#endif
#ifdef PLOT_OUTPUT
- output( "# COLUMNS 2 #Process Duration\n" );
+ output("# COLUMNS 2 #Process Duration\n");
#endif
/* Initilaize the semaphores */
- sem_synchro = sem_open( "/fork_scal_sync", O_CREAT, O_RDWR, 0 );
+ sem_synchro = sem_open("/fork_scal_sync", O_CREAT, O_RDWR, 0);
if (sem_synchro == SEM_FAILED)
{
- UNRESOLVED( errno, "Failed to open a named semaphore\n" );
+ UNRESOLVED(errno, "Failed to open a named semaphore\n");
}
- sem_unlink( "/fork_scal_sync" );
+ sem_unlink("/fork_scal_sync");
- sem_ending = sem_open( "/fork_scal_end", O_CREAT, O_RDWR, 0 );
+ sem_ending = sem_open("/fork_scal_end", O_CREAT, O_RDWR, 0);
if (sem_ending == SEM_FAILED)
{
- UNRESOLVED( errno, "Failed to open a named semaphore\n" );
+ UNRESOLVED(errno, "Failed to open a named semaphore\n");
}
- sem_unlink( "/fork_scal_end" );
+ sem_unlink("/fork_scal_end");
nprocesses = 0;
m_cur = &sentinel;
@@ -184,83 +184,78 @@ int main ( int argc, char *argv[] )
while (1) /* we will break */
{
/* read clock */
- ret = clock_gettime( CLOCK_REALTIME, &ts_ref );
+ ret = clock_gettime(CLOCK_REALTIME, &ts_ref);
if (ret != 0)
{
- UNRESOLVED( errno, "Unable to read clock" );
+ UNRESOLVED(errno, "Unable to read clock");
}
/* create a new child */
pr[ nprocesses ] = fork();
- if (pr[ nprocesses ] == ( pid_t ) - 1)
+ if (pr[nprocesses] == -1)
{
- if (( errno == EAGAIN ) || ( errno == ENOMEM ))
- {
+ if ((errno == EAGAIN) || (errno == ENOMEM)) {
break;
- }
- else
- {
- output( "Fork returned the unexpected error %d\n", errno );
+ } else {
+ output("Fork returned the unexpected error %d\n", errno);
/* Post the semaphore so running processes will terminate */
- do
- {
- ret = sem_post( sem_ending );
- }
- while (( ret != 0 ) && ( errno == EINTR ));
+ do {
+ ret = sem_post(sem_ending);
+ } while (( ret != 0 ) && ( errno == EINTR ));
if (ret != 0)
output( "Failed to post the semaphore on termination: error %d\n", errno );
+=======
+ while ((ret != 0) && (errno == EINTR));
+
+ if (ret != 0)
+ output("Failed to post the semaphore on termination: error %d\n", errno);
+>>>>>>> origin
- FAILED( "Failed to fork and received an unexpected error" );
+ FAILED("Failed to fork and received an unexpected error");
}
}
- if (pr[ nprocesses ] == 0)
- {
+ if (pr[nprocesses] == 0) {
/* Child */
/* Post the synchro semaphore*/
- do
- {
- ret = sem_post( sem_synchro );
- }
- while (( ret != 0 ) && ( errno == EINTR ));
+ do {
+ ret = sem_post(sem_synchro);
+ } while ((ret != 0) && (errno == EINTR));
if (ret != 0)
{
/* In this case the test will hang... */
- UNRESOLVED( errno, "Failed post the sync semaphore" );
+ UNRESOLVED(errno, "Failed post the sync semaphore");
}
/* Wait the end semaphore */
- do
- {
- ret = sem_wait( sem_ending );
- }
- while (( ret != 0 ) && ( errno == EINTR ));
+ do {
+ ret = sem_wait(sem_ending);
+ } while ((ret != 0) && (errno == EINTR));
if (ret != 0)
{
- UNRESOLVED( errno, "Failed wait for the end semaphore" );
+ UNRESOLVED(errno, "Failed wait for the end semaphore");
}
/* Cascade-post the end semaphore */
do
{
- ret = sem_post( sem_ending );
- }
- while (( ret != 0 ) && ( errno == EINTR ));
+ ret = sem_post(sem_ending);
+ } while ((ret != 0) && (errno == EINTR));
if (ret != 0)
{
- UNRESOLVED( errno, "Failed post the end semaphore" );
+ UNRESOLVED(errno, "Failed post the end semaphore");
}
/* Exit */
- exit( PTS_PASS );
+ exit(PTS_PASS);
}
/* Parent */
@@ -274,7 +269,7 @@ int main ( int argc, char *argv[] )
if (CHILD_MAX > 0)
{
#if VERBOSE > 0
- output( "WARNING! We were able to create more than CHILD_MAX processes\n" );
+ output("WARNING! We were able to create more than CHILD_MAX processes\n");
#endif
}
@@ -283,36 +278,34 @@ int main ( int argc, char *argv[] )
}
/* wait for the semaphore */
- do
- {
- ret = sem_wait( sem_synchro );
- }
- while (( ret == -1 ) && ( errno == EINTR ));
+ do {
+ ret = sem_wait(sem_synchro);
+ } while ((ret == -1) && (errno == EINTR));
if (ret == -1)
{
- sem_post( sem_ending );
- UNRESOLVED( errno, "Failed to wait for the sync semaphore" );
+ sem_post(sem_ending);
+ UNRESOLVED(errno, "Failed to wait for the sync semaphore");
}
/* read clock */
- ret = clock_gettime( CLOCK_REALTIME, &ts_fin );
+ ret = clock_gettime(CLOCK_REALTIME, &ts_fin);
if (ret != 0)
{
- UNRESOLVED( errno, "Unable to read clock" );
+ UNRESOLVED(errno, "Unable to read clock");
}
/* add to the measure list if nprocesses % resolution == 0 */
- if (( ( nprocesses % RESOLUTION ) == 0 ) && ( nprocesses != 0 ))
+ if (((nprocesses % RESOLUTION) == 0) && (nprocesses != 0))
{
/* Create an empty new element */
- m_tmp = ( mes_t * ) malloc( sizeof( mes_t ) );
+ m_tmp = (mes_t *) malloc(sizeof(mes_t));
if (m_tmp == NULL)
{
- sem_post( sem_ending );
- UNRESOLVED( errno, "Unable to alloc memory for measure saving" );
+ sem_post(sem_ending);
+ UNRESOLVED(errno, "Unable to alloc memory for measure saving");
}
m_tmp->nprocess = nprocesses;
@@ -322,10 +315,10 @@ int main ( int argc, char *argv[] )
m_cur = m_cur->next;
- m_cur->_data = ( ( ts_fin.tv_sec - ts_ref.tv_sec ) * 1000000 ) + ( ( ts_fin.tv_nsec - ts_ref.tv_nsec ) / 1000 ) ;
+ m_cur->_data = ((ts_fin.tv_sec - ts_ref.tv_sec) * 1000000) + ((ts_fin.tv_nsec - ts_ref.tv_nsec) / 1000) ;
#if VERBOSE > 5
- output( "Added the following measure: n=%i, v=%li\n", nprocesses, m_cur->_data );
+ output("Added the following measure: n=%i, v=%li\n", nprocesses, m_cur->_data);
#endif
}
@@ -334,9 +327,9 @@ int main ( int argc, char *argv[] )
#if VERBOSE > 3
if (errno)
- output( "Could not create anymore processes. Current count is %i\n", nprocesses );
+ output("Could not create anymore processes. Current count is %i\n", nprocesses);
else
- output( "Should not create anymore processes. Current count is %i\n", nprocesses );
+ output("Should not create anymore processes. Current count is %i\n", nprocesses);
#endif
@@ -344,76 +337,76 @@ int main ( int argc, char *argv[] )
do
{
- ret = sem_post( sem_ending );
+ ret = sem_post(sem_ending);
}
- while (( ret != 0 ) && ( errno == EINTR ));
+ while ((ret != 0) && (errno == EINTR));
if (ret != 0)
{
- UNRESOLVED( errno, "Failed post the end semaphore" );
+ UNRESOLVED(errno, "Failed post the end semaphore");
}
#if VERBOSE > 3
- output( "Waiting children termination\n" );
+ output("Waiting children termination\n");
#endif
for (i = 0; i < nprocesses; i++)
{
- pidctl = waitpid( pr[ i ], &status, 0 );
+ pidctl = waitpid(pr[ i ], &status, 0);
if (pidctl != pr[ i ])
{
- UNRESOLVED( errno, "Waitpid returned the wrong PID" );
+ UNRESOLVED(errno, "Waitpid returned the wrong PID");
}
- if (( !WIFEXITED( status ) ) || ( WEXITSTATUS( status ) != PTS_PASS ))
+ if ((!WIFEXITED(status)) || (WEXITSTATUS(status) != PTS_PASS))
{
- FAILED( "Child exited abnormally" );
+ FAILED("Child exited abnormally");
}
}
/* Free some memory before result parsing */
- free( pr );
+ free(pr);
/* Compute the results */
- ret = parse_measure( &sentinel );
+ ret = parse_measure(&sentinel);
/* Free the resources and output the results */
#if VERBOSE > 5
- output( "Dump : \n" );
+ output("Dump : \n");
- output( " nproc | dur \n" );
+ output(" nproc | dur \n");
#endif
while (sentinel.next != NULL)
{
m_cur = sentinel.next;
#if (VERBOSE > 5) || defined(PLOT_OUTPUT)
- output( "%8.8i %1.1li.%6.6li\n", m_cur->nprocess, m_cur->_data / 1000000, m_cur->_data % 1000000 );
+ output("%8.8i %1.1li.%6.6li\n", m_cur->nprocess, m_cur->_data / 1000000, m_cur->_data % 1000000);
#endif
sentinel.next = m_cur->next;
- free( m_cur );
+ free(m_cur);
}
if (ret != 0)
{
- FAILED( "The function is not scalable, add verbosity for more information" );
+ FAILED("The function is not scalable, add verbosity for more information");
}
#if VERBOSE > 0
- output( "-----\n" );
+ output("-----\n");
- output( "All test data destroyed\n" );
+ output("All test data destroyed\n");
- output( "Test PASSED\n" );
+ output("Test PASSED\n");
#endif
@@ -428,11 +421,11 @@ int main ( int argc, char *argv[] )
* The next function will seek for the better model for each series of measurements.
*
* The tested models are: -- X = # threads; Y = latency
- * -> Y = a; -- Error is r1 = avg( (Y - Yavg)² );
- * -> Y = aX + b; -- Error is r2 = avg( (Y -aX -b)² );
- * -- where a = avg ( (X - Xavg)(Y - Yavg) ) / avg( ( X - Xavg)² )
- * -- Note: We will call _q = sum( (X - Xavg) * (Y - Yavg) );
- * -- and _d = sum( (X - Xavg)² );
+ * -> Y = a; -- Error is r1 = avg((Y - Yavg)²);
+ * -> Y = aX + b; -- Error is r2 = avg((Y -aX -b)²);
+ * -- where a = avg ((X - Xavg)(Y - Yavg)) / avg((X - Xavg)²)
+ * -- Note: We will call _q = sum((X - Xavg) * (Y - Yavg));
+ * -- and _d = sum((X - Xavg)²);
* -- and b = Yavg - a * Xavg
* -> Y = c * X^a;-- Same as previous, but with log(Y) = a log(X) + b; and b = log(c). Error is r3
* -> Y = exp(aX + b); -- log(Y) = aX + b. Error is r4
@@ -453,7 +446,7 @@ struct row
double _lny; /* Value LnY - LnYavg */
};
-int parse_measure( mes_t * measures )
+int parse_measure(mes_t * measures)
{
int ret, r;
@@ -499,7 +492,7 @@ int parse_measure( mes_t * measures )
cur = measures;
#if VERBOSE > 1
- output( "Data analysis starting\n" );
+ output("Data analysis starting\n");
#endif
/* We start with reading the list to find:
@@ -516,10 +509,10 @@ int parse_measure( mes_t * measures )
if (cur->_data != 0)
{
array_max = N;
- Xavg += ( double ) cur->nprocess;
- LnXavg += log( ( double ) cur->nprocess );
- Yavg += ( double ) cur->_data;
- LnYavg += log( ( double ) cur->_data );
+ Xavg += (double) cur->nprocess;
+ LnXavg += log((double) cur->nprocess);
+ Yavg += (double) cur->_data;
+ LnYavg += log((double) cur->_data);
}
}
@@ -533,18 +526,18 @@ int parse_measure( mes_t * measures )
}
#if VERBOSE > 1
- output( " Found %d rows\n", N );
+ output(" Found %d rows\n", N);
#endif
/* We will now alloc the array ... */
- Table = calloc( N, sizeof( struct row ) );
+ Table = calloc(N, sizeof(struct row));
if (Table == NULL)
{
- UNRESOLVED( errno, "Unable to alloc space for results parsing" );
+ UNRESOLVED(errno, "Unable to alloc space for results parsing");
}
/* ... and fill it */
@@ -556,8 +549,8 @@ int parse_measure( mes_t * measures )
{
cur = cur->next;
- Table[ N ].X = ( long ) cur->nprocess;
- Table[ N ].LnX = log( ( double ) cur->nprocess );
+ Table[ N ].X = (long) cur->nprocess;
+ Table[ N ].LnX = log((double) cur->nprocess);
if (array_max > N)
{
@@ -565,7 +558,7 @@ int parse_measure( mes_t * measures )
Table[ N ]._lnx = Table[ N ].LnX - LnXavg;
Table[ N ].Y = cur->_data;
Table[ N ]._y = Table[ N ].Y - Yavg ;
- Table[ N ].LnY = log( ( double ) cur->_data );
+ Table[ N ].LnY = log((double) cur->_data);
Table[ N ]._lny = Table[ N ].LnY - LnYavg;
}
@@ -574,7 +567,7 @@ int parse_measure( mes_t * measures )
/* We won't need the list anymore -- we'll work with the array which should be faster. */
#if VERBOSE > 1
- output( " Data was stored in an array.\n" );
+ output(" Data was stored in an array.\n");
#endif
@@ -585,12 +578,12 @@ int parse_measure( mes_t * measures )
* -> "a" factor for linear (0), power (1) and exponential (2) approximations -- with using the _d and _q vars.
*/
#if VERBOSE > 1
- output( "Starting first pass...\n" );
+ output("Starting first pass...\n");
#endif
for (r = 0; r < array_max; r++)
{
- r1 += ( ( double ) Table[ r ]._y / array_max ) * ( double ) Table[ r ]._y;
+ r1 += ((double) Table[ r ]._y / array_max) * (double) Table[ r ]._y;
_q[ 0 ] += Table[ r ]._y * Table[ r ]._x;
_d[ 0 ] += Table[ r ]._x * Table[ r ]._x;
@@ -609,74 +602,74 @@ int parse_measure( mes_t * measures )
*/
#if VERBOSE > 1
- output( "Starting second pass...\n" );
+ output("Starting second pass...\n");
#endif
for (r = 0; r < array_max; r++)
{
/* r2 = avg((y - ax -b)²); t = (y - ax - b) = (y - yavg) - a (x - xavg); */
- t = ( Table[ r ]._y - ( ( _q[ 0 ] * Table[ r ]._x ) / _d[ 0 ] ) );
+ t = (Table[ r ]._y - ((_q[ 0 ] * Table[ r ]._x) / _d[ 0 ]));
r2 += t * t / array_max ;
- /* r3 = avg(( y - c.x^a) ²);
+ /* r3 = avg((y - c.x^a) ²);
t = y - c * x ^ a
= y - log (LnYavg - (_q[1]/_d[1]) * LnXavg) * x ^ (_q[1]/_d[1])
*/
- t = ( Table[ r ].Y
- - ( logl ( LnYavg - ( _q[ 1 ] / _d[ 1 ] ) * LnXavg )
- * powl( Table[ r ].X, ( _q[ 1 ] / _d[ 1 ] ) )
- ) );
+ t = (Table[ r ].Y
+ - (logl (LnYavg - (_q[ 1 ] / _d[ 1 ]) * LnXavg)
+ * powl(Table[ r ].X, (_q[ 1 ] / _d[ 1 ]))
+ ));
r3 += t * t / array_max ;
- /* r4 = avg(( y - exp(ax+b))²);
+ /* r4 = avg((y - exp(ax+b))²);
t = y - exp(ax+b)
- = y - exp( _q[2]/_d[2] * x + ( LnYavg - (_q[2]/_d[2] * Xavg) ));
- = y - exp( _q[2]/_d[2] * (x - Xavg) + LnYavg );
+ = y - exp(_q[2]/_d[2] * x + (LnYavg - (_q[2]/_d[2] * Xavg)));
+ = y - exp(_q[2]/_d[2] * (x - Xavg) + LnYavg);
*/
- t = ( Table[ r ].Y
- - expl( ( _q[ 2 ] / _d[ 2 ] ) * Table[ r ]._x + LnYavg ) );
+ t = (Table[ r ].Y
+ - expl((_q[ 2 ] / _d[ 2 ]) * Table[ r ]._x + LnYavg));
r4 += t * t / array_max ;
}
#if VERBOSE > 1
- output( "All computing terminated.\n" );
+ output("All computing terminated.\n");
#endif
ret = 0;
#if VERBOSE > 1
- output( " # of data: %i\n", array_max );
+ output(" # of data: %i\n", array_max);
- output( " Model: Y = k\n" );
+ output(" Model: Y = k\n");
- output( " k = %g\n", Yavg );
+ output(" k = %g\n", Yavg);
- output( " Divergence %g\n", r1 );
+ output(" Divergence %g\n", r1);
- output( " Model: Y = a * X + b\n" );
+ output(" Model: Y = a * X + b\n");
- output( " a = %Lg\n", _q[ 0 ] / _d[ 0 ] );
+ output(" a = %Lg\n", _q[ 0 ] / _d[ 0 ]);
- output( " b = %Lg\n", Yavg - ( ( _q[ 0 ] / _d[ 0 ] ) * Xavg ) );
+ output(" b = %Lg\n", Yavg - ((_q[ 0 ] / _d[ 0 ]) * Xavg));
- output( " Divergence %g\n", r2 );
+ output(" Divergence %g\n", r2);
- output( " Model: Y = c * X ^ a\n" );
+ output(" Model: Y = c * X ^ a\n");
- output( " a = %Lg\n", _q[ 1 ] / _d[ 1 ] );
+ output(" a = %Lg\n", _q[ 1 ] / _d[ 1 ]);
- output( " c = %Lg\n", logl ( LnYavg - ( _q[ 1 ] / _d[ 1 ] ) * LnXavg ) );
+ output(" c = %Lg\n", logl (LnYavg - (_q[ 1 ] / _d[ 1 ]) * LnXavg));
- output( " Divergence %g\n", r2 );
+ output(" Divergence %g\n", r2);
- output( " Model: Y = exp(a * X + b)\n" );
+ output(" Model: Y = exp(a * X + b)\n");
- output( " a = %Lg\n", _q[ 2 ] / _d[ 2 ] );
+ output(" a = %Lg\n", _q[ 2 ] / _d[ 2 ]);
- output( " b = %Lg\n", LnYavg - ( ( _q[ 2 ] / _d[ 2 ] ) * Xavg ) );
+ output(" b = %Lg\n", LnYavg - ((_q[ 2 ] / _d[ 2 ]) * Xavg));
- output( " Divergence %g\n", r2 );
+ output(" Divergence %g\n", r2);
#endif
@@ -684,19 +677,19 @@ int parse_measure( mes_t * measures )
{
/* Compare r1 to other values, with some ponderations */
- if (( r1 > 1.1 * r2 ) || ( r1 > 1.2 * r3 ) || ( r1 > 1.3 * r4 ))
+ if ((r1 > 1.1 * r2) || (r1 > 1.2 * r3) || (r1 > 1.3 * r4))
ret++;
#if VERBOSE > 1
else
- output( " Sanction: OK\n" );
+ output(" Sanction: OK\n");
#endif
}
/* We need to free the array */
- free( Table );
+ free(Table);
/* We're done */
return ret;
diff --git a/testcases/open_posix_testsuite/stress/threads/fork/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/fork/testfrmw.c
index 38adaa8d9..d075c0b7c 100644
--- a/testcases/open_posix_testsuite/stress/threads/fork/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/fork/testfrmw.c
@@ -43,7 +43,7 @@ void output_init()
/* do nothing */
return;
}
-void output( char * string, ... )
+void output(char * string, ...)
{
va_list ap;
char *ts="[??:??:??]";
@@ -57,7 +57,7 @@ void output( char * string, ... )
printf(ts);
else
printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec);
- va_start( ap, string);
+ va_start(ap, string);
vprintf(string, ap);
va_end(ap);
pthread_mutex_unlock(&m_trace);
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_cancel/stress.c b/testcases/open_posix_testsuite/stress/threads/pthread_cancel/stress.c
index 96c6716d6..7df068cc3 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_cancel/stress.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_cancel/stress.c
@@ -84,7 +84,7 @@ char do_it = 1;
/* Handler for user request to terminate */
-void sighdl( int sig )
+void sighdl(int sig)
{
do
{
@@ -96,14 +96,14 @@ void sighdl( int sig )
long long canceled, ended;
/* The canceled thread */
-void * th( void * arg )
+void * th(void * arg)
{
int ret = 0;
- ret = pthread_barrier_wait( arg );
+ ret = pthread_barrier_wait(arg);
- if (( ret != 0 ) && ( ret != PTHREAD_BARRIER_SERIAL_THREAD ))
+ if ((ret != 0) && (ret != PTHREAD_BARRIER_SERIAL_THREAD))
{
- UNRESOLVED( ret, "Failed to wait for the barrier" );
+ UNRESOLVED(ret, "Failed to wait for the barrier");
}
return NULL;
@@ -111,42 +111,42 @@ void * th( void * arg )
/* Thread function */
-void * threaded( void * arg )
+void * threaded(void * arg)
{
int ret = 0;
pthread_t child;
/* Initialize the barrier */
- ret = pthread_barrier_init( arg, NULL, 2 );
+ ret = pthread_barrier_init(arg, NULL, 2);
if (ret != 0)
{
- UNRESOLVED( ret, "Failed to initialize a barrier" );
+ UNRESOLVED(ret, "Failed to initialize a barrier");
}
while (do_it)
{
/* Create the thread */
- ret = pthread_create( &child, NULL, th, arg );
+ ret = pthread_create(&child, NULL, th, arg);
if (ret != 0)
{
- UNRESOLVED( ret, "Thread creation failed" );
+ UNRESOLVED(ret, "Thread creation failed");
}
/* Synchronize */
- ret = pthread_barrier_wait( arg );
+ ret = pthread_barrier_wait(arg);
- if (( ret != 0 ) && ( ret != PTHREAD_BARRIER_SERIAL_THREAD ))
+ if ((ret != 0) && (ret != PTHREAD_BARRIER_SERIAL_THREAD))
{
- UNRESOLVED( ret, "Failed to wait for the barrier" );
+ UNRESOLVED(ret, "Failed to wait for the barrier");
}
/* Cancel the thread */
- ret = pthread_cancel( child );
+ ret = pthread_cancel(child);
if (ret == 0)
canceled++;
@@ -154,29 +154,29 @@ void * threaded( void * arg )
ended++;
/* Join the thread */
- ret = pthread_join( child, NULL );
+ ret = pthread_join(child, NULL);
if (ret != 0)
{
- UNRESOLVED( ret, "Unable to join the child" );
+ UNRESOLVED(ret, "Unable to join the child");
}
}
/* Destroy the barrier */
- ret = pthread_barrier_destroy( arg );
+ ret = pthread_barrier_destroy(arg);
if (ret != 0)
{
- UNRESOLVED( ret, "Failed to destroy a barrier" );
+ UNRESOLVED(ret, "Failed to destroy a barrier");
}
return NULL;
}
/* Main function */
-int main ( int argc, char *argv[] )
+int main (int argc, char *argv[])
{
int ret = 0, i;
@@ -190,61 +190,61 @@ int main ( int argc, char *argv[] )
/* Register the signal handler for SIGUSR1 */
- sigemptyset ( &sa.sa_mask );
+ sigemptyset (&sa.sa_mask);
sa.sa_flags = 0;
sa.sa_handler = sighdl;
- if (( ret = sigaction ( SIGUSR1, &sa, NULL ) ))
+ if ((ret = sigaction (SIGUSR1, &sa, NULL)))
{
- UNRESOLVED( ret, "Unable to register signal handler" );
+ UNRESOLVED(ret, "Unable to register signal handler");
}
- if (( ret = sigaction ( SIGALRM, &sa, NULL ) ))
+ if ((ret = sigaction (SIGALRM, &sa, NULL)))
{
- UNRESOLVED( ret, "Unable to register signal handler" );
+ UNRESOLVED(ret, "Unable to register signal handler");
}
#if VERBOSE > 1
- output( "[parent] Signal handler registered\n" );
+ output("[parent] Signal handler registered\n");
#endif
for (i = 0; i < NTHREADS; i++)
{
- ret = pthread_create( &th[ i ], NULL, threaded, &b[ i ] );
+ ret = pthread_create(&th[ i ], NULL, threaded, &b[ i ]);
if (ret != 0)
{
- UNRESOLVED( ret, "Failed to create a thread" );
+ UNRESOLVED(ret, "Failed to create a thread");
}
}
#if VERBOSE > 1
- output( "[parent] All threads are running\n" );
+ output("[parent] All threads are running\n");
#endif
/* Then join */
for (i = 0; i < NTHREADS; i++)
{
- ret = pthread_join( th[ i ], NULL );
+ ret = pthread_join(th[ i ], NULL);
if (ret != 0)
{
- UNRESOLVED( ret, "Failed to join a thread" );
+ UNRESOLVED(ret, "Failed to join a thread");
}
}
/* We've been asked to stop */
- output( "pthread_cancel stress test PASSED\n" );
+ output("pthread_cancel stress test PASSED\n");
- output( " - %llu threads canceled\n", canceled );
+ output(" - %llu threads canceled\n", canceled);
- output( " - %llu threads ended\n", ended );
+ output(" - %llu threads ended\n", ended);
PASSED;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_cancel/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/pthread_cancel/testfrmw.c
index 38adaa8d9..d075c0b7c 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_cancel/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_cancel/testfrmw.c
@@ -43,7 +43,7 @@ void output_init()
/* do nothing */
return;
}
-void output( char * string, ... )
+void output(char * string, ...)
{
va_list ap;
char *ts="[??:??:??]";
@@ -57,7 +57,7 @@ void output( char * string, ... )
printf(ts);
else
printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec);
- va_start( ap, string);
+ va_start(ap, string);
vprintf(string, ap);
va_end(ap);
pthread_mutex_unlock(&m_trace);
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/testfrmw.c
index 9e6f2c285..be39e8918 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_cond_init/testfrmw.c
@@ -40,11 +40,11 @@ void output_init()
/* do nothing */
return;
}
-void output( char * string, ... )
+void output(char * string, ...)
{
va_list ap;
pthread_mutex_lock(&m_trace);
- va_start( ap, string);
+ va_start(ap, string);
vprintf(string, ap);
va_end(ap);
pthread_mutex_unlock(&m_trace);
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/s-c.c b/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/s-c.c
index 68f9d5fe5..97c0201bd 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/s-c.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/s-c.c
@@ -224,7 +224,7 @@ void * waiter(void * arg)
if (ret != 0) { UNRESOLVED(ret, "Mutex lock failed in waiter"); }
#ifdef USE_CANCEL
- pthread_cleanup_push( (void *)pthread_mutex_unlock, (void *)(dt->mtx));
+ pthread_cleanup_push((void *)pthread_mutex_unlock, (void *)(dt->mtx));
#endif
/* This thread is ready to wait */
@@ -252,7 +252,7 @@ void * waiter(void * arg)
* < 0 if function was not able to create enough threads.
* cumulated # of nanoseconds otherwise.
*/
-long do_threads_test( int nthreads, mes_t * measure )
+long do_threads_test(int nthreads, mes_t * measure)
{
int ret;
@@ -577,11 +577,11 @@ int main (int argc, char *argv[])
* The next function will seek for the better model for each series of measurements.
*
* The tested models are: -- X = # threads; Y = latency
- * -> Y = a; -- Error is r1 = avg( (Y - Yavg)² );
- * -> Y = aX + b; -- Error is r2 = avg( (Y -aX -b)² );
- * -- where a = avg ( (X - Xavg)(Y - Yavg) ) / avg( ( X - Xavg)² )
- * -- Note: We will call _q = sum( (X - Xavg) * (Y - Yavg) );
- * -- and _d = sum( (X - Xavg)² );
+ * -> Y = a; -- Error is r1 = avg((Y - Yavg)²);
+ * -> Y = aX + b; -- Error is r2 = avg((Y -aX -b)²);
+ * -- where a = avg ((X - Xavg)(Y - Yavg)) / avg((X - Xavg)²)
+ * -- Note: We will call _q = sum((X - Xavg) * (Y - Yavg));
+ * -- and _d = sum((X - Xavg)²);
* -- and b = Yavg - a * Xavg
* -> Y = c * X^a;-- Same as previous, but with log(Y) = a log(X) + b; and b = log(c). Error is r3
* -> Y = exp(aX + b); -- log(Y) = aX + b. Error is r4
@@ -659,12 +659,12 @@ int parse_measure(mes_t * measures)
N++;
Xavg += (double) cur->nthreads;
- LnXavg += log( (double) cur->nthreads);
+ LnXavg += log((double) cur->nthreads);
for (i=0; i<NSCENAR; i++)
{
Yavg[i] += (double) cur->_data[i];
- LnYavg[i] += log( (double) cur->_data[i] );
+ LnYavg[i] += log((double) cur->_data[i]);
}
}
@@ -684,7 +684,7 @@ int parse_measure(mes_t * measures)
/* We will now alloc the array ... */
- Table = calloc(N, sizeof( struct row ));
+ Table = calloc(N, sizeof(struct row));
if (Table == NULL) { UNRESOLVED(errno, "Unable to alloc space for results parsing"); }
/* ... and fill it */
@@ -755,26 +755,26 @@ int parse_measure(mes_t * measures)
for (i=0; i<NSCENAR; i++)
{
/* r2 = avg((y - ax -b)²); t = (y - ax - b) = (y - yavg) - a (x - xavg); */
- t = ( Table[r]._y[i] - ((_q[0][i] * Table[r]._x) / _d[0][i]));
+ t = (Table[r]._y[i] - ((_q[0][i] * Table[r]._x) / _d[0][i]));
r2[i] += t * t / N ;
- /* r3 = avg(( y - c.x^a) ²);
+ /* r3 = avg((y - c.x^a) ²);
t = y - c * x ^ a
= y - log (LnYavg - (_q[1]/_d[1]) * LnXavg) * x ^ (_q[1]/_d[1])
*/
t = ( Table[r].Y[i]
- - ( logl ( LnYavg[i] - (_q[1][i] / _d[1][i] ) * LnXavg)
- * powl( Table[r].X, (_q[1][i] / _d[1][i] ))
+ - (logl (LnYavg[i] - (_q[1][i] / _d[1][i]) * LnXavg)
+ * powl(Table[r].X, (_q[1][i] / _d[1][i]))
) );
r3[i] += t * t / N ;
- /* r4 = avg(( y - exp(ax+b))²);
+ /* r4 = avg((y - exp(ax+b))²);
t = y - exp(ax+b)
- = y - exp( _q[2]/_d[2] * x + ( LnYavg - (_q[2]/_d[2] * Xavg) ));
- = y - exp( _q[2]/_d[2] * (x - Xavg) + LnYavg );
+ = y - exp(_q[2]/_d[2] * x + (LnYavg - (_q[2]/_d[2] * Xavg)));
+ = y - exp(_q[2]/_d[2] * (x - Xavg) + LnYavg);
*/
t = ( Table[r].Y[i]
- - expl( ( _q[2][i] / _d[2][i] ) * Table[r]._x + LnYavg[i] ) );
+ - expl((_q[2][i] / _d[2][i]) * Table[r]._x + LnYavg[i]));
r4[i] += t * t / N ;
}
@@ -800,7 +800,7 @@ int parse_measure(mes_t * measures)
output(" Model: Y = c * X ^ a\n");
output(" a = %Lg\n", _q[1][i] / _d[1][i]);
- output(" c = %Lg\n", logl ( LnYavg[i] - (_q[1][i] / _d[1][i] ) * LnXavg));
+ output(" c = %Lg\n", logl (LnYavg[i] - (_q[1][i] / _d[1][i]) * LnXavg));
output(" Divergence %g\n", r2[i]);
output(" Model: Y = exp(a * X + b)\n");
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/stress1.c b/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/stress1.c
index 98b3d5b8c..bea1b015d 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/stress1.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/stress1.c
@@ -306,7 +306,7 @@ void * threaded_A (void * arg)
if (WIFSIGNALED(status))
{
output("Child process killed with signal %d\n",WTERMSIG(status));
- UNRESOLVED( 0 , "Child process was killed");
+ UNRESOLVED(0 , "Child process was killed");
}
if (WIFEXITED(status))
@@ -315,7 +315,7 @@ void * threaded_A (void * arg)
}
else
{
- UNRESOLVED( 0, "Child process was neither killed nor exited");
+ UNRESOLVED(0, "Child process was neither killed nor exited");
}
}
@@ -418,7 +418,7 @@ int main(int argc, char * argv[])
ps = (size_t)sysconf(_SC_PAGESIZE);
sz= ((sizeof(testdata_t) / ps) + 1) * ps; /* # pages needed to store the testdata */
- tmp = calloc( 1 , sz);
+ tmp = calloc(1 , sz);
if (tmp == NULL)
{ UNRESOLVED(errno, "Memory allocation failed"); }
@@ -564,7 +564,7 @@ int main(int argc, char * argv[])
for (i=0; i<NTOT; i++)
{
- ret = pthread_create( &th[i], &ta, threaded_A, &(td->cd[i]));
+ ret = pthread_create(&th[i], &ta, threaded_A, &(td->cd[i]));
/* In case of failure we can exit; the child process will die after a while */
if (ret != 0) { UNRESOLVED(ret, "[Parent] Failed to create a thread"); }
@@ -580,7 +580,7 @@ int main(int argc, char * argv[])
for (i=0; i<NTOT; i++)
{
- ret = pthread_join( th[i], NULL);
+ ret = pthread_join(th[i], NULL);
if (ret != 0) { UNRESOLVED(ret, "[Parent] Failed to join a thread"); }
}
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/stress2.c b/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/stress2.c
index f2e653612..82d64d7d3 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/stress2.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/stress2.c
@@ -296,7 +296,7 @@ void * cellmanager(void * arg)
/* choose a (pseudo) random thread to cancel */
ret = clock_gettime(cd->cid, &ts);
if (ret != 0) { UNRESOLVED(errno, "Failed to read clock"); }
- randval = (ts.tv_sec + (ts.tv_nsec >> 10) ) % (NCHILDREN * SCALABILITY_FACTOR + 2);
+ randval = (ts.tv_sec + (ts.tv_nsec >> 10)) % (NCHILDREN * SCALABILITY_FACTOR + 2);
/* wait for the workers to be ready */
do
@@ -310,7 +310,7 @@ void * cellmanager(void * arg)
if (ret != 0) { UNRESOLVED(ret, "Mutex unlock failed"); }
} while (i < NCHILDREN * SCALABILITY_FACTOR + 2);
- /* Set the boolean ( 1 => no lock in signaler; -1 => lock ) */
+ /* Set the boolean (1 => no lock in signaler; -1 => lock) */
cd->boolean = (ts.tv_sec & 1)?-1:1;
/* create the signaler */
@@ -506,7 +506,7 @@ int main (int argc, char * argv[])
/* create the NSCENAR * SCALABILITY_FACTOR manager threads */
for (i=0; i<NSCENAR * SCALABILITY_FACTOR; i++)
{
- ret = pthread_create( &mngrs[i], &ta, cellmanager, &(cells[i]));
+ ret = pthread_create(&mngrs[i], &ta, cellmanager, &(cells[i]));
/* In case of failure we can exit; the child process will die after a while */
if (ret != 0) { UNRESOLVED(ret, "[Parent] Failed to create a thread"); }
@@ -523,7 +523,7 @@ int main (int argc, char * argv[])
/* join the manager threads and destroy the cells */
for (i=0; i<NSCENAR * SCALABILITY_FACTOR; i++)
{
- ret = pthread_join( mngrs[i], NULL);
+ ret = pthread_join(mngrs[i], NULL);
if (ret != 0) { UNRESOLVED(ret, "[Parent] Failed to join a thread"); }
canceled += cells[i].canceled;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/testfrmw.c
index 9e6f2c285..be39e8918 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_cond_timedwait/testfrmw.c
@@ -40,11 +40,11 @@ void output_init()
/* do nothing */
return;
}
-void output( char * string, ... )
+void output(char * string, ...)
{
va_list ap;
pthread_mutex_lock(&m_trace);
- va_start( ap, string);
+ va_start(ap, string);
vprintf(string, ap);
va_end(ap);
pthread_mutex_unlock(&m_trace);
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/stress.c b/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/stress.c
index f2e653612..82d64d7d3 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/stress.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/stress.c
@@ -296,7 +296,7 @@ void * cellmanager(void * arg)
/* choose a (pseudo) random thread to cancel */
ret = clock_gettime(cd->cid, &ts);
if (ret != 0) { UNRESOLVED(errno, "Failed to read clock"); }
- randval = (ts.tv_sec + (ts.tv_nsec >> 10) ) % (NCHILDREN * SCALABILITY_FACTOR + 2);
+ randval = (ts.tv_sec + (ts.tv_nsec >> 10)) % (NCHILDREN * SCALABILITY_FACTOR + 2);
/* wait for the workers to be ready */
do
@@ -310,7 +310,7 @@ void * cellmanager(void * arg)
if (ret != 0) { UNRESOLVED(ret, "Mutex unlock failed"); }
} while (i < NCHILDREN * SCALABILITY_FACTOR + 2);
- /* Set the boolean ( 1 => no lock in signaler; -1 => lock ) */
+ /* Set the boolean (1 => no lock in signaler; -1 => lock) */
cd->boolean = (ts.tv_sec & 1)?-1:1;
/* create the signaler */
@@ -506,7 +506,7 @@ int main (int argc, char * argv[])
/* create the NSCENAR * SCALABILITY_FACTOR manager threads */
for (i=0; i<NSCENAR * SCALABILITY_FACTOR; i++)
{
- ret = pthread_create( &mngrs[i], &ta, cellmanager, &(cells[i]));
+ ret = pthread_create(&mngrs[i], &ta, cellmanager, &(cells[i]));
/* In case of failure we can exit; the child process will die after a while */
if (ret != 0) { UNRESOLVED(ret, "[Parent] Failed to create a thread"); }
@@ -523,7 +523,7 @@ int main (int argc, char * argv[])
/* join the manager threads and destroy the cells */
for (i=0; i<NSCENAR * SCALABILITY_FACTOR; i++)
{
- ret = pthread_join( mngrs[i], NULL);
+ ret = pthread_join(mngrs[i], NULL);
if (ret != 0) { UNRESOLVED(ret, "[Parent] Failed to join a thread"); }
canceled += cells[i].canceled;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/stress1.c b/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/stress1.c
index d2c5170f4..fa134883a 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/stress1.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/stress1.c
@@ -289,7 +289,7 @@ void * threaded_A (void * arg)
if (WIFSIGNALED(status))
{
output("Child process killed with signal %d\n",WTERMSIG(status));
- UNRESOLVED( 0 , "Child process was killed");
+ UNRESOLVED(0 , "Child process was killed");
}
if (WIFEXITED(status))
@@ -298,7 +298,7 @@ void * threaded_A (void * arg)
}
else
{
- UNRESOLVED( 0, "Child process was neither killed nor exited");
+ UNRESOLVED(0, "Child process was neither killed nor exited");
}
}
@@ -408,7 +408,7 @@ int main(int argc, char * argv[])
ps = (size_t)sysconf(_SC_PAGESIZE);
sz= ((sizeof(testdata_t) / ps) + 1) * ps; /* # pages needed to store the testdata */
- tmp = calloc( 1 , sz);
+ tmp = calloc(1 , sz);
if (tmp == NULL)
{ UNRESOLVED(errno, "Memory allocation failed"); }
@@ -556,7 +556,7 @@ int main(int argc, char * argv[])
for (i=0; i<NTOT; i++)
{
- ret = pthread_create( &th[i], &ta, threaded_A, &(td->cd[i]));
+ ret = pthread_create(&th[i], &ta, threaded_A, &(td->cd[i]));
/* In case of failure we can exit; the child processes will die after a while */
if (ret != 0) { UNRESOLVED(ret, "[Parent] Failed to create a thread"); }
@@ -572,7 +572,7 @@ int main(int argc, char * argv[])
for (i=0; i<NTOT; i++)
{
- ret = pthread_join( th[i], NULL);
+ ret = pthread_join(th[i], NULL);
if (ret != 0) { UNRESOLVED(ret, "[Parent] Failed to join a thread"); }
}
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/stress2.c b/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/stress2.c
index f2e653612..82d64d7d3 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/stress2.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/stress2.c
@@ -296,7 +296,7 @@ void * cellmanager(void * arg)
/* choose a (pseudo) random thread to cancel */
ret = clock_gettime(cd->cid, &ts);
if (ret != 0) { UNRESOLVED(errno, "Failed to read clock"); }
- randval = (ts.tv_sec + (ts.tv_nsec >> 10) ) % (NCHILDREN * SCALABILITY_FACTOR + 2);
+ randval = (ts.tv_sec + (ts.tv_nsec >> 10)) % (NCHILDREN * SCALABILITY_FACTOR + 2);
/* wait for the workers to be ready */
do
@@ -310,7 +310,7 @@ void * cellmanager(void * arg)
if (ret != 0) { UNRESOLVED(ret, "Mutex unlock failed"); }
} while (i < NCHILDREN * SCALABILITY_FACTOR + 2);
- /* Set the boolean ( 1 => no lock in signaler; -1 => lock ) */
+ /* Set the boolean (1 => no lock in signaler; -1 => lock) */
cd->boolean = (ts.tv_sec & 1)?-1:1;
/* create the signaler */
@@ -506,7 +506,7 @@ int main (int argc, char * argv[])
/* create the NSCENAR * SCALABILITY_FACTOR manager threads */
for (i=0; i<NSCENAR * SCALABILITY_FACTOR; i++)
{
- ret = pthread_create( &mngrs[i], &ta, cellmanager, &(cells[i]));
+ ret = pthread_create(&mngrs[i], &ta, cellmanager, &(cells[i]));
/* In case of failure we can exit; the child process will die after a while */
if (ret != 0) { UNRESOLVED(ret, "[Parent] Failed to create a thread"); }
@@ -523,7 +523,7 @@ int main (int argc, char * argv[])
/* join the manager threads and destroy the cells */
for (i=0; i<NSCENAR * SCALABILITY_FACTOR; i++)
{
- ret = pthread_join( mngrs[i], NULL);
+ ret = pthread_join(mngrs[i], NULL);
if (ret != 0) { UNRESOLVED(ret, "[Parent] Failed to join a thread"); }
canceled += cells[i].canceled;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/testfrmw.c
index 38adaa8d9..d075c0b7c 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_cond_wait/testfrmw.c
@@ -43,7 +43,7 @@ void output_init()
/* do nothing */
return;
}
-void output( char * string, ... )
+void output(char * string, ...)
{
va_list ap;
char *ts="[??:??:??]";
@@ -57,7 +57,7 @@ void output( char * string, ... )
printf(ts);
else
printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec);
- va_start( ap, string);
+ va_start(ap, string);
vprintf(string, ap);
va_end(ap);
pthread_mutex_unlock(&m_trace);
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_create/s-c1.c b/testcases/open_posix_testsuite/stress/threads/pthread_create/s-c1.c
index 34d4e4698..3398a899d 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_create/s-c1.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_create/s-c1.c
@@ -381,11 +381,11 @@ if (ret == ENOMEM) break;
* The next function will seek for the better model for each series of measurements.
*
* The tested models are: -- X = # threads; Y = latency
- * -> Y = a; -- Error is r1 = avg( (Y - Yavg)² );
- * -> Y = aX + b; -- Error is r2 = avg( (Y -aX -b)² );
- * -- where a = avg ( (X - Xavg)(Y - Yavg) ) / avg( ( X - Xavg)² )
- * -- Note: We will call _q = sum( (X - Xavg) * (Y - Yavg) );
- * -- and _d = sum( (X - Xavg)² );
+ * -> Y = a; -- Error is r1 = avg((Y - Yavg)²);
+ * -> Y = aX + b; -- Error is r2 = avg((Y -aX -b)²);
+ * -- where a = avg ((X - Xavg)(Y - Yavg)) / avg((X - Xavg)²)
+ * -- Note: We will call _q = sum((X - Xavg) * (Y - Yavg));
+ * -- and _d = sum((X - Xavg)²);
* -- and b = Yavg - a * Xavg
* -> Y = c * X^a;-- Same as previous, but with log(Y) = a log(X) + b; and b = log(c). Error is r3
* -> Y = exp(aX + b); -- log(Y) = aX + b. Error is r4
@@ -472,9 +472,9 @@ int parse_measure(mes_t * measures)
{
array_max[i]=N;
Xavg[i] += (double) cur->nthreads;
- LnXavg[i] += log( (double) cur->nthreads);
+ LnXavg[i] += log((double) cur->nthreads);
Yavg[i] += (double) cur->_data[i];
- LnYavg[i] += log( (double) cur->_data[i] );
+ LnYavg[i] += log((double) cur->_data[i]);
}
}
}
@@ -497,7 +497,7 @@ int parse_measure(mes_t * measures)
/* We will now alloc the array ... */
- Table = calloc(N, sizeof( struct row ));
+ Table = calloc(N, sizeof(struct row));
if (Table == NULL) { UNRESOLVED(errno, "Unable to alloc space for results parsing"); }
/* ... and fill it */
@@ -571,26 +571,26 @@ int parse_measure(mes_t * measures)
for (r=0; r<array_max[i]; r++)
{
/* r2 = avg((y - ax -b)²); t = (y - ax - b) = (y - yavg) - a (x - xavg); */
- t = ( Table[r]._y[i] - ((_q[0][i] * Table[r]._x[i]) / _d[0][i]));
+ t = (Table[r]._y[i] - ((_q[0][i] * Table[r]._x[i]) / _d[0][i]));
r2[i] += t * t / array_max[i] ;
- /* r3 = avg(( y - c.x^a) ²);
+ /* r3 = avg((y - c.x^a) ²);
t = y - c * x ^ a
= y - log (LnYavg - (_q[1]/_d[1]) * LnXavg) * x ^ (_q[1]/_d[1])
*/
t = ( Table[r].Y[i]
- - ( logl ( LnYavg[i] - (_q[1][i] / _d[1][i] ) * LnXavg[i])
- * powl( Table[r].X, (_q[1][i] / _d[1][i] ))
+ - (logl (LnYavg[i] - (_q[1][i] / _d[1][i]) * LnXavg[i])
+ * powl(Table[r].X, (_q[1][i] / _d[1][i]))
) );
r3[i] += t * t / array_max[i] ;
- /* r4 = avg(( y - exp(ax+b))²);
+ /* r4 = avg((y - exp(ax+b))²);
t = y - exp(ax+b)
- = y - exp( _q[2]/_d[2] * x + ( LnYavg - (_q[2]/_d[2] * Xavg) ));
- = y - exp( _q[2]/_d[2] * (x - Xavg) + LnYavg );
+ = y - exp(_q[2]/_d[2] * x + (LnYavg - (_q[2]/_d[2] * Xavg)));
+ = y - exp(_q[2]/_d[2] * (x - Xavg) + LnYavg);
*/
t = ( Table[r].Y[i]
- - expl( ( _q[2][i] / _d[2][i] ) * Table[r]._x[i] + LnYavg[i] ) );
+ - expl((_q[2][i] / _d[2][i]) * Table[r]._x[i] + LnYavg[i]));
r4[i] += t * t / array_max[i] ;
}
@@ -618,7 +618,7 @@ int parse_measure(mes_t * measures)
output(" Model: Y = c * X ^ a\n");
output(" a = %Lg\n", _q[1][i] / _d[1][i]);
- output(" c = %Lg\n", logl ( LnYavg[i] - (_q[1][i] / _d[1][i] ) * LnXavg[i]));
+ output(" c = %Lg\n", logl (LnYavg[i] - (_q[1][i] / _d[1][i]) * LnXavg[i]));
output(" Divergence %g\n", r2[i]);
output(" Model: Y = exp(a * X + b)\n");
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_create/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/pthread_create/testfrmw.c
index 38adaa8d9..d075c0b7c 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_create/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_create/testfrmw.c
@@ -43,7 +43,7 @@ void output_init()
/* do nothing */
return;
}
-void output( char * string, ... )
+void output(char * string, ...)
{
va_list ap;
char *ts="[??:??:??]";
@@ -57,7 +57,7 @@ void output( char * string, ... )
printf(ts);
else
printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec);
- va_start( ap, string);
+ va_start(ap, string);
vprintf(string, ap);
va_end(ap);
pthread_mutex_unlock(&m_trace);
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_create/threads_scenarii.c b/testcases/open_posix_testsuite/stress/threads/pthread_create/threads_scenarii.c
index 81e0dabf8..470dafbb1 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_create/threads_scenarii.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_create/threads_scenarii.c
@@ -77,43 +77,43 @@ struct __scenario
{
/* Unary tests */
-/* 0*/ CASE_POS( 0, 0, 0, 0, 0, 0, 0, 0, "default")
-/* 1*/ ,CASE_POS( 1, 0, 0, 0, 0, 0, 0, 0, "detached")
-/* 2*/ ,CASE_POS( 0, 1, 0, 0, 0, 0, 0, 0, "Explicit sched")
-/* 3*/ ,CASE_UNK( 0, 0, 1, 0, 0, 0, 0, 0, "FIFO Policy")
-/* 4*/ ,CASE_UNK( 0, 0, 2, 0, 0, 0, 0, 0, "RR Policy")
-/* 5*/ ,CASE_UNK( 0, 0, 0, 1, 0, 0, 0, 0, "Max sched param")
-/* 6*/ ,CASE_UNK( 0, 0, 0,-1, 0, 0, 0, 0, "Min sched param")
-/* 7*/ ,CASE_POS( 0, 0, 0, 0, 1, 0, 0, 0, "Alternative contension scope")
-/* 8*/ ,CASE_POS( 0, 0, 0, 0, 0, 1, 0, 0, "Alternative stack")
-/* 9*/ ,CASE_POS( 0, 0, 0, 0, 0, 0, 1, 0, "No guard size")
-/*10*/ ,CASE_UNK( 0, 0, 0, 0, 0, 0, 2, 0, "1p guard size")
-/*11*/ ,CASE_POS( 0, 0, 0, 0, 0, 0, 0, 1, "Min stack size")
+/* 0*/ CASE_POS(0, 0, 0, 0, 0, 0, 0, 0, "default")
+/* 1*/ ,CASE_POS(1, 0, 0, 0, 0, 0, 0, 0, "detached")
+/* 2*/ ,CASE_POS(0, 1, 0, 0, 0, 0, 0, 0, "Explicit sched")
+/* 3*/ ,CASE_UNK(0, 0, 1, 0, 0, 0, 0, 0, "FIFO Policy")
+/* 4*/ ,CASE_UNK(0, 0, 2, 0, 0, 0, 0, 0, "RR Policy")
+/* 5*/ ,CASE_UNK(0, 0, 0, 1, 0, 0, 0, 0, "Max sched param")
+/* 6*/ ,CASE_UNK(0, 0, 0,-1, 0, 0, 0, 0, "Min sched param")
+/* 7*/ ,CASE_POS(0, 0, 0, 0, 1, 0, 0, 0, "Alternative contension scope")
+/* 8*/ ,CASE_POS(0, 0, 0, 0, 0, 1, 0, 0, "Alternative stack")
+/* 9*/ ,CASE_POS(0, 0, 0, 0, 0, 0, 1, 0, "No guard size")
+/*10*/ ,CASE_UNK(0, 0, 0, 0, 0, 0, 2, 0, "1p guard size")
+/*11*/ ,CASE_POS(0, 0, 0, 0, 0, 0, 0, 1, "Min stack size")
/* Stack play */
- ,CASE_POS( 0, 0, 0, 0, 0, 0, 1, 1, "Min stack size, no guard")
- ,CASE_UNK( 0, 0, 0, 0, 0, 0, 2, 1, "Min stack size, 1p guard")
- ,CASE_POS( 1, 0, 0, 0, 0, 1, 0, 0, "Detached, Alternative stack")
- ,CASE_POS( 1, 0, 0, 0, 0, 0, 1, 1, "Detached, Min stack size, no guard")
- ,CASE_UNK( 1, 0, 0, 0, 0, 0, 2, 1, "Detached, Min stack size, 1p guard")
+ ,CASE_POS(0, 0, 0, 0, 0, 0, 1, 1, "Min stack size, no guard")
+ ,CASE_UNK(0, 0, 0, 0, 0, 0, 2, 1, "Min stack size, 1p guard")
+ ,CASE_POS(1, 0, 0, 0, 0, 1, 0, 0, "Detached, Alternative stack")
+ ,CASE_POS(1, 0, 0, 0, 0, 0, 1, 1, "Detached, Min stack size, no guard")
+ ,CASE_UNK(1, 0, 0, 0, 0, 0, 2, 1, "Detached, Min stack size, 1p guard")
/* Scheduling play -- all results are unknown since it might depend on the user priviledges */
- ,CASE_UNK( 0, 1, 1, 1, 0, 0, 0, 0, "Explicit FIFO max param")
- ,CASE_UNK( 0, 1, 2, 1, 0, 0, 0, 0, "Explicit RR max param")
- ,CASE_UNK( 0, 1, 1,-1, 0, 0, 0, 0, "Explicit FIFO min param")
- ,CASE_UNK( 0, 1, 2,-1, 0, 0, 0, 0, "Explicit RR min param")
- ,CASE_UNK( 0, 1, 1, 1, 1, 0, 0, 0, "Explicit FIFO max param, alt scope")
- ,CASE_UNK( 0, 1, 2, 1, 1, 0, 0, 0, "Explicit RR max param, alt scope")
- ,CASE_UNK( 0, 1, 1,-1, 1, 0, 0, 0, "Explicit FIFO min param, alt scope")
- ,CASE_UNK( 0, 1, 2,-1, 1, 0, 0, 0, "Explicit RR min param, alt scope")
- ,CASE_UNK( 1, 1, 1, 1, 0, 0, 0, 0, "Detached, explicit FIFO max param")
- ,CASE_UNK( 1, 1, 2, 1, 0, 0, 0, 0, "Detached, explicit RR max param")
- ,CASE_UNK( 1, 1, 1,-1, 0, 0, 0, 0, "Detached, explicit FIFO min param")
- ,CASE_UNK( 1, 1, 2,-1, 0, 0, 0, 0, "Detached, explicit RR min param")
- ,CASE_UNK( 1, 1, 1, 1, 1, 0, 0, 0, "Detached, explicit FIFO max param, alt scope")
- ,CASE_UNK( 1, 1, 2, 1, 1, 0, 0, 0, "Detached, explicit RR max param, alt scope")
- ,CASE_UNK( 1, 1, 1,-1, 1, 0, 0, 0, "Detached, explicit FIFO min param, alt scope")
- ,CASE_UNK( 1, 1, 2,-1, 1, 0, 0, 0, "Detached, explicit RR min param, alt scope")
+ ,CASE_UNK(0, 1, 1, 1, 0, 0, 0, 0, "Explicit FIFO max param")
+ ,CASE_UNK(0, 1, 2, 1, 0, 0, 0, 0, "Explicit RR max param")
+ ,CASE_UNK(0, 1, 1,-1, 0, 0, 0, 0, "Explicit FIFO min param")
+ ,CASE_UNK(0, 1, 2,-1, 0, 0, 0, 0, "Explicit RR min param")
+ ,CASE_UNK(0, 1, 1, 1, 1, 0, 0, 0, "Explicit FIFO max param, alt scope")
+ ,CASE_UNK(0, 1, 2, 1, 1, 0, 0, 0, "Explicit RR max param, alt scope")
+ ,CASE_UNK(0, 1, 1,-1, 1, 0, 0, 0, "Explicit FIFO min param, alt scope")
+ ,CASE_UNK(0, 1, 2,-1, 1, 0, 0, 0, "Explicit RR min param, alt scope")
+ ,CASE_UNK(1, 1, 1, 1, 0, 0, 0, 0, "Detached, explicit FIFO max param")
+ ,CASE_UNK(1, 1, 2, 1, 0, 0, 0, 0, "Detached, explicit RR max param")
+ ,CASE_UNK(1, 1, 1,-1, 0, 0, 0, 0, "Detached, explicit FIFO min param")
+ ,CASE_UNK(1, 1, 2,-1, 0, 0, 0, 0, "Detached, explicit RR min param")
+ ,CASE_UNK(1, 1, 1, 1, 1, 0, 0, 0, "Detached, explicit FIFO max param, alt scope")
+ ,CASE_UNK(1, 1, 2, 1, 1, 0, 0, 0, "Detached, explicit RR max param, alt scope")
+ ,CASE_UNK(1, 1, 1,-1, 1, 0, 0, 0, "Detached, explicit FIFO min param, alt scope")
+ ,CASE_UNK(1, 1, 2,-1, 1, 0, 0, 0, "Detached, explicit RR min param, alt scope")
};
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_exit/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/pthread_exit/testfrmw.c
index 38adaa8d9..d075c0b7c 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_exit/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_exit/testfrmw.c
@@ -43,7 +43,7 @@ void output_init()
/* do nothing */
return;
}
-void output( char * string, ... )
+void output(char * string, ...)
{
va_list ap;
char *ts="[??:??:??]";
@@ -57,7 +57,7 @@ void output( char * string, ... )
printf(ts);
else
printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec);
- va_start( ap, string);
+ va_start(ap, string);
vprintf(string, ap);
va_end(ap);
pthread_mutex_unlock(&m_trace);
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_exit/threads_scenarii.c b/testcases/open_posix_testsuite/stress/threads/pthread_exit/threads_scenarii.c
index 81e0dabf8..470dafbb1 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_exit/threads_scenarii.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_exit/threads_scenarii.c
@@ -77,43 +77,43 @@ struct __scenario
{
/* Unary tests */
-/* 0*/ CASE_POS( 0, 0, 0, 0, 0, 0, 0, 0, "default")
-/* 1*/ ,CASE_POS( 1, 0, 0, 0, 0, 0, 0, 0, "detached")
-/* 2*/ ,CASE_POS( 0, 1, 0, 0, 0, 0, 0, 0, "Explicit sched")
-/* 3*/ ,CASE_UNK( 0, 0, 1, 0, 0, 0, 0, 0, "FIFO Policy")
-/* 4*/ ,CASE_UNK( 0, 0, 2, 0, 0, 0, 0, 0, "RR Policy")
-/* 5*/ ,CASE_UNK( 0, 0, 0, 1, 0, 0, 0, 0, "Max sched param")
-/* 6*/ ,CASE_UNK( 0, 0, 0,-1, 0, 0, 0, 0, "Min sched param")
-/* 7*/ ,CASE_POS( 0, 0, 0, 0, 1, 0, 0, 0, "Alternative contension scope")
-/* 8*/ ,CASE_POS( 0, 0, 0, 0, 0, 1, 0, 0, "Alternative stack")
-/* 9*/ ,CASE_POS( 0, 0, 0, 0, 0, 0, 1, 0, "No guard size")
-/*10*/ ,CASE_UNK( 0, 0, 0, 0, 0, 0, 2, 0, "1p guard size")
-/*11*/ ,CASE_POS( 0, 0, 0, 0, 0, 0, 0, 1, "Min stack size")
+/* 0*/ CASE_POS(0, 0, 0, 0, 0, 0, 0, 0, "default")
+/* 1*/ ,CASE_POS(1, 0, 0, 0, 0, 0, 0, 0, "detached")
+/* 2*/ ,CASE_POS(0, 1, 0, 0, 0, 0, 0, 0, "Explicit sched")
+/* 3*/ ,CASE_UNK(0, 0, 1, 0, 0, 0, 0, 0, "FIFO Policy")
+/* 4*/ ,CASE_UNK(0, 0, 2, 0, 0, 0, 0, 0, "RR Policy")
+/* 5*/ ,CASE_UNK(0, 0, 0, 1, 0, 0, 0, 0, "Max sched param")
+/* 6*/ ,CASE_UNK(0, 0, 0,-1, 0, 0, 0, 0, "Min sched param")
+/* 7*/ ,CASE_POS(0, 0, 0, 0, 1, 0, 0, 0, "Alternative contension scope")
+/* 8*/ ,CASE_POS(0, 0, 0, 0, 0, 1, 0, 0, "Alternative stack")
+/* 9*/ ,CASE_POS(0, 0, 0, 0, 0, 0, 1, 0, "No guard size")
+/*10*/ ,CASE_UNK(0, 0, 0, 0, 0, 0, 2, 0, "1p guard size")
+/*11*/ ,CASE_POS(0, 0, 0, 0, 0, 0, 0, 1, "Min stack size")
/* Stack play */
- ,CASE_POS( 0, 0, 0, 0, 0, 0, 1, 1, "Min stack size, no guard")
- ,CASE_UNK( 0, 0, 0, 0, 0, 0, 2, 1, "Min stack size, 1p guard")
- ,CASE_POS( 1, 0, 0, 0, 0, 1, 0, 0, "Detached, Alternative stack")
- ,CASE_POS( 1, 0, 0, 0, 0, 0, 1, 1, "Detached, Min stack size, no guard")
- ,CASE_UNK( 1, 0, 0, 0, 0, 0, 2, 1, "Detached, Min stack size, 1p guard")
+ ,CASE_POS(0, 0, 0, 0, 0, 0, 1, 1, "Min stack size, no guard")
+ ,CASE_UNK(0, 0, 0, 0, 0, 0, 2, 1, "Min stack size, 1p guard")
+ ,CASE_POS(1, 0, 0, 0, 0, 1, 0, 0, "Detached, Alternative stack")
+ ,CASE_POS(1, 0, 0, 0, 0, 0, 1, 1, "Detached, Min stack size, no guard")
+ ,CASE_UNK(1, 0, 0, 0, 0, 0, 2, 1, "Detached, Min stack size, 1p guard")
/* Scheduling play -- all results are unknown since it might depend on the user priviledges */
- ,CASE_UNK( 0, 1, 1, 1, 0, 0, 0, 0, "Explicit FIFO max param")
- ,CASE_UNK( 0, 1, 2, 1, 0, 0, 0, 0, "Explicit RR max param")
- ,CASE_UNK( 0, 1, 1,-1, 0, 0, 0, 0, "Explicit FIFO min param")
- ,CASE_UNK( 0, 1, 2,-1, 0, 0, 0, 0, "Explicit RR min param")
- ,CASE_UNK( 0, 1, 1, 1, 1, 0, 0, 0, "Explicit FIFO max param, alt scope")
- ,CASE_UNK( 0, 1, 2, 1, 1, 0, 0, 0, "Explicit RR max param, alt scope")
- ,CASE_UNK( 0, 1, 1,-1, 1, 0, 0, 0, "Explicit FIFO min param, alt scope")
- ,CASE_UNK( 0, 1, 2,-1, 1, 0, 0, 0, "Explicit RR min param, alt scope")
- ,CASE_UNK( 1, 1, 1, 1, 0, 0, 0, 0, "Detached, explicit FIFO max param")
- ,CASE_UNK( 1, 1, 2, 1, 0, 0, 0, 0, "Detached, explicit RR max param")
- ,CASE_UNK( 1, 1, 1,-1, 0, 0, 0, 0, "Detached, explicit FIFO min param")
- ,CASE_UNK( 1, 1, 2,-1, 0, 0, 0, 0, "Detached, explicit RR min param")
- ,CASE_UNK( 1, 1, 1, 1, 1, 0, 0, 0, "Detached, explicit FIFO max param, alt scope")
- ,CASE_UNK( 1, 1, 2, 1, 1, 0, 0, 0, "Detached, explicit RR max param, alt scope")
- ,CASE_UNK( 1, 1, 1,-1, 1, 0, 0, 0, "Detached, explicit FIFO min param, alt scope")
- ,CASE_UNK( 1, 1, 2,-1, 1, 0, 0, 0, "Detached, explicit RR min param, alt scope")
+ ,CASE_UNK(0, 1, 1, 1, 0, 0, 0, 0, "Explicit FIFO max param")
+ ,CASE_UNK(0, 1, 2, 1, 0, 0, 0, 0, "Explicit RR max param")
+ ,CASE_UNK(0, 1, 1,-1, 0, 0, 0, 0, "Explicit FIFO min param")
+ ,CASE_UNK(0, 1, 2,-1, 0, 0, 0, 0, "Explicit RR min param")
+ ,CASE_UNK(0, 1, 1, 1, 1, 0, 0, 0, "Explicit FIFO max param, alt scope")
+ ,CASE_UNK(0, 1, 2, 1, 1, 0, 0, 0, "Explicit RR max param, alt scope")
+ ,CASE_UNK(0, 1, 1,-1, 1, 0, 0, 0, "Explicit FIFO min param, alt scope")
+ ,CASE_UNK(0, 1, 2,-1, 1, 0, 0, 0, "Explicit RR min param, alt scope")
+ ,CASE_UNK(1, 1, 1, 1, 0, 0, 0, 0, "Detached, explicit FIFO max param")
+ ,CASE_UNK(1, 1, 2, 1, 0, 0, 0, 0, "Detached, explicit RR max param")
+ ,CASE_UNK(1, 1, 1,-1, 0, 0, 0, 0, "Detached, explicit FIFO min param")
+ ,CASE_UNK(1, 1, 2,-1, 0, 0, 0, 0, "Detached, explicit RR min param")
+ ,CASE_UNK(1, 1, 1, 1, 1, 0, 0, 0, "Detached, explicit FIFO max param, alt scope")
+ ,CASE_UNK(1, 1, 2, 1, 1, 0, 0, 0, "Detached, explicit RR max param, alt scope")
+ ,CASE_UNK(1, 1, 1,-1, 1, 0, 0, 0, "Detached, explicit FIFO min param, alt scope")
+ ,CASE_UNK(1, 1, 2,-1, 1, 0, 0, 0, "Detached, explicit RR min param, alt scope")
};
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_getschedparam/stress.c b/testcases/open_posix_testsuite/stress/threads/pthread_getschedparam/stress.c
index 160abe04d..36c703e39 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_getschedparam/stress.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_getschedparam/stress.c
@@ -85,7 +85,7 @@ char do_it = 1;
long long iterations = 0;
/* Handler for user request to terminate */
-void sighdl( int sig )
+void sighdl(int sig)
{
do
{
@@ -106,7 +106,7 @@ testdata_t;
testdata_t td[ 4 ];
/* Thread function */
-void * threaded( void * arg )
+void * threaded(void * arg)
{
int ret = 0;
int i = 0;
@@ -118,21 +118,21 @@ void * threaded( void * arg )
{
for (i = 0; i < 4; i++)
{
- ret = pthread_getschedparam( td[ i ].thread, &pol, &sp );
+ ret = pthread_getschedparam(td[ i ].thread, &pol, &sp);
if (ret != 0)
{
- UNRESOLVED( ret, "Failed to get sched param" );
+ UNRESOLVED(ret, "Failed to get sched param");
}
if (pol != td[ i ].policy)
{
- FAILED( "Wrong scheduling policy read" );
+ FAILED("Wrong scheduling policy read");
}
if (sp.sched_priority != td[ i ].prio)
{
- FAILED( "Wrong scheduling priority read" );
+ FAILED("Wrong scheduling priority read");
}
}
@@ -145,16 +145,16 @@ void * threaded( void * arg )
}
/* alternative policy threads */
-void * rt_thread( void * arg )
+void * rt_thread(void * arg)
{
int ret = 0;
/* This thread does almost nothing but wait... */
- ret = pthread_barrier_wait( arg );
+ ret = pthread_barrier_wait(arg);
- if (( ret != 0 ) && ( ret != PTHREAD_BARRIER_SERIAL_THREAD ))
+ if ((ret != 0) && (ret != PTHREAD_BARRIER_SERIAL_THREAD))
{
- UNRESOLVED( ret, "Failed to wait for barrier" );
+ UNRESOLVED(ret, "Failed to wait for barrier");
}
return NULL;
@@ -162,7 +162,7 @@ void * rt_thread( void * arg )
/* Main function */
-int main ( int argc, char * argv[] )
+int main (int argc, char * argv[])
{
int ret = 0, i;
@@ -181,33 +181,33 @@ int main ( int argc, char * argv[] )
/* Initialize barrier */
- ret = pthread_barrier_init( &bar, NULL, 5 );
+ ret = pthread_barrier_init(&bar, NULL, 5);
if (ret != 0)
{
- UNRESOLVED( ret, "Failed to init barrier" );
+ UNRESOLVED(ret, "Failed to init barrier");
}
/* Register the signal handler for SIGUSR1 */
- sigemptyset ( &sa.sa_mask );
+ sigemptyset (&sa.sa_mask);
sa.sa_flags = 0;
sa.sa_handler = sighdl;
- if (( ret = sigaction ( SIGUSR1, &sa, NULL ) ))
+ if ((ret = sigaction (SIGUSR1, &sa, NULL)))
{
- UNRESOLVED( ret, "Unable to register signal handler" );
+ UNRESOLVED(ret, "Unable to register signal handler");
}
- if (( ret = sigaction ( SIGALRM, &sa, NULL ) ))
+ if ((ret = sigaction (SIGALRM, &sa, NULL)))
{
- UNRESOLVED( ret, "Unable to register signal handler" );
+ UNRESOLVED(ret, "Unable to register signal handler");
}
#if VERBOSE > 1
- output( "[parent] Signal handler registered\n" );
+ output("[parent] Signal handler registered\n");
#endif
@@ -215,72 +215,72 @@ int main ( int argc, char * argv[] )
td[ 2 ].policy = td[ 3 ].policy = SCHED_RR;
- td[ 0 ].prio = sched_get_priority_min( SCHED_FIFO );
+ td[ 0 ].prio = sched_get_priority_min(SCHED_FIFO);
if (td[ 0 ].prio == -1)
{
- UNRESOLVED( errno, "Failed to get scheduler range value" );
+ UNRESOLVED(errno, "Failed to get scheduler range value");
}
- td[ 1 ].prio = sched_get_priority_max( SCHED_FIFO );
+ td[ 1 ].prio = sched_get_priority_max(SCHED_FIFO);
if (td[ 1 ].prio == -1)
{
- UNRESOLVED( errno, "Failed to get scheduler range value" );
+ UNRESOLVED(errno, "Failed to get scheduler range value");
}
- td[ 2 ].prio = sched_get_priority_min( SCHED_RR );
+ td[ 2 ].prio = sched_get_priority_min(SCHED_RR);
if (td[ 2 ].prio == -1)
{
- UNRESOLVED( errno, "Failed to get scheduler range value" );
+ UNRESOLVED(errno, "Failed to get scheduler range value");
}
- td[ 3 ].prio = sched_get_priority_max( SCHED_RR );
+ td[ 3 ].prio = sched_get_priority_max(SCHED_RR);
if (td[ 3 ].prio == -1)
{
- UNRESOLVED( errno, "Failed to get scheduler range value" );
+ UNRESOLVED(errno, "Failed to get scheduler range value");
}
/* Initialize the threads attributes and create the RT threads */
for (i = 0; i < 4; i++)
{
- ret = pthread_attr_init( &ta[ i ] );
+ ret = pthread_attr_init(&ta[ i ]);
if (ret != 0)
{
- UNRESOLVED( ret, "Failed to initialize thread attribute" );
+ UNRESOLVED(ret, "Failed to initialize thread attribute");
}
- ret = pthread_attr_setinheritsched( &ta[ i ], PTHREAD_EXPLICIT_SCHED );
+ ret = pthread_attr_setinheritsched(&ta[ i ], PTHREAD_EXPLICIT_SCHED);
if (ret != 0)
{
- UNRESOLVED( ret, "Failed to set explicit scheduling attribute" );
+ UNRESOLVED(ret, "Failed to set explicit scheduling attribute");
}
sp.sched_priority = td[ i ].prio;
- ret = pthread_attr_setschedparam( &ta[ i ], &sp );
+ ret = pthread_attr_setschedparam(&ta[ i ], &sp);
if (ret != 0)
{
- UNRESOLVED( ret, "failed to set thread attribute sched param" );
+ UNRESOLVED(ret, "failed to set thread attribute sched param");
}
- ret = pthread_attr_setschedpolicy( &ta[ i ], td[ i ].policy );
+ ret = pthread_attr_setschedpolicy(&ta[ i ], td[ i ].policy);
if (ret != 0)
{
- UNRESOLVED( ret, "failed to set thread attribute sched prio" );
+ UNRESOLVED(ret, "failed to set thread attribute sched prio");
}
- ret = pthread_create( &td[ i ].thread, &ta[ i ], rt_thread, &bar );
+ ret = pthread_create(&td[ i ].thread, &ta[ i ], rt_thread, &bar);
if (ret != 0)
{
- UNRESOLVED( ret, "Failed to create a RT thread -- need more privilege?" );
+ UNRESOLVED(ret, "Failed to create a RT thread -- need more privilege?");
}
}
@@ -288,52 +288,52 @@ int main ( int argc, char * argv[] )
/* Create the worker threads */
for (i = 0; i < NTHREADS; i++)
{
- ret = pthread_create( &th[ i ], NULL, threaded, NULL );
+ ret = pthread_create(&th[ i ], NULL, threaded, NULL);
if (ret != 0)
{
- UNRESOLVED( ret, "failed to create a worker thread" );
+ UNRESOLVED(ret, "failed to create a worker thread");
}
}
/* Wait for the worker threads to finish */
for (i = 0; i < NTHREADS; i++)
{
- ret = pthread_join( th[ i ], NULL );
+ ret = pthread_join(th[ i ], NULL);
if (ret != 0)
{
- UNRESOLVED( ret, "failed to join a worker thread" );
+ UNRESOLVED(ret, "failed to join a worker thread");
}
}
/* Join the barrier to terminate the RT threads */
- ret = pthread_barrier_wait( &bar );
+ ret = pthread_barrier_wait(&bar);
- if (( ret != 0 ) && ( ret != PTHREAD_BARRIER_SERIAL_THREAD ))
+ if ((ret != 0) && (ret != PTHREAD_BARRIER_SERIAL_THREAD))
{
- UNRESOLVED( ret, "Failed to wait for the barrier" );
+ UNRESOLVED(ret, "Failed to wait for the barrier");
}
/* Join the RT threads */
for (i = 0; i < 4; i++)
{
- ret = pthread_join( td[ i ].thread, NULL );
+ ret = pthread_join(td[ i ].thread, NULL);
if (ret != 0)
{
- UNRESOLVED( ret, "Failed to join a thread" );
+ UNRESOLVED(ret, "Failed to join a thread");
}
}
/* Done! */
- output( "pthread_getschedparam stress test PASSED -- %llu iterations\n", iterations );
+ output("pthread_getschedparam stress test PASSED -- %llu iterations\n", iterations);
- ret = pthread_barrier_destroy( &bar );
+ ret = pthread_barrier_destroy(&bar);
if (ret != 0)
{
- UNRESOLVED( ret, "Failed to destroy the barrier" );
+ UNRESOLVED(ret, "Failed to destroy the barrier");
}
PASSED;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_getschedparam/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/pthread_getschedparam/testfrmw.c
index 38adaa8d9..d075c0b7c 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_getschedparam/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_getschedparam/testfrmw.c
@@ -43,7 +43,7 @@ void output_init()
/* do nothing */
return;
}
-void output( char * string, ... )
+void output(char * string, ...)
{
va_list ap;
char *ts="[??:??:??]";
@@ -57,7 +57,7 @@ void output( char * string, ... )
printf(ts);
else
printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec);
- va_start( ap, string);
+ va_start(ap, string);
vprintf(string, ap);
va_end(ap);
pthread_mutex_unlock(&m_trace);
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_kill/stress.c b/testcases/open_posix_testsuite/stress/threads/pthread_kill/stress.c
index 202c0732d..b5ae7fa3d 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_kill/stress.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_kill/stress.c
@@ -83,7 +83,7 @@ char do_it = 1;
long long iterations = 0;
/* Handler for user request to terminate */
-void sighdl( int sig )
+void sighdl(int sig)
{
/* do_it = 0 */
@@ -94,75 +94,72 @@ void sighdl( int sig )
while (do_it);
}
-void floodsighdl( int sig )
+void floodsighdl(int sig)
{
/* Nothing to do */
return ;
}
/* Signals flood receiver thread */
-void * flood_receiver( void *arg )
+void * flood_receiver(void *arg)
{
int ret = 0;
/* register the signal handler for this one thread */
struct sigaction sa;
- sigemptyset ( &sa.sa_mask );
+ sigemptyset (&sa.sa_mask);
sa.sa_flags = 0;
sa.sa_handler = floodsighdl;
- if (( ret = sigaction ( SIGABRT, &sa, NULL ) ))
- {
- UNRESOLVED( ret, "Unable to register signal handler" );
+ if ((ret = sigaction(SIGABRT, &sa, NULL))) {
+ UNRESOLVED(ret, "Unable to register signal handler");
}
- if (( ret = sigaction ( SIGBUS, &sa, NULL ) ))
+ if ((ret = sigaction(SIGBUS, &sa, NULL)))
{
- UNRESOLVED( ret, "Unable to register signal handler" );
+ UNRESOLVED(ret, "Unable to register signal handler");
}
/* Wait for the other threads to terminate */
- do
- {
+ do {
sched_yield();
- }
- while (*( int * ) arg);
+ } while (*(int *) arg);
return NULL;
}
/* Signal flood threads */
-void * flooder_1( void * arg )
+void * flooder_1(void * arg)
{
int ret = 0;
while (do_it)
{
iterations++;
- ret = pthread_kill( *( pthread_t * ) arg , SIGABRT );
+ ret = pthread_kill(*(pthread_t *) arg , SIGABRT);
if (ret != 0)
{
- UNRESOLVED( ret, "Flooder 1 thread got an error" );
+ UNRESOLVED(ret, "Flooder 1 thread got an error");
}
}
return NULL;
}
-void * flooder_2( void * arg )
+void * flooder_2(void * arg)
{
int ret = 0;
while (do_it)
{
iterations++;
- ret = pthread_kill( *( pthread_t * ) arg , SIGBUS );
+ ret = pthread_kill(*(pthread_t *) arg , SIGBUS);
if (ret != 0)
{
- UNRESOLVED( ret, "Flooder 1 thread got an error" );
+ UNRESOLVED(ret, "Flooder 1 thread got an error");
}
}
@@ -171,38 +168,36 @@ void * flooder_2( void * arg )
/* Synchronized threads */
int sync;
-void syncsighdl( int sig )
+void syncsighdl(int sig)
{
/* signal we have been called*/
sync = 1;
return ;
}
-void * sync_rec( void * arg )
+void * sync_rec(void * arg)
{
int ret = 0;
struct sigaction sa;
- sigemptyset ( &sa.sa_mask );
+ sigemptyset (&sa.sa_mask);
sa.sa_flags = 0;
sa.sa_handler = syncsighdl;
- if (( ret = sigaction ( SIGILL, &sa, NULL ) ))
- {
- UNRESOLVED( ret, "Unable to register signal handler" );
+ if ((ret = sigaction (SIGILL, &sa, NULL))) {
+ UNRESOLVED(ret, "Unable to register signal handler");
}
/* wait until termination */
do
{
sched_yield();
- }
- while (*( int * ) arg);
+ } while (*(int *) arg);
return NULL;
}
-void * sync_send( void * arg )
+void * sync_send(void * arg)
{
int ret = 0;
@@ -211,21 +206,21 @@ void * sync_send( void * arg )
/* Disarm the flag */
sync = 0;
/* Send the signal */
- ret = pthread_kill( *( pthread_t * ) arg, SIGILL );
+ ret = pthread_kill(*(pthread_t *) arg, SIGILL);
if (ret != 0)
{
- UNRESOLVED( ret, "Failed to send signal" );
+ UNRESOLVED(ret, "Failed to send signal");
}
/* Sleep up to 5 sec */
- for (ret = 0; ( ret < 5 ) && ( sync == 0 ); ret++)
- sleep( 1 );
+ for (ret = 0; (ret < 5) && (sync == 0); ret++)
+ sleep(1);
/* Test if signal was received */
if (sync == 0)
{
- FAILED( "Signal SIGILL was not delivered within 5 second -- lost?" );
+ FAILED("Signal SIGILL was not delivered within 5 second -- lost?");
}
}
@@ -234,7 +229,7 @@ void * sync_send( void * arg )
}
/* Main function */
-int main ( int argc, char * argv[] )
+int main (int argc, char * argv[])
{
int ret = 0;
@@ -253,104 +248,102 @@ int main ( int argc, char * argv[] )
output_init();
/* Register the signal handler for SIGUSR1 */
- sigemptyset ( &sa.sa_mask );
+ sigemptyset (&sa.sa_mask);
sa.sa_flags = 0;
sa.sa_handler = sighdl;
- if (( ret = sigaction ( SIGUSR1, &sa, NULL ) ))
- {
- UNRESOLVED( ret, "Unable to register signal handler" );
+ if ((ret = sigaction (SIGUSR1, &sa, NULL))) {
+ UNRESOLVED(ret, "Unable to register signal handler");
}
- if (( ret = sigaction ( SIGALRM, &sa, NULL ) ))
- {
- UNRESOLVED( ret, "Unable to register signal handler" );
+ if ((ret = sigaction (SIGALRM, &sa, NULL))) {
+ UNRESOLVED(ret, "Unable to register signal handler");
}
#if VERBOSE > 1
- output( "[parent] Signal handler registered\n" );
+ output("[parent] Signal handler registered\n");
#endif
- ret = pthread_create( &fl_rec, NULL, flood_receiver, &flooding );
+ ret = pthread_create(&fl_rec, NULL, flood_receiver, &flooding);
if (ret != 0)
{
- UNRESOLVED( ret, "Unable to create a thread" );
+ UNRESOLVED(ret, "Unable to create a thread");
}
- ret = pthread_create( &fl_snd1, NULL, flooder_1, &fl_rec );
+ ret = pthread_create(&fl_snd1, NULL, flooder_1, &fl_rec);
if (ret != 0)
{
- UNRESOLVED( ret, "Unable to create a thread" );
+ UNRESOLVED(ret, "Unable to create a thread");
}
- ret = pthread_create( &fl_snd2, NULL, flooder_2, &fl_rec );
+ ret = pthread_create(&fl_snd2, NULL, flooder_2, &fl_rec);
if (ret != 0)
{
- UNRESOLVED( ret, "Unable to create a thread" );
+ UNRESOLVED(ret, "Unable to create a thread");
}
- ret = pthread_create( &sy_rec, NULL, sync_rec, &synchro );
+ ret = pthread_create(&sy_rec, NULL, sync_rec, &synchro);
if (ret != 0)
{
- UNRESOLVED( ret, "Unable to create a thread" );
+ UNRESOLVED(ret, "Unable to create a thread");
}
- ret = pthread_create( &sy_snd, NULL, sync_send, &sy_rec );
+ ret = pthread_create(&sy_snd, NULL, sync_send, &sy_rec);
if (ret != 0)
{
- UNRESOLVED( ret, "Unable to create a thread" );
+ UNRESOLVED(ret, "Unable to create a thread");
}
/* Wait the user stops the test */
- ret = pthread_join( fl_snd1, NULL );
+ ret = pthread_join(fl_snd1, NULL);
if (ret != 0)
{
- UNRESOLVED( ret, "Failed to join a thread" );
+ UNRESOLVED(ret, "Failed to join a thread");
}
- ret = pthread_join( fl_snd2, NULL );
+ ret = pthread_join(fl_snd2, NULL);
if (ret != 0)
{
- UNRESOLVED( ret, "Failed to join a thread" );
+ UNRESOLVED(ret, "Failed to join a thread");
}
flooding = 0;
- ret = pthread_join( fl_rec, NULL );
+ ret = pthread_join(fl_rec, NULL);
if (ret != 0)
{
- UNRESOLVED( ret, "Failed to join a thread" );
+ UNRESOLVED(ret, "Failed to join a thread");
}
- ret = pthread_join( sy_snd, NULL );
+ ret = pthread_join(sy_snd, NULL);
if (ret != 0)
{
- UNRESOLVED( ret, "Failed to join a thread" );
+ UNRESOLVED(ret, "Failed to join a thread");
}
synchro = 0;
- ret = pthread_join( sy_rec, NULL );
+ ret = pthread_join(sy_rec, NULL);
if (ret != 0)
{
- UNRESOLVED( ret, "Failed to join a thread" );
+ UNRESOLVED(ret, "Failed to join a thread");
}
/* We've been asked to stop */
- output( "pthread_kill stress test PASSED -- %llu iterations\n", iterations );
+ output("pthread_kill stress test PASSED -- %llu iterations\n", iterations);
PASSED;
}
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_kill/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/pthread_kill/testfrmw.c
index 38adaa8d9..d075c0b7c 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_kill/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_kill/testfrmw.c
@@ -43,7 +43,7 @@ void output_init()
/* do nothing */
return;
}
-void output( char * string, ... )
+void output(char * string, ...)
{
va_list ap;
char *ts="[??:??:??]";
@@ -57,7 +57,7 @@ void output( char * string, ... )
printf(ts);
else
printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec);
- va_start( ap, string);
+ va_start(ap, string);
vprintf(string, ap);
va_end(ap);
pthread_mutex_unlock(&m_trace);
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_mutex_init/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/pthread_mutex_init/testfrmw.c
index 9e6f2c285..be39e8918 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_mutex_init/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_mutex_init/testfrmw.c
@@ -40,11 +40,11 @@ void output_init()
/* do nothing */
return;
}
-void output( char * string, ... )
+void output(char * string, ...)
{
va_list ap;
pthread_mutex_lock(&m_trace);
- va_start( ap, string);
+ va_start(ap, string);
vprintf(string, ap);
va_end(ap);
pthread_mutex_unlock(&m_trace);
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_mutex_lock/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/pthread_mutex_lock/testfrmw.c
index 9e6f2c285..be39e8918 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_mutex_lock/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_mutex_lock/testfrmw.c
@@ -40,11 +40,11 @@ void output_init()
/* do nothing */
return;
}
-void output( char * string, ... )
+void output(char * string, ...)
{
va_list ap;
pthread_mutex_lock(&m_trace);
- va_start( ap, string);
+ va_start(ap, string);
vprintf(string, ap);
va_end(ap);
pthread_mutex_unlock(&m_trace);
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_mutex_trylock/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/pthread_mutex_trylock/testfrmw.c
index 38adaa8d9..d075c0b7c 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_mutex_trylock/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_mutex_trylock/testfrmw.c
@@ -43,7 +43,7 @@ void output_init()
/* do nothing */
return;
}
-void output( char * string, ... )
+void output(char * string, ...)
{
va_list ap;
char *ts="[??:??:??]";
@@ -57,7 +57,7 @@ void output( char * string, ... )
printf(ts);
else
printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec);
- va_start( ap, string);
+ va_start(ap, string);
vprintf(string, ap);
va_end(ap);
pthread_mutex_unlock(&m_trace);
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_once/stress.c b/testcases/open_posix_testsuite/stress/threads/pthread_once/stress.c
index 86f0b270a..95e44db55 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_once/stress.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_once/stress.c
@@ -84,7 +84,7 @@ char do_it = 1;
long long iterations = 0;
/* Handler for user request to terminate */
-void sighdl( int sig )
+void sighdl(int sig)
{
do
{
@@ -98,23 +98,23 @@ int once_chk;
pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
-void init_routine( void )
+void init_routine(void)
{
int ret = 0;
- ret = pthread_mutex_lock( &mtx );
+ ret = pthread_mutex_lock(&mtx);
if (ret != 0)
{
- UNRESOLVED( ret, "Failed to lock mutex in initializer" );
+ UNRESOLVED(ret, "Failed to lock mutex in initializer");
}
once_chk++;
- ret = pthread_mutex_unlock( &mtx );
+ ret = pthread_mutex_unlock(&mtx);
if (ret != 0)
{
- UNRESOLVED( ret, "Failed to unlock mutex in initializer" );
+ UNRESOLVED(ret, "Failed to unlock mutex in initializer");
}
return ;
@@ -122,31 +122,31 @@ void init_routine( void )
/* Thread function */
-void * threaded( void * arg )
+void * threaded(void * arg)
{
int ret = 0;
/* Wait for all threads being created */
- ret = pthread_barrier_wait( arg );
+ ret = pthread_barrier_wait(arg);
- if (( ret != 0 ) && ( ret != PTHREAD_BARRIER_SERIAL_THREAD ))
+ if ((ret != 0) && (ret != PTHREAD_BARRIER_SERIAL_THREAD))
{
- UNRESOLVED( ret, "Barrier wait failed" );
+ UNRESOLVED(ret, "Barrier wait failed");
}
/* Call init routine */
- ret = pthread_once( &once_ctl, init_routine );
+ ret = pthread_once(&once_ctl, init_routine);
if (ret != 0)
{
- UNRESOLVED( ret, "pthread_once failed" );
+ UNRESOLVED(ret, "pthread_once failed");
}
return NULL;
}
/* Main function */
-int main ( int argc, char *argv[] )
+int main (int argc, char *argv[])
{
int ret = 0, i;
@@ -161,33 +161,33 @@ int main ( int argc, char *argv[] )
/* Initialize barrier */
- ret = pthread_barrier_init( &bar, NULL, NTHREADS );
+ ret = pthread_barrier_init(&bar, NULL, NTHREADS);
if (ret != 0)
{
- UNRESOLVED( ret, "Failed to init barrier" );
+ UNRESOLVED(ret, "Failed to init barrier");
}
/* Register the signal handler for SIGUSR1 */
- sigemptyset ( &sa.sa_mask );
+ sigemptyset (&sa.sa_mask);
sa.sa_flags = 0;
sa.sa_handler = sighdl;
- if (( ret = sigaction ( SIGUSR1, &sa, NULL ) ))
+ if ((ret = sigaction (SIGUSR1, &sa, NULL)))
{
- UNRESOLVED( ret, "Unable to register signal handler" );
+ UNRESOLVED(ret, "Unable to register signal handler");
}
- if (( ret = sigaction ( SIGALRM, &sa, NULL ) ))
+ if ((ret = sigaction (SIGALRM, &sa, NULL)))
{
- UNRESOLVED( ret, "Unable to register signal handler" );
+ UNRESOLVED(ret, "Unable to register signal handler");
}
#if VERBOSE > 1
- output( "[parent] Signal handler registered\n" );
+ output("[parent] Signal handler registered\n");
#endif
@@ -201,44 +201,44 @@ int main ( int argc, char *argv[] )
for (i = 0; i < NTHREADS; i++)
{
- ret = pthread_create( &th[ i ], NULL, threaded, &bar );
+ ret = pthread_create(&th[ i ], NULL, threaded, &bar);
if (ret != 0)
{
- UNRESOLVED( ret, "Failed to create a thread" );
+ UNRESOLVED(ret, "Failed to create a thread");
}
}
/* Then join */
for (i = 0; i < NTHREADS; i++)
{
- ret = pthread_join( th[ i ], NULL );
+ ret = pthread_join(th[ i ], NULL);
if (ret != 0)
{
- UNRESOLVED( ret, "Failed to join a thread" );
+ UNRESOLVED(ret, "Failed to join a thread");
}
}
/* check the value */
- ret = pthread_mutex_lock( &mtx );
+ ret = pthread_mutex_lock(&mtx);
if (ret != 0)
{
- UNRESOLVED( ret, "Failed to lock mutex in initializer" );
+ UNRESOLVED(ret, "Failed to lock mutex in initializer");
}
if (once_chk != 1)
{
- output( "Control: %d\n", once_chk );
- FAILED( "The initializer function did not execute once" );
+ output("Control: %d\n", once_chk);
+ FAILED("The initializer function did not execute once");
}
- ret = pthread_mutex_unlock( &mtx );
+ ret = pthread_mutex_unlock(&mtx);
if (ret != 0)
{
- UNRESOLVED( ret, "Failed to unlock mutex in initializer" );
+ UNRESOLVED(ret, "Failed to unlock mutex in initializer");
}
iterations++;
@@ -246,13 +246,13 @@ int main ( int argc, char *argv[] )
/* We've been asked to stop */
- output( "pthread_once stress test PASSED -- %llu iterations\n", iterations );
+ output("pthread_once stress test PASSED -- %llu iterations\n", iterations);
- ret = pthread_barrier_destroy( &bar );
+ ret = pthread_barrier_destroy(&bar);
if (ret != 0)
{
- UNRESOLVED( ret, "Failed to destroy the barrier" );
+ UNRESOLVED(ret, "Failed to destroy the barrier");
}
PASSED;
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_once/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/pthread_once/testfrmw.c
index 38adaa8d9..d075c0b7c 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_once/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_once/testfrmw.c
@@ -43,7 +43,7 @@ void output_init()
/* do nothing */
return;
}
-void output( char * string, ... )
+void output(char * string, ...)
{
va_list ap;
char *ts="[??:??:??]";
@@ -57,7 +57,7 @@ void output( char * string, ... )
printf(ts);
else
printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec);
- va_start( ap, string);
+ va_start(ap, string);
vprintf(string, ap);
va_end(ap);
pthread_mutex_unlock(&m_trace);
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_self/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/pthread_self/testfrmw.c
index 38adaa8d9..d075c0b7c 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_self/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_self/testfrmw.c
@@ -43,7 +43,7 @@ void output_init()
/* do nothing */
return;
}
-void output( char * string, ... )
+void output(char * string, ...)
{
va_list ap;
char *ts="[??:??:??]";
@@ -57,7 +57,7 @@ void output( char * string, ... )
printf(ts);
else
printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec);
- va_start( ap, string);
+ va_start(ap, string);
vprintf(string, ap);
va_end(ap);
pthread_mutex_unlock(&m_trace);
diff --git a/testcases/open_posix_testsuite/stress/threads/pthread_self/threads_scenarii.c b/testcases/open_posix_testsuite/stress/threads/pthread_self/threads_scenarii.c
index 694b95fd6..9c433fd62 100644
--- a/testcases/open_posix_testsuite/stress/threads/pthread_self/threads_scenarii.c
+++ b/testcases/open_posix_testsuite/stress/threads/pthread_self/threads_scenarii.c
@@ -77,82 +77,82 @@ struct __scenario
{
/* Unary tests */
-/* 0*/ CASE_POS( 0, 0, 0, 0, 0, 0, 0, 0, "default")
+/* 0*/ CASE_POS(0, 0, 0, 0, 0, 0, 0, 0, "default")
-/* 1*/ ,CASE_POS( 1, 0, 0, 0, 0, 0, 0, 0, "detached")
-/* 2*/ ,CASE_POS( 0, 1, 0, 0, 0, 0, 0, 0, "Explicit sched")
-/* 3*/ ,CASE_UNK( 0, 0, 1, 0, 0, 0, 0, 0, "FIFO Policy")
-/* 4*/ ,CASE_UNK( 0, 0, 2, 0, 0, 0, 0, 0, "RR Policy")
-/* 5*/ ,CASE_UNK( 0, 0, 0, 1, 0, 0, 0, 0, "Max sched param")
-/* 6*/ ,CASE_UNK( 0, 0, 0,-1, 0, 0, 0, 0, "Min sched param")
-/* 7*/ ,CASE_POS( 0, 0, 0, 0, 1, 0, 0, 0, "Alternative contension scope")
-/* 8*/ ,CASE_POS( 0, 0, 0, 0, 0, 1, 0, 0, "Alternative stack")
-/* 9*/ ,CASE_POS( 0, 0, 0, 0, 0, 0, 1, 0, "No guard size")
-/*10*/ ,CASE_UNK( 0, 0, 0, 0, 0, 0, 2, 0, "1p guard size")
-/*11*/ ,CASE_POS( 0, 0, 0, 0, 0, 0, 0, 1, "Min stack size")
+/* 1*/ ,CASE_POS(1, 0, 0, 0, 0, 0, 0, 0, "detached")
+/* 2*/ ,CASE_POS(0, 1, 0, 0, 0, 0, 0, 0, "Explicit sched")
+/* 3*/ ,CASE_UNK(0, 0, 1, 0, 0, 0, 0, 0, "FIFO Policy")
+/* 4*/ ,CASE_UNK(0, 0, 2, 0, 0, 0, 0, 0, "RR Policy")
+/* 5*/ ,CASE_UNK(0, 0, 0, 1, 0, 0, 0, 0, "Max sched param")
+/* 6*/ ,CASE_UNK(0, 0, 0,-1, 0, 0, 0, 0, "Min sched param")
+/* 7*/ ,CASE_POS(0, 0, 0, 0, 1, 0, 0, 0, "Alternative contension scope")
+/* 8*/ ,CASE_POS(0, 0, 0, 0, 0, 1, 0, 0, "Alternative stack")
+/* 9*/ ,CASE_POS(0, 0, 0, 0, 0, 0, 1, 0, "No guard size")
+/*10*/ ,CASE_UNK(0, 0, 0, 0, 0, 0, 2, 0, "1p guard size")
+/*11*/ ,CASE_POS(0, 0, 0, 0, 0, 0, 0, 1, "Min stack size")
/* We create several instances of the basic cases for the pthread_self testing */
-/* 0*/ ,CASE_POS( 0, 0, 0, 0, 0, 0, 0, 0, "default")
-/* 1*/ ,CASE_POS( 1, 0, 0, 0, 0, 0, 0, 0, "detached")
-/* 2*/ ,CASE_POS( 0, 1, 0, 0, 0, 0, 0, 0, "Explicit sched")
-/* 3*/ ,CASE_UNK( 0, 0, 1, 0, 0, 0, 0, 0, "FIFO Policy")
-/* 4*/ ,CASE_UNK( 0, 0, 2, 0, 0, 0, 0, 0, "RR Policy")
-/* 5*/ ,CASE_UNK( 0, 0, 0, 1, 0, 0, 0, 0, "Max sched param")
-/* 6*/ ,CASE_UNK( 0, 0, 0,-1, 0, 0, 0, 0, "Min sched param")
-/* 7*/ ,CASE_POS( 0, 0, 0, 0, 1, 0, 0, 0, "Alternative contension scope")
-/* 8*/ /*,CASE_POS( 0, 0, 0, 0, 0, 1, 0, 0, "Alternative stack")*/
-/* 9*/ ,CASE_POS( 0, 0, 0, 0, 0, 0, 1, 0, "No guard size")
-/*10*/ ,CASE_UNK( 0, 0, 0, 0, 0, 0, 2, 0, "1p guard size")
-/*11*/ ,CASE_POS( 0, 0, 0, 0, 0, 0, 0, 1, "Min stack size")
-/* 0*/ ,CASE_POS( 0, 0, 0, 0, 0, 0, 0, 0, "default")
-/* 1*/ ,CASE_POS( 1, 0, 0, 0, 0, 0, 0, 0, "detached")
-/* 2*/ ,CASE_POS( 0, 1, 0, 0, 0, 0, 0, 0, "Explicit sched")
-/* 3*/ ,CASE_UNK( 0, 0, 1, 0, 0, 0, 0, 0, "FIFO Policy")
-/* 4*/ ,CASE_UNK( 0, 0, 2, 0, 0, 0, 0, 0, "RR Policy")
-/* 5*/ ,CASE_UNK( 0, 0, 0, 1, 0, 0, 0, 0, "Max sched param")
-/* 6*/ ,CASE_UNK( 0, 0, 0,-1, 0, 0, 0, 0, "Min sched param")
-/* 7*/ ,CASE_POS( 0, 0, 0, 0, 1, 0, 0, 0, "Alternative contension scope")
-/* 8*/ /*,CASE_POS( 0, 0, 0, 0, 0, 1, 0, 0, "Alternative stack")*/
-/* 9*/ ,CASE_POS( 0, 0, 0, 0, 0, 0, 1, 0, "No guard size")
-/*10*/ ,CASE_UNK( 0, 0, 0, 0, 0, 0, 2, 0, "1p guard size")
-/*11*/ ,CASE_POS( 0, 0, 0, 0, 0, 0, 0, 1, "Min stack size")
-/* 0*/ ,CASE_POS( 0, 0, 0, 0, 0, 0, 0, 0, "default")
-/* 1*/ ,CASE_POS( 1, 0, 0, 0, 0, 0, 0, 0, "detached")
-/* 2*/ ,CASE_POS( 0, 1, 0, 0, 0, 0, 0, 0, "Explicit sched")
-/* 3*/ ,CASE_UNK( 0, 0, 1, 0, 0, 0, 0, 0, "FIFO Policy")
-/* 4*/ ,CASE_UNK( 0, 0, 2, 0, 0, 0, 0, 0, "RR Policy")
-/* 5*/ ,CASE_UNK( 0, 0, 0, 1, 0, 0, 0, 0, "Max sched param")
-/* 6*/ ,CASE_UNK( 0, 0, 0,-1, 0, 0, 0, 0, "Min sched param")
-/* 7*/ ,CASE_POS( 0, 0, 0, 0, 1, 0, 0, 0, "Alternative contension scope")
-/* 8*/ /*,CASE_POS( 0, 0, 0, 0, 0, 1, 0, 0, "Alternative stack")*/
-/* 9*/ ,CASE_POS( 0, 0, 0, 0, 0, 0, 1, 0, "No guard size")
-/*10*/ ,CASE_UNK( 0, 0, 0, 0, 0, 0, 2, 0, "1p guard size")
-/*11*/ ,CASE_POS( 0, 0, 0, 0, 0, 0, 0, 1, "Min stack size")
+/* 0*/ ,CASE_POS(0, 0, 0, 0, 0, 0, 0, 0, "default")
+/* 1*/ ,CASE_POS(1, 0, 0, 0, 0, 0, 0, 0, "detached")
+/* 2*/ ,CASE_POS(0, 1, 0, 0, 0, 0, 0, 0, "Explicit sched")
+/* 3*/ ,CASE_UNK(0, 0, 1, 0, 0, 0, 0, 0, "FIFO Policy")
+/* 4*/ ,CASE_UNK(0, 0, 2, 0, 0, 0, 0, 0, "RR Policy")
+/* 5*/ ,CASE_UNK(0, 0, 0, 1, 0, 0, 0, 0, "Max sched param")
+/* 6*/ ,CASE_UNK(0, 0, 0,-1, 0, 0, 0, 0, "Min sched param")
+/* 7*/ ,CASE_POS(0, 0, 0, 0, 1, 0, 0, 0, "Alternative contension scope")
+/* 8*/ /*,CASE_POS(0, 0, 0, 0, 0, 1, 0, 0, "Alternative stack")*/
+/* 9*/ ,CASE_POS(0, 0, 0, 0, 0, 0, 1, 0, "No guard size")
+/*10*/ ,CASE_UNK(0, 0, 0, 0, 0, 0, 2, 0, "1p guard size")
+/*11*/ ,CASE_POS(0, 0, 0, 0, 0, 0, 0, 1, "Min stack size")
+/* 0*/ ,CASE_POS(0, 0, 0, 0, 0, 0, 0, 0, "default")
+/* 1*/ ,CASE_POS(1, 0, 0, 0, 0, 0, 0, 0, "detached")
+/* 2*/ ,CASE_POS(0, 1, 0, 0, 0, 0, 0, 0, "Explicit sched")
+/* 3*/ ,CASE_UNK(0, 0, 1, 0, 0, 0, 0, 0, "FIFO Policy")
+/* 4*/ ,CASE_UNK(0, 0, 2, 0, 0, 0, 0, 0, "RR Policy")
+/* 5*/ ,CASE_UNK(0, 0, 0, 1, 0, 0, 0, 0, "Max sched param")
+/* 6*/ ,CASE_UNK(0, 0, 0,-1, 0, 0, 0, 0, "Min sched param")
+/* 7*/ ,CASE_POS(0, 0, 0, 0, 1, 0, 0, 0, "Alternative contension scope")
+/* 8*/ /*,CASE_POS(0, 0, 0, 0, 0, 1, 0, 0, "Alternative stack")*/
+/* 9*/ ,CASE_POS(0, 0, 0, 0, 0, 0, 1, 0, "No guard size")
+/*10*/ ,CASE_UNK(0, 0, 0, 0, 0, 0, 2, 0, "1p guard size")
+/*11*/ ,CASE_POS(0, 0, 0, 0, 0, 0, 0, 1, "Min stack size")
+/* 0*/ ,CASE_POS(0, 0, 0, 0, 0, 0, 0, 0, "default")
+/* 1*/ ,CASE_POS(1, 0, 0, 0, 0, 0, 0, 0, "detached")
+/* 2*/ ,CASE_POS(0, 1, 0, 0, 0, 0, 0, 0, "Explicit sched")
+/* 3*/ ,CASE_UNK(0, 0, 1, 0, 0, 0, 0, 0, "FIFO Policy")
+/* 4*/ ,CASE_UNK(0, 0, 2, 0, 0, 0, 0, 0, "RR Policy")
+/* 5*/ ,CASE_UNK(0, 0, 0, 1, 0, 0, 0, 0, "Max sched param")
+/* 6*/ ,CASE_UNK(0, 0, 0,-1, 0, 0, 0, 0, "Min sched param")
+/* 7*/ ,CASE_POS(0, 0, 0, 0, 1, 0, 0, 0, "Alternative contension scope")
+/* 8*/ /*,CASE_POS(0, 0, 0, 0, 0, 1, 0, 0, "Alternative stack")*/
+/* 9*/ ,CASE_POS(0, 0, 0, 0, 0, 0, 1, 0, "No guard size")
+/*10*/ ,CASE_UNK(0, 0, 0, 0, 0, 0, 2, 0, "1p guard size")
+/*11*/ ,CASE_POS(0, 0, 0, 0, 0, 0, 0, 1, "Min stack size")
/* Stack play */
- ,CASE_POS( 0, 0, 0, 0, 0, 0, 1, 1, "Min stack size, no guard")
- ,CASE_UNK( 0, 0, 0, 0, 0, 0, 2, 1, "Min stack size, 1p guard")
- /*,CASE_POS( 1, 0, 0, 0, 0, 1, 0, 0, "Detached, Alternative stack") */
- ,CASE_POS( 1, 0, 0, 0, 0, 0, 1, 1, "Detached, Min stack size, no guard")
- ,CASE_UNK( 1, 0, 0, 0, 0, 0, 2, 1, "Detached, Min stack size, 1p guard")
+ ,CASE_POS(0, 0, 0, 0, 0, 0, 1, 1, "Min stack size, no guard")
+ ,CASE_UNK(0, 0, 0, 0, 0, 0, 2, 1, "Min stack size, 1p guard")
+ /*,CASE_POS(1, 0, 0, 0, 0, 1, 0, 0, "Detached, Alternative stack") */
+ ,CASE_POS(1, 0, 0, 0, 0, 0, 1, 1, "Detached, Min stack size, no guard")
+ ,CASE_UNK(1, 0, 0, 0, 0, 0, 2, 1, "Detached, Min stack size, 1p guard")
/* Scheduling play -- all results are unknown since it might depend on the user priviledges */
- ,CASE_UNK( 0, 1, 1, 1, 0, 0, 0, 0, "Explicit FIFO max param")
- ,CASE_UNK( 0, 1, 2, 1, 0, 0, 0, 0, "Explicit RR max param")
- ,CASE_UNK( 0, 1, 1,-1, 0, 0, 0, 0, "Explicit FIFO min param")
- ,CASE_UNK( 0, 1, 2,-1, 0, 0, 0, 0, "Explicit RR min param")
- ,CASE_UNK( 0, 1, 1, 1, 1, 0, 0, 0, "Explicit FIFO max param, alt scope")
- ,CASE_UNK( 0, 1, 2, 1, 1, 0, 0, 0, "Explicit RR max param, alt scope")
- ,CASE_UNK( 0, 1, 1,-1, 1, 0, 0, 0, "Explicit FIFO min param, alt scope")
- ,CASE_UNK( 0, 1, 2,-1, 1, 0, 0, 0, "Explicit RR min param, alt scope")
- ,CASE_UNK( 1, 1, 1, 1, 0, 0, 0, 0, "Detached, explicit FIFO max param")
- ,CASE_UNK( 1, 1, 2, 1, 0, 0, 0, 0, "Detached, explicit RR max param")
- ,CASE_UNK( 1, 1, 1,-1, 0, 0, 0, 0, "Detached, explicit FIFO min param")
- ,CASE_UNK( 1, 1, 2,-1, 0, 0, 0, 0, "Detached, explicit RR min param")
- ,CASE_UNK( 1, 1, 1, 1, 1, 0, 0, 0, "Detached, explicit FIFO max param, alt scope")
- ,CASE_UNK( 1, 1, 2, 1, 1, 0, 0, 0, "Detached, explicit RR max param, alt scope")
- ,CASE_UNK( 1, 1, 1,-1, 1, 0, 0, 0, "Detached, explicit FIFO min param, alt scope")
- ,CASE_UNK( 1, 1, 2,-1, 1, 0, 0, 0, "Detached, explicit RR min param, alt scope")
+ ,CASE_UNK(0, 1, 1, 1, 0, 0, 0, 0, "Explicit FIFO max param")
+ ,CASE_UNK(0, 1, 2, 1, 0, 0, 0, 0, "Explicit RR max param")
+ ,CASE_UNK(0, 1, 1,-1, 0, 0, 0, 0, "Explicit FIFO min param")
+ ,CASE_UNK(0, 1, 2,-1, 0, 0, 0, 0, "Explicit RR min param")
+ ,CASE_UNK(0, 1, 1, 1, 1, 0, 0, 0, "Explicit FIFO max param, alt scope")
+ ,CASE_UNK(0, 1, 2, 1, 1, 0, 0, 0, "Explicit RR max param, alt scope")
+ ,CASE_UNK(0, 1, 1,-1, 1, 0, 0, 0, "Explicit FIFO min param, alt scope")
+ ,CASE_UNK(0, 1, 2,-1, 1, 0, 0, 0, "Explicit RR min param, alt scope")
+ ,CASE_UNK(1, 1, 1, 1, 0, 0, 0, 0, "Detached, explicit FIFO max param")
+ ,CASE_UNK(1, 1, 2, 1, 0, 0, 0, 0, "Detached, explicit RR max param")
+ ,CASE_UNK(1, 1, 1,-1, 0, 0, 0, 0, "Detached, explicit FIFO min param")
+ ,CASE_UNK(1, 1, 2,-1, 0, 0, 0, 0, "Detached, explicit RR min param")
+ ,CASE_UNK(1, 1, 1, 1, 1, 0, 0, 0, "Detached, explicit FIFO max param, alt scope")
+ ,CASE_UNK(1, 1, 2, 1, 1, 0, 0, 0, "Detached, explicit RR max param, alt scope")
+ ,CASE_UNK(1, 1, 1,-1, 1, 0, 0, 0, "Detached, explicit FIFO min param, alt scope")
+ ,CASE_UNK(1, 1, 2,-1, 1, 0, 0, 0, "Detached, explicit RR min param, alt scope")
};
#define NSCENAR (sizeof(scenarii) / sizeof(scenarii[0]))
diff --git a/testcases/open_posix_testsuite/stress/threads/sem_getvalue/stress.c b/testcases/open_posix_testsuite/stress/threads/sem_getvalue/stress.c
index 83d575039..bcb5bfa92 100644
--- a/testcases/open_posix_testsuite/stress/threads/sem_getvalue/stress.c
+++ b/testcases/open_posix_testsuite/stress/threads/sem_getvalue/stress.c
@@ -88,7 +88,7 @@ char do_it = 1;
long long iterations = 0;
/* Handler for user request to terminate */
-void sighdl( int sig )
+void sighdl(int sig)
{
/* do_it = 0 */
@@ -101,40 +101,36 @@ void sighdl( int sig )
/* Thread function */
-void * threaded( void * arg )
+void* threaded(void *arg)
{
int ret = 0;
- do
- {
+ do {
/* sem_post */
- ret = sem_post( arg );
+ ret = sem_post(arg);
if (ret != 0)
{
- UNRESOLVED( errno, "Failed to post the semaphore" );
+ UNRESOLVED(errno, "Failed to post the semaphore");
}
/* sem wait */
- do
- {
- ret = sem_wait( arg );
- }
- while (( ret != 0 ) && ( errno == EINTR ));
+ do {
+ ret = sem_wait(arg);
+ } while ((ret != 0) && (errno == EINTR));
if (ret != 0)
{
- UNRESOLVED( errno, "Failed to wait for the semaphore" );
+ UNRESOLVED(errno, "Failed to wait for the semaphore");
}
- }
- while (do_it);
+ } while (do_it);
return NULL;
}
/* Main function */
-int main ( int argc, char *argv[] )
+int main (int argc, char *argv[])
{
int ret = 0, value;
@@ -148,132 +144,148 @@ int main ( int argc, char *argv[] )
output_init();
/* Register the signal handler for SIGUSR1 */
- sigemptyset ( &sa.sa_mask );
+ sigemptyset (&sa.sa_mask);
sa.sa_flags = 0;
sa.sa_handler = sighdl;
+<<<<<<< HEAD
if (( ret = sigaction ( SIGUSR1, &sa, NULL ) ))
+=======
+ if ((ret = sigaction (SIGUSR1, &sa, NULL)))
+>>>>>>> origin
{
- UNRESOLVED( ret, "Unable to register signal handler" );
+ UNRESOLVED(ret, "Unable to register signal handler");
}
+<<<<<<< HEAD
if (( ret = sigaction ( SIGALRM, &sa, NULL ) ))
+=======
+ if ((ret = sigaction (SIGALRM, &sa, NULL)))
+>>>>>>> origin
{
- UNRESOLVED( ret, "Unable to register signal handler" );
+ UNRESOLVED(ret, "Unable to register signal handler");
}
#if VERBOSE > 1
- output( "[parent] Signal handler registered\n" );
+ output("[parent] Signal handler registered\n");
#endif
/* Initialize the semaphores */
- named = sem_open( SEM_NAME, O_CREAT, 0777, INIT_VAL );
+ named = sem_open(SEM_NAME, O_CREAT, 0777, INIT_VAL);
if (named == SEM_FAILED)
{
- UNRESOLVED( errno, "Failed to sem_open" );
+ UNRESOLVED(errno, "Failed to sem_open");
}
- ret = sem_unlink( SEM_NAME );
+ ret = sem_unlink(SEM_NAME);
if (ret != 0)
{
- UNRESOLVED( errno, "Failed to sem_unlink" );
+ UNRESOLVED(errno, "Failed to sem_unlink");
}
- ret = sem_init( &unnamed, 0, INIT_VAL );
+ ret = sem_init(&unnamed, 0, INIT_VAL);
if (ret != 0)
{
- UNRESOLVED( errno, "Failed to sem_init" );
+ UNRESOLVED(errno, "Failed to sem_init");
}
/* Create the threads */
- ret = pthread_create( &child1, NULL, threaded, named );
+ ret = pthread_create(&child1, NULL, threaded, named);
if (ret != 0)
{
- UNRESOLVED( ret, "Failed to create a thread" );
+ UNRESOLVED(ret, "Failed to create a thread");
}
- ret = pthread_create( &child2, NULL, threaded, &unnamed );
+ ret = pthread_create(&child2, NULL, threaded, &unnamed);
if (ret != 0)
{
- UNRESOLVED( ret, "Failed to create a thread" );
+ UNRESOLVED(ret, "Failed to create a thread");
}
/* loop */
while (do_it)
{
- ret = sem_getvalue( named, &value );
+ ret = sem_getvalue(named, &value);
if (ret != 0)
{
- UNRESOLVED( errno, "Failed to get sem value" );
+ UNRESOLVED(errno, "Failed to get sem value");
}
+<<<<<<< HEAD
if (( value != INIT_VAL ) && ( value != INIT_VAL + 1 ))
+=======
+ if ((value != INIT_VAL) && (value != INIT_VAL + 1))
+>>>>>>> origin
{
- output( "Got value %d, expected %d or %d only\n",
- value, INIT_VAL, INIT_VAL + 1 );
- FAILED( "sem_getvalue returned an invalid value for the named semaphore" );
+ output("Got value %d, expected %d or %d only\n",
+ value, INIT_VAL, INIT_VAL + 1);
+ FAILED("sem_getvalue returned an invalid value for the named semaphore");
}
- ret = sem_getvalue( &unnamed, &value );
+ ret = sem_getvalue(&unnamed, &value);
if (ret != 0)
{
- UNRESOLVED( errno, "Failed to get sem value" );
+ UNRESOLVED(errno, "Failed to get sem value");
}
+<<<<<<< HEAD
if (( value != INIT_VAL ) && ( value != INIT_VAL + 1 ))
+=======
+ if ((value != INIT_VAL) && (value != INIT_VAL + 1))
+>>>>>>> origin
{
- output( "Got value %d, expected %d or %d only\n",
- value, INIT_VAL, INIT_VAL + 1 );
- FAILED( "sem_getvalue returned an invalid value for the unnamed semaphore" );
+ output("Got value %d, expected %d or %d only\n",
+ value, INIT_VAL, INIT_VAL + 1);
+ FAILED("sem_getvalue returned an invalid value for the unnamed semaphore");
}
iterations++;
}
/* Join the threads */
- ret = pthread_join( child1, NULL );
+ ret = pthread_join(child1, NULL);
if (ret != 0)
{
- UNRESOLVED( ret, "Failed to join a thread" );
+ UNRESOLVED(ret, "Failed to join a thread");
}
- ret = pthread_join( child2, NULL );
+ ret = pthread_join(child2, NULL);
if (ret != 0)
{
- UNRESOLVED( ret, "Failed to join a thread" );
+ UNRESOLVED(ret, "Failed to join a thread");
}
/* Destroy the semaphores */
- ret = sem_close( named );
+ ret = sem_close(named);
if (ret != 0)
{
- UNRESOLVED( errno, "Failed to close the semaphore" );
+ UNRESOLVED(errno, "Failed to close the semaphore");
}
- ret = sem_destroy( &unnamed );
+ ret = sem_destroy(&unnamed);
if (ret != 0)
{
- UNRESOLVED( errno, "Failed to destroy the semaphore" );
+ UNRESOLVED(errno, "Failed to destroy the semaphore");
}
/* Passed */
- output( "pthread_exit stress test PASSED -- %llu iterations\n", iterations );
+ output("pthread_exit stress test PASSED -- %llu iterations\n", iterations);
PASSED;
}
diff --git a/testcases/open_posix_testsuite/stress/threads/sem_getvalue/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/sem_getvalue/testfrmw.c
index 38adaa8d9..d075c0b7c 100644
--- a/testcases/open_posix_testsuite/stress/threads/sem_getvalue/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/sem_getvalue/testfrmw.c
@@ -43,7 +43,7 @@ void output_init()
/* do nothing */
return;
}
-void output( char * string, ... )
+void output(char * string, ...)
{
va_list ap;
char *ts="[??:??:??]";
@@ -57,7 +57,7 @@ void output( char * string, ... )
printf(ts);
else
printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec);
- va_start( ap, string);
+ va_start(ap, string);
vprintf(string, ap);
va_end(ap);
pthread_mutex_unlock(&m_trace);
diff --git a/testcases/open_posix_testsuite/stress/threads/sem_init/s-c1.c b/testcases/open_posix_testsuite/stress/threads/sem_init/s-c1.c
index a6f0498d4..c5bb77524 100644
--- a/testcases/open_posix_testsuite/stress/threads/sem_init/s-c1.c
+++ b/testcases/open_posix_testsuite/stress/threads/sem_init/s-c1.c
@@ -80,7 +80,7 @@
#define BLOCKSIZE (1000 * SCALABILITY_FACTOR)
-#define NSEM_LIMIT ( 1000 * BLOCKSIZE )
+#define NSEM_LIMIT (1000 * BLOCKSIZE)
#ifdef PLOT_OUTPUT
#undef VERBOSE
@@ -107,7 +107,7 @@ typedef struct __mes_t
mes_t;
/* Forward declaration */
-int parse_measure( mes_t * measures );
+int parse_measure(mes_t * measures);
/* Structure to store created semaphores */
@@ -125,7 +125,7 @@ test_t;
/* Test routine */
-int main ( int argc, char *argv[] )
+int main (int argc, char *argv[])
{
int ret, status, locerrno;
int nsem, i;
@@ -138,7 +138,7 @@ int main ( int argc, char *argv[] )
struct __test_t * sems_cur = &sems, * sems_tmp;
- long SEM_MAX = sysconf( _SC_SEM_NSEMS_MAX );
+ long SEM_MAX = sysconf(_SC_SEM_NSEMS_MAX);
/* Initialize the measure list */
m_cur = &sentinel;
@@ -154,12 +154,12 @@ int main ( int argc, char *argv[] )
#if VERBOSE > 1
- output( "SEM_NSEMS_MAX: %ld\n", SEM_MAX );
+ output("SEM_NSEMS_MAX: %ld\n", SEM_MAX);
#endif
#ifdef PLOT_OUTPUT
- output( "# COLUMNS 3 Semaphores sem_init sem_destroy\n" );
+ output("# COLUMNS 3 Semaphores sem_init sem_destroy\n");
#endif
@@ -169,13 +169,13 @@ int main ( int argc, char *argv[] )
while (1) /* we will break */
{
/* Create a new block */
- sems_tmp = ( test_t * ) malloc( sizeof( test_t ) );
+ sems_tmp = (test_t *) malloc(sizeof(test_t));
if (sems_tmp == NULL)
{
/* We stop here */
#if VERBOSE > 0
- output( "malloc failed with error %d (%s)\n", errno, strerror( errno ) );
+ output("malloc failed with error %d (%s)\n", errno, strerror(errno));
#endif
/* We can proceed anyway */
status = 1;
@@ -186,52 +186,51 @@ int main ( int argc, char *argv[] )
/* read clock */
- ret = clock_gettime( CLOCK_REALTIME, &ts_ref );
+ ret = clock_gettime(CLOCK_REALTIME, &ts_ref);
if (ret != 0)
{
- UNRESOLVED( errno, "Unable to read clock" );
+ UNRESOLVED(errno, "Unable to read clock");
}
/* Open all semaphores in the current block */
for (i = 0; i < BLOCKSIZE; i++)
{
- ret = sem_init( &( sems_tmp->sems[ i ] ), i & 1, i & 3 );
+ ret = sem_init(&(sems_tmp->sems[ i ]), i & 1, i & 3);
if (ret != 0)
{
#if VERBOSE > 0
- output( "sem_init failed with error %d (%s)\n", errno, strerror( errno ) );
+ output("sem_init failed with error %d (%s)\n", errno, strerror(errno));
#endif
/* Check error code */
-
- if (( errno == EMFILE ) || ( errno == ENFILE ) || ( errno == ENOSPC ) || ( errno == ENOMEM ))
- {
+ switch (errno) {
+ case EMFILE:
+ case ENFILE:
+ case ENOSPC:
+ case ENOMEM:
status = 2;
- }
- else
- {
- UNRESOLVED( errno, "Unexpected error!" );
- }
+ break;
+ default:
+ UNRESOLVED(errno, "Unexpected error!");
break;
}
- if (( SEM_MAX > 0 ) && ( nsem > SEM_MAX ))
+ if ((SEM_MAX > 0) && (nsem > SEM_MAX))
{
- /* Erreur */
- FAILED( "sem_open opened more than SEM_NSEMS_MAX semaphores" );
+ FAILED("sem_open opened more than SEM_NSEMS_MAX semaphores");
}
nsem++;
}
/* read clock */
- ret = clock_gettime( CLOCK_REALTIME, &ts_fin );
+ ret = clock_gettime(CLOCK_REALTIME, &ts_fin);
if (ret != 0)
{
- UNRESOLVED( errno, "Unable to read clock" );
+ UNRESOLVED(errno, "Unable to read clock");
}
if (status == 2)
@@ -240,16 +239,16 @@ int main ( int argc, char *argv[] )
for (--i; i >= 0; i--)
{
- ret = sem_destroy( &( sems_tmp->sems[ i ] ) );
+ ret = sem_destroy(&(sems_tmp->sems[ i ]));
if (ret != 0)
{
- UNRESOLVED( errno, "Failed to close" );
+ UNRESOLVED(errno, "Failed to close");
}
}
- free( sems_tmp );
+ free(sems_tmp);
break;
@@ -261,13 +260,13 @@ int main ( int argc, char *argv[] )
sems_cur->next = NULL;
/* add to the measure list */
- m_tmp = ( mes_t * ) malloc( sizeof( mes_t ) );
+ m_tmp = (mes_t *) malloc(sizeof(mes_t));
if (m_tmp == NULL)
{
/* We stop here */
#if VERBOSE > 0
- output( "malloc failed with error %d (%s)\n", errno, strerror( errno ) );
+ output("malloc failed with error %d (%s)\n", errno, strerror(errno));
#endif
/* We can proceed anyway */
status = 3;
@@ -282,7 +281,7 @@ int main ( int argc, char *argv[] )
m_cur = m_tmp;
- m_cur->_data_open = ( ( ts_fin.tv_sec - ts_ref.tv_sec ) * 1000000 ) + ( ( ts_fin.tv_nsec - ts_ref.tv_nsec ) / 1000 ) ;
+ m_cur->_data_open = ((ts_fin.tv_sec - ts_ref.tv_sec) * 1000000) + ((ts_fin.tv_nsec - ts_ref.tv_nsec) / 1000) ;
m_cur->_data_close = 0 ;
if (nsem >= NSEM_LIMIT)
@@ -293,7 +292,7 @@ int main ( int argc, char *argv[] )
/* Free all semaphore blocs */
#if VERBOSE > 0
- output( "Detroy and free semaphores\n" );
+ output("Detroy and free semaphores\n");
#endif
@@ -302,63 +301,63 @@ int main ( int argc, char *argv[] )
while (sems_cur != &sems)
{
/* read clock */
- ret = clock_gettime( CLOCK_REALTIME, &ts_ref );
+ ret = clock_gettime(CLOCK_REALTIME, &ts_ref);
if (ret != 0)
{
- UNRESOLVED( errno, "Unable to read clock" );
+ UNRESOLVED(errno, "Unable to read clock");
}
/* Empty the sems_cur block */
for (i = 0; i < BLOCKSIZE; i++)
{
- ret = sem_destroy( &( sems_cur->sems[ i ] ) );
+ ret = sem_destroy(&(sems_cur->sems[ i ]));
if (ret != 0)
{
- UNRESOLVED( errno, "Failed to destroy a semaphore" );
+ UNRESOLVED(errno, "Failed to destroy a semaphore");
}
}
/* read clock */
- ret = clock_gettime( CLOCK_REALTIME, &ts_fin );
+ ret = clock_gettime(CLOCK_REALTIME, &ts_fin);
if (ret != 0)
{
- UNRESOLVED( errno, "Unable to read clock" );
+ UNRESOLVED(errno, "Unable to read clock");
}
/* add this measure to measure list */
- m_cur->_data_close = ( ( ts_fin.tv_sec - ts_ref.tv_sec ) * 1000000 ) + ( ( ts_fin.tv_nsec - ts_ref.tv_nsec ) / 1000 ) ;
+ m_cur->_data_close = ((ts_fin.tv_sec - ts_ref.tv_sec) * 1000000) + ((ts_fin.tv_nsec - ts_ref.tv_nsec) / 1000) ;
m_cur = m_cur->prev;
/* remove the sem bloc */
sems_cur = sems_cur->prev;
- free( sems_cur->next );
+ free(sems_cur->next);
sems_cur->next = NULL;
}
#if VERBOSE > 0
- output( "Parse results\n" );
+ output("Parse results\n");
#endif
/* Compute the results */
- ret = parse_measure( &sentinel );
+ ret = parse_measure(&sentinel);
/* Free the resources and output the results */
#if VERBOSE > 5
- output( "Dump : \n" );
+ output("Dump : \n");
- output( " nsem | open | close \n" );
+ output(" nsem | open | close \n");
#endif
@@ -366,7 +365,7 @@ int main ( int argc, char *argv[] )
{
m_cur = sentinel.next;
#if (VERBOSE > 5) || defined(PLOT_OUTPUT)
- output( "%8.8i %1.1li.%6.6li %1.1li.%6.6li\n"
+ output("%8.8i %1.1li.%6.6li %1.1li.%6.6li\n"
, m_cur->nsem
, m_cur->_data_open / 1000000 , m_cur->_data_open % 1000000
, m_cur->_data_close / 1000000, m_cur->_data_close % 1000000
@@ -375,28 +374,28 @@ int main ( int argc, char *argv[] )
#endif
sentinel.next = m_cur->next;
- free( m_cur );
+ free(m_cur);
}
if (ret != 0)
{
- FAILED( "The function is not scalable, add verbosity for more information" );
+ FAILED("The function is not scalable, add verbosity for more information");
}
/* Check status */
if (status)
{
- UNRESOLVED( locerrno, "Function is scalable, but test terminated with error" );
+ UNRESOLVED(locerrno, "Function is scalable, but test terminated with error");
}
#if VERBOSE > 0
- output( "-----\n" );
+ output("-----\n");
- output( "All test data destroyed\n" );
+ output("All test data destroyed\n");
- output( "Test PASSED\n" );
+ output("Test PASSED\n");
#endif
@@ -411,11 +410,11 @@ int main ( int argc, char *argv[] )
* The next function will seek for the better model for each series of measurements.
*
* The tested models are: -- X = # threads; Y = latency
- * -> Y = a; -- Error is r1 = avg( (Y - Yavg)² );
- * -> Y = aX + b; -- Error is r2 = avg( (Y -aX -b)² );
- * -- where a = avg ( (X - Xavg)(Y - Yavg) ) / avg( ( X - Xavg)² )
- * -- Note: We will call _q = sum( (X - Xavg) * (Y - Yavg) );
- * -- and _d = sum( (X - Xavg)² );
+ * -> Y = a; -- Error is r1 = avg((Y - Yavg)²);
+ * -> Y = aX + b; -- Error is r2 = avg((Y -aX -b)²);
+ * -- where a = avg ((X - Xavg)(Y - Yavg)) / avg((X - Xavg)²)
+ * -- Note: We will call _q = sum((X - Xavg) * (Y - Yavg));
+ * -- and _d = sum((X - Xavg)²);
* -- and b = Yavg - a * Xavg
* -> Y = c * X^a;-- Same as previous, but with log(Y) = a log(X) + b; and b = log(c). Error is r3
* -> Y = exp(aX + b); -- log(Y) = aX + b. Error is r4
@@ -440,7 +439,7 @@ struct row
double _lny_c; /* Value LnY - LnYavg */
};
-int parse_measure( mes_t * measures )
+int parse_measure(mes_t * measures)
{
int ret, r;
@@ -501,7 +500,7 @@ int parse_measure( mes_t * measures )
cur = measures;
#if VERBOSE > 1
- output( "Data analysis starting\n" );
+ output("Data analysis starting\n");
#endif
/* We start with reading the list to find:
@@ -518,12 +517,12 @@ int parse_measure( mes_t * measures )
if (cur->_data_open != 0)
{
array_max = N;
- Xavg += ( double ) cur->nsem;
- LnXavg += log( ( double ) cur->nsem );
- Yavg_o += ( double ) cur->_data_open;
- LnYavg_o += log( ( double ) cur->_data_open );
- Yavg_c += ( double ) cur->_data_close;
- LnYavg_c += log( ( double ) cur->_data_close );
+ Xavg += (double) cur->nsem;
+ LnXavg += log((double) cur->nsem);
+ Yavg_o += (double) cur->_data_open;
+ LnYavg_o += log((double) cur->_data_open);
+ Yavg_c += (double) cur->_data_close;
+ LnYavg_c += log((double) cur->_data_close);
}
}
@@ -540,18 +539,18 @@ int parse_measure( mes_t * measures )
}
#if VERBOSE > 1
- output( " Found %d rows\n", N );
+ output(" Found %d rows\n", N);
#endif
/* We will now alloc the array ... */
- Table = calloc( N, sizeof( struct row ) );
+ Table = calloc(N, sizeof(struct row));
if (Table == NULL)
{
- UNRESOLVED( errno, "Unable to alloc space for results parsing" );
+ UNRESOLVED(errno, "Unable to alloc space for results parsing");
}
/* ... and fill it */
@@ -563,8 +562,8 @@ int parse_measure( mes_t * measures )
{
cur = cur->next;
- Table[ N ].X = ( long ) cur->nsem;
- Table[ N ].LnX = log( ( double ) cur->nsem );
+ Table[ N ].X = (long) cur->nsem;
+ Table[ N ].LnX = log((double) cur->nsem);
if (array_max > N)
{
@@ -572,11 +571,11 @@ int parse_measure( mes_t * measures )
Table[ N ]._lnx = Table[ N ].LnX - LnXavg;
Table[ N ].Y_o = cur->_data_open;
Table[ N ]._y_o = Table[ N ].Y_o - Yavg_o ;
- Table[ N ].LnY_o = log( ( double ) cur->_data_open );
+ Table[ N ].LnY_o = log((double) cur->_data_open);
Table[ N ]._lny_o = Table[ N ].LnY_o - LnYavg_o;
Table[ N ].Y_c = cur->_data_close;
Table[ N ]._y_c = Table[ N ].Y_c - Yavg_c ;
- Table[ N ].LnY_c = log( ( double ) cur->_data_close );
+ Table[ N ].LnY_c = log((double) cur->_data_close);
Table[ N ]._lny_c = Table[ N ].LnY_c - LnYavg_c;
}
@@ -585,7 +584,7 @@ int parse_measure( mes_t * measures )
/* We won't need the list anymore -- we'll work with the array which should be faster. */
#if VERBOSE > 1
- output( " Data was stored in an array.\n" );
+ output(" Data was stored in an array.\n");
#endif
@@ -596,12 +595,12 @@ int parse_measure( mes_t * measures )
* -> "a" factor for linear (0), power (1) and exponential (2) approximations -- with using the _d and _q vars.
*/
#if VERBOSE > 1
- output( "Starting first pass...\n" );
+ output("Starting first pass...\n");
#endif
for (r = 0; r < array_max; r++)
{
- r1_o += ( ( double ) Table[ r ]._y_o / array_max ) * ( double ) Table[ r ]._y_o;
+ r1_o += ((double) Table[ r ]._y_o / array_max) * (double) Table[ r ]._y_o;
_q_o[ 0 ] += Table[ r ]._y_o * Table[ r ]._x;
_d_o[ 0 ] += Table[ r ]._x * Table[ r ]._x;
@@ -613,7 +612,7 @@ int parse_measure( mes_t * measures )
_d_o[ 2 ] += Table[ r ]._x * Table[ r ]._x;
- r1_c += ( ( double ) Table[ r ]._y_c / array_max ) * ( double ) Table[ r ]._y_c;
+ r1_c += ((double) Table[ r ]._y_c / array_max) * (double) Table[ r ]._y_c;
_q_c[ 0 ] += Table[ r ]._y_c * Table[ r ]._x;
_d_c[ 0 ] += Table[ r ]._x * Table[ r ]._x;
@@ -633,125 +632,125 @@ int parse_measure( mes_t * measures )
*/
#if VERBOSE > 1
- output( "Starting second pass...\n" );
+ output("Starting second pass...\n");
#endif
for (r = 0; r < array_max; r++)
{
/* r2 = avg((y - ax -b)²); t = (y - ax - b) = (y - yavg) - a (x - xavg); */
- t = ( Table[ r ]._y_o - ( ( _q_o[ 0 ] * Table[ r ]._x ) / _d_o[ 0 ] ) );
+ t = (Table[ r ]._y_o - ((_q_o[ 0 ] * Table[ r ]._x) / _d_o[ 0 ]));
r2_o += t * t / array_max ;
- t = ( Table[ r ]._y_c - ( ( _q_c[ 0 ] * Table[ r ]._x ) / _d_c[ 0 ] ) );
+ t = (Table[ r ]._y_c - ((_q_c[ 0 ] * Table[ r ]._x) / _d_c[ 0 ]));
r2_c += t * t / array_max ;
- /* r3 = avg(( y - c.x^a) ²);
+ /* r3 = avg((y - c.x^a) ²);
t = y - c * x ^ a
= y - log (LnYavg - (_q[1]/_d[1]) * LnXavg) * x ^ (_q[1]/_d[1])
*/
- t = ( Table[ r ].Y_o
- - ( logl ( LnYavg_o - ( _q_o[ 1 ] / _d_o[ 1 ] ) * LnXavg )
- * powl( Table[ r ].X, ( _q_o[ 1 ] / _d_o[ 1 ] ) )
- ) );
+ t = (Table[ r ].Y_o
+ - (logl (LnYavg_o - (_q_o[ 1 ] / _d_o[ 1 ]) * LnXavg)
+ * powl(Table[ r ].X, (_q_o[ 1 ] / _d_o[ 1 ]))
+ ));
r3_o += t * t / array_max ;
- t = ( Table[ r ].Y_c
- - ( logl ( LnYavg_c - ( _q_c[ 1 ] / _d_c[ 1 ] ) * LnXavg )
- * powl( Table[ r ].X, ( _q_c[ 1 ] / _d_c[ 1 ] ) )
- ) );
+ t = (Table[ r ].Y_c
+ - (logl (LnYavg_c - (_q_c[ 1 ] / _d_c[ 1 ]) * LnXavg)
+ * powl(Table[ r ].X, (_q_c[ 1 ] / _d_c[ 1 ]))
+ ));
r3_c += t * t / array_max ;
- /* r4 = avg(( y - exp(ax+b))²);
+ /* r4 = avg((y - exp(ax+b))²);
t = y - exp(ax+b)
- = y - exp( _q[2]/_d[2] * x + ( LnYavg - (_q[2]/_d[2] * Xavg) ));
- = y - exp( _q[2]/_d[2] * (x - Xavg) + LnYavg );
+ = y - exp(_q[2]/_d[2] * x + (LnYavg - (_q[2]/_d[2] * Xavg)));
+ = y - exp(_q[2]/_d[2] * (x - Xavg) + LnYavg);
*/
- t = ( Table[ r ].Y_o
- - expl( ( _q_o[ 2 ] / _d_o[ 2 ] ) * Table[ r ]._x + LnYavg_o ) );
+ t = (Table[ r ].Y_o
+ - expl((_q_o[ 2 ] / _d_o[ 2 ]) * Table[ r ]._x + LnYavg_o));
r4_o += t * t / array_max ;
- t = ( Table[ r ].Y_c
- - expl( ( _q_c[ 2 ] / _d_c[ 2 ] ) * Table[ r ]._x + LnYavg_c ) );
+ t = (Table[ r ].Y_c
+ - expl((_q_c[ 2 ] / _d_c[ 2 ]) * Table[ r ]._x + LnYavg_c));
r4_c += t * t / array_max ;
}
#if VERBOSE > 1
- output( "All computing terminated.\n" );
+ output("All computing terminated.\n");
#endif
ret = 0;
#if VERBOSE > 1
- output( " # of data: %i\n", array_max );
+ output(" # of data: %i\n", array_max);
- output( " Model: Y = k\n" );
+ output(" Model: Y = k\n");
- output( " sem_open:\n" );
+ output(" sem_open:\n");
- output( " k = %g\n", Yavg_o );
+ output(" k = %g\n", Yavg_o);
- output( " Divergence %g\n", r1_o );
+ output(" Divergence %g\n", r1_o);
- output( " sem_close:\n" );
+ output(" sem_close:\n");
- output( " k = %g\n", Yavg_c );
+ output(" k = %g\n", Yavg_c);
- output( " Divergence %g\n", r1_c );
+ output(" Divergence %g\n", r1_c);
- output( " Model: Y = a * X + b\n" );
+ output(" Model: Y = a * X + b\n");
- output( " sem_open:\n" );
+ output(" sem_open:\n");
- output( " a = %Lg\n", _q_o[ 0 ] / _d_o[ 0 ] );
+ output(" a = %Lg\n", _q_o[ 0 ] / _d_o[ 0 ]);
- output( " b = %Lg\n", Yavg_o - ( ( _q_o[ 0 ] / _d_o[ 0 ] ) * Xavg ) );
+ output(" b = %Lg\n", Yavg_o - ((_q_o[ 0 ] / _d_o[ 0 ]) * Xavg));
- output( " Divergence %g\n", r2_o );
+ output(" Divergence %g\n", r2_o);
- output( " sem_close:\n" );
+ output(" sem_close:\n");
- output( " a = %Lg\n", _q_c[ 0 ] / _d_c[ 0 ] );
+ output(" a = %Lg\n", _q_c[ 0 ] / _d_c[ 0 ]);
- output( " b = %Lg\n", Yavg_c - ( ( _q_c[ 0 ] / _d_c[ 0 ] ) * Xavg ) );
+ output(" b = %Lg\n", Yavg_c - ((_q_c[ 0 ] / _d_c[ 0 ]) * Xavg));
- output( " Divergence %g\n", r2_c );
+ output(" Divergence %g\n", r2_c);
- output( " Model: Y = c * X ^ a\n" );
+ output(" Model: Y = c * X ^ a\n");
- output( " sem_open:\n" );
+ output(" sem_open:\n");
- output( " a = %Lg\n", _q_o[ 1 ] / _d_o[ 1 ] );
+ output(" a = %Lg\n", _q_o[ 1 ] / _d_o[ 1 ]);
- output( " c = %Lg\n", logl ( LnYavg_o - ( _q_o[ 1 ] / _d_o[ 1 ] ) * LnXavg ) );
+ output(" c = %Lg\n", logl (LnYavg_o - (_q_o[ 1 ] / _d_o[ 1 ]) * LnXavg));
- output( " Divergence %g\n", r3_o );
+ output(" Divergence %g\n", r3_o);
- output( " sem_close:\n" );
+ output(" sem_close:\n");
- output( " a = %Lg\n", _q_c[ 1 ] / _d_c[ 1 ] );
+ output(" a = %Lg\n", _q_c[ 1 ] / _d_c[ 1 ]);
- output( " c = %Lg\n", logl ( LnYavg_c - ( _q_c[ 1 ] / _d_c[ 1 ] ) * LnXavg ) );
+ output(" c = %Lg\n", logl (LnYavg_c - (_q_c[ 1 ] / _d_c[ 1 ]) * LnXavg));
- output( " Divergence %g\n", r3_c );
+ output(" Divergence %g\n", r3_c);
- output( " Model: Y = exp(a * X + b)\n" );
+ output(" Model: Y = exp(a * X + b)\n");
- output( " sem_open:\n" );
+ output(" sem_open:\n");
- output( " a = %Lg\n", _q_o[ 2 ] / _d_o[ 2 ] );
+ output(" a = %Lg\n", _q_o[ 2 ] / _d_o[ 2 ]);
- output( " b = %Lg\n", LnYavg_o - ( ( _q_o[ 2 ] / _d_o[ 2 ] ) * Xavg ) );
+ output(" b = %Lg\n", LnYavg_o - ((_q_o[ 2 ] / _d_o[ 2 ]) * Xavg));
- output( " Divergence %g\n", r4_o );
+ output(" Divergence %g\n", r4_o);
- output( " sem_close:\n" );
+ output(" sem_close:\n");
- output( " a = %Lg\n", _q_c[ 2 ] / _d_c[ 2 ] );
+ output(" a = %Lg\n", _q_c[ 2 ] / _d_c[ 2 ]);
- output( " b = %Lg\n", LnYavg_c - ( ( _q_c[ 2 ] / _d_c[ 2 ] ) * Xavg ) );
+ output(" b = %Lg\n", LnYavg_c - ((_q_c[ 2 ] / _d_c[ 2 ]) * Xavg));
- output( " Divergence %g\n", r4_c );
+ output(" Divergence %g\n", r4_c);
#endif
@@ -759,20 +758,21 @@ int parse_measure( mes_t * measures )
{
/* Compare r1 to other values, with some ponderations */
- if (( r1_o > 1.1 * r2_o ) || ( r1_o > 1.2 * r3_o ) || ( r1_o > 1.3 * r4_o)
- || ( r1_c > 1.1 * r2_c ) || ( r1_c > 1.2 * r3_c ) || ( r1_c > 1.3 * r4_c ) )
+ if ((r1_o > 1.1 * r2_o) || (r1_o > 1.2 * r3_o) ||
+ (r1_o > 1.3 * r4_o) || (r1_c > 1.1 * r2_c) ||
+ (r1_c > 1.2 * r3_c) || (r1_c > 1.3 * r4_c))
ret++;
#if VERBOSE > 1
else
- output( " Sanction: OK\n" );
+ output(" Sanction: OK\n");
#endif
}
/* We need to free the array */
- free( Table );
+ free(Table);
/* We're done */
return ret;
diff --git a/testcases/open_posix_testsuite/stress/threads/sem_init/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/sem_init/testfrmw.c
index 38adaa8d9..d075c0b7c 100644
--- a/testcases/open_posix_testsuite/stress/threads/sem_init/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/sem_init/testfrmw.c
@@ -43,7 +43,7 @@ void output_init()
/* do nothing */
return;
}
-void output( char * string, ... )
+void output(char * string, ...)
{
va_list ap;
char *ts="[??:??:??]";
@@ -57,7 +57,7 @@ void output( char * string, ... )
printf(ts);
else
printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec);
- va_start( ap, string);
+ va_start(ap, string);
vprintf(string, ap);
va_end(ap);
pthread_mutex_unlock(&m_trace);
diff --git a/testcases/open_posix_testsuite/stress/threads/sem_open/s-c1.c b/testcases/open_posix_testsuite/stress/threads/sem_open/s-c1.c
index e48d0d2fd..1bc4909ed 100644
--- a/testcases/open_posix_testsuite/stress/threads/sem_open/s-c1.c
+++ b/testcases/open_posix_testsuite/stress/threads/sem_open/s-c1.c
@@ -106,7 +106,7 @@ typedef struct __mes_t
mes_t;
/* Forward declaration */
-int parse_measure( mes_t * measures );
+int parse_measure(mes_t * measures);
/* Structure to store created semaphores */
@@ -124,7 +124,7 @@ test_t;
/* Test routine */
-int main ( int argc, char *argv[] )
+int main (int argc, char *argv[])
{
int ret, status, locerrno;
int nsem, i;
@@ -138,7 +138,7 @@ int main ( int argc, char *argv[] )
struct __test_t * sems_cur = &sems, * sems_tmp;
- long SEM_MAX = sysconf( _SC_SEM_NSEMS_MAX );
+ long SEM_MAX = sysconf(_SC_SEM_NSEMS_MAX);
/* Initialize the measure list */
m_cur = &sentinel;
@@ -154,12 +154,12 @@ int main ( int argc, char *argv[] )
#if VERBOSE > 1
- output( "SEM_NSEMS_MAX: %ld\n", SEM_MAX );
+ output("SEM_NSEMS_MAX: %ld\n", SEM_MAX);
#endif
#ifdef PLOT_OUTPUT
- output( "# COLUMNS 3 Semaphores sem_open sem_close\n" );
+ output("# COLUMNS 3 Semaphores sem_open sem_close\n");
#endif
@@ -169,13 +169,13 @@ int main ( int argc, char *argv[] )
while (1) /* we will break */
{
/* Create a new block */
- sems_tmp = ( test_t * ) malloc( sizeof( test_t ) );
+ sems_tmp = (test_t *) malloc(sizeof(test_t));
if (sems_tmp == NULL)
{
/* We stop here */
#if VERBOSE > 0
- output( "malloc failed with error %d (%s)\n", errno, strerror( errno ) );
+ output("malloc failed with error %d (%s)\n", errno, strerror(errno));
#endif
/* We can proceed anyway */
status = 1;
@@ -186,53 +186,55 @@ int main ( int argc, char *argv[] )
/* read clock */
- ret = clock_gettime( CLOCK_REALTIME, &ts_ref );
+ ret = clock_gettime(CLOCK_REALTIME, &ts_ref);
if (ret != 0)
{
- UNRESOLVED( errno, "Unable to read clock" );
+ UNRESOLVED(errno, "Unable to read clock");
}
/* Open all semaphores in the current block */
for (i = 0; i < BLOCKSIZE; i++)
{
- sprintf( sem_name, "/sem_open_scal_s%d", nsem );
- sems_tmp->sems[ i ] = sem_open( sem_name, O_CREAT, 0777, 1 );
+ sprintf(sem_name, "/sem_open_scal_s%d", nsem);
+ sems_tmp->sems[ i ] = sem_open(sem_name, O_CREAT, 0777, 1);
if (sems_tmp->sems[ i ] == SEM_FAILED)
{
#if VERBOSE > 0
- output( "sem_open failed with error %d (%s)\n", errno, strerror( errno ) );
+ output("sem_open failed with error %d (%s)\n", errno, strerror(errno));
#endif
/* Check error code */
- if (( errno == EMFILE ) || ( errno == ENFILE ) || ( errno == ENOSPC ) || ( errno == ENOMEM ))
- {
+ switch (errno) {
+ case EMFILE:
+ case ENFILE:
+ case ENOSPC:
+ case ENOMEM:
status = 2;
- }
- else
- {
- UNRESOLVED( errno, "Unexpected error!" );
+ break;
+ default:
+ UNRESOLVED(errno, "Unexpected error!");
}
break;
}
- if (( SEM_MAX > 0 ) && ( nsem > SEM_MAX ))
+ if ((SEM_MAX > 0) && (nsem > SEM_MAX))
{
/* Erreur */
- FAILED( "sem_open opened more than SEM_NSEMS_MAX semaphores" );
+ FAILED("sem_open opened more than SEM_NSEMS_MAX semaphores");
}
nsem++;
}
/* read clock */
- ret = clock_gettime( CLOCK_REALTIME, &ts_fin );
+ ret = clock_gettime(CLOCK_REALTIME, &ts_fin);
if (ret != 0)
{
- UNRESOLVED( errno, "Unable to read clock" );
+ UNRESOLVED(errno, "Unable to read clock");
}
if (status == 2)
@@ -241,16 +243,16 @@ int main ( int argc, char *argv[] )
for (--i; i >= 0; i--)
{
- ret = sem_close( sems_tmp->sems[ i ] );
+ ret = sem_close(sems_tmp->sems[ i ]);
if (ret != 0)
{
- UNRESOLVED( errno, "Failed to close" );
+ UNRESOLVED(errno, "Failed to close");
}
}
- free( sems_tmp );
+ free(sems_tmp);
break;
@@ -262,13 +264,13 @@ int main ( int argc, char *argv[] )
sems_cur->next = NULL;
/* add to the measure list */
- m_tmp = ( mes_t * ) malloc( sizeof( mes_t ) );
+ m_tmp = (mes_t *) malloc(sizeof(mes_t));
if (m_tmp == NULL)
{
/* We stop here */
#if VERBOSE > 0
- output( "malloc failed with error %d (%s)\n", errno, strerror( errno ) );
+ output("malloc failed with error %d (%s)\n", errno, strerror(errno));
#endif
/* We can proceed anyway */
status = 3;
@@ -283,7 +285,7 @@ int main ( int argc, char *argv[] )
m_cur = m_tmp;
- m_cur->_data_open = ( ( ts_fin.tv_sec - ts_ref.tv_sec ) * 1000000 ) + ( ( ts_fin.tv_nsec - ts_ref.tv_nsec ) / 1000 ) ;
+ m_cur->_data_open = ((ts_fin.tv_sec - ts_ref.tv_sec) * 1000000) + ((ts_fin.tv_nsec - ts_ref.tv_nsec) / 1000) ;
m_cur->_data_close = 0 ;
}
@@ -291,18 +293,18 @@ int main ( int argc, char *argv[] )
/* Unlink all existing semaphores */
#if VERBOSE > 0
- output( "Unlinking %d semaphores\n", nsem );
+ output("Unlinking %d semaphores\n", nsem);
#endif
for (i = 0; i <= nsem; i++)
{
- sprintf( sem_name, "/sem_open_scal_s%d", i );
- sem_unlink( sem_name );
+ sprintf(sem_name, "/sem_open_scal_s%d", i);
+ sem_unlink(sem_name);
}
/* Free all semaphore blocs */
#if VERBOSE > 0
- output( "Close and free semaphores (this can take up to 10 minutes)\n" );
+ output("Close and free semaphores (this can take up to 10 minutes)\n");
#endif
@@ -310,63 +312,63 @@ int main ( int argc, char *argv[] )
while (sems_cur != &sems)
{
/* read clock */
- ret = clock_gettime( CLOCK_REALTIME, &ts_ref );
+ ret = clock_gettime(CLOCK_REALTIME, &ts_ref);
if (ret != 0)
{
- UNRESOLVED( errno, "Unable to read clock" );
+ UNRESOLVED(errno, "Unable to read clock");
}
/* Empty the sems_cur block */
for (i = 0; i < BLOCKSIZE; i++)
{
- ret = sem_close( sems_cur->sems[ i ] );
+ ret = sem_close(sems_cur->sems[ i ]);
if (ret != 0)
{
- UNRESOLVED( errno, "Failed to close a semaphore" );
+ UNRESOLVED(errno, "Failed to close a semaphore");
}
}
/* read clock */
- ret = clock_gettime( CLOCK_REALTIME, &ts_fin );
+ ret = clock_gettime(CLOCK_REALTIME, &ts_fin);
if (ret != 0)
{
- UNRESOLVED( errno, "Unable to read clock" );
+ UNRESOLVED(errno, "Unable to read clock");
}
/* add this measure to measure list */
- m_cur->_data_close = ( ( ts_fin.tv_sec - ts_ref.tv_sec ) * 1000000 ) + ( ( ts_fin.tv_nsec - ts_ref.tv_nsec ) / 1000 ) ;
+ m_cur->_data_close = ((ts_fin.tv_sec - ts_ref.tv_sec) * 1000000) + ((ts_fin.tv_nsec - ts_ref.tv_nsec) / 1000) ;
m_cur = m_cur->prev;
/* remove the sem bloc */
sems_cur = sems_cur->prev;
- free( sems_cur->next );
+ free(sems_cur->next);
sems_cur->next = NULL;
}
#if VERBOSE > 0
- output( "Parse results\n" );
+ output("Parse results\n");
#endif
/* Compute the results */
- ret = parse_measure( &sentinel );
+ ret = parse_measure(&sentinel);
/* Free the resources and output the results */
#if VERBOSE > 5
- output( "Dump : \n" );
+ output("Dump : \n");
- output( " nsem | open | close \n" );
+ output(" nsem | open | close \n");
#endif
@@ -374,7 +376,7 @@ int main ( int argc, char *argv[] )
{
m_cur = sentinel.next;
#if (VERBOSE > 5) || defined(PLOT_OUTPUT)
- output( "%8.8i %1.1li.%6.6li %1.1li.%6.6li\n"
+ output("%8.8i %1.1li.%6.6li %1.1li.%6.6li\n"
, m_cur->nsem
, m_cur->_data_open / 1000000 , m_cur->_data_open % 1000000
, m_cur->_data_close / 1000000, m_cur->_data_close % 1000000
@@ -383,28 +385,28 @@ int main ( int argc, char *argv[] )
#endif
sentinel.next = m_cur->next;
- free( m_cur );
+ free(m_cur);
}
if (ret != 0)
{
- FAILED( "The function is not scalable, add verbosity for more information" );
+ FAILED("The function is not scalable, add verbosity for more information");
}
/* Check status */
if (status)
{
- UNRESOLVED( locerrno, "Function is scalable, but test terminated with error" );
+ UNRESOLVED(locerrno, "Function is scalable, but test terminated with error");
}
#if VERBOSE > 0
- output( "-----\n" );
+ output("-----\n");
- output( "All test data destroyed\n" );
+ output("All test data destroyed\n");
- output( "Test PASSED\n" );
+ output("Test PASSED\n");
#endif
@@ -419,11 +421,11 @@ int main ( int argc, char *argv[] )
* The next function will seek for the better model for each series of measurements.
*
* The tested models are: -- X = # threads; Y = latency
- * -> Y = a; -- Error is r1 = avg( (Y - Yavg)² );
- * -> Y = aX + b; -- Error is r2 = avg( (Y -aX -b)² );
- * -- where a = avg ( (X - Xavg)(Y - Yavg) ) / avg( ( X - Xavg)² )
- * -- Note: We will call _q = sum( (X - Xavg) * (Y - Yavg) );
- * -- and _d = sum( (X - Xavg)² );
+ * -> Y = a; -- Error is r1 = avg((Y - Yavg)²);
+ * -> Y = aX + b; -- Error is r2 = avg((Y -aX -b)²);
+ * -- where a = avg ((X - Xavg)(Y - Yavg)) / avg((X - Xavg)²)
+ * -- Note: We will call _q = sum((X - Xavg) * (Y - Yavg));
+ * -- and _d = sum((X - Xavg)²);
* -- and b = Yavg - a * Xavg
* -> Y = c * X^a;-- Same as previous, but with log(Y) = a log(X) + b; and b = log(c). Error is r3
* -> Y = exp(aX + b); -- log(Y) = aX + b. Error is r4
@@ -448,7 +450,7 @@ struct row
double _lny_c; /* Value LnY - LnYavg */
};
-int parse_measure( mes_t * measures )
+int parse_measure(mes_t * measures)
{
int ret, r;
@@ -509,7 +511,7 @@ int parse_measure( mes_t * measures )
cur = measures;
#if VERBOSE > 1
- output( "Data analysis starting\n" );
+ output("Data analysis starting\n");
#endif
/* We start with reading the list to find:
@@ -526,12 +528,12 @@ int parse_measure( mes_t * measures )
if (cur->_data_open != 0)
{
array_max = N;
- Xavg += ( double ) cur->nsem;
- LnXavg += log( ( double ) cur->nsem );
- Yavg_o += ( double ) cur->_data_open;
- LnYavg_o += log( ( double ) cur->_data_open );
- Yavg_c += ( double ) cur->_data_close;
- LnYavg_c += log( ( double ) cur->_data_close );
+ Xavg += (double) cur->nsem;
+ LnXavg += log((double) cur->nsem);
+ Yavg_o += (double) cur->_data_open;
+ LnYavg_o += log((double) cur->_data_open);
+ Yavg_c += (double) cur->_data_close;
+ LnYavg_c += log((double) cur->_data_close);
}
}
@@ -548,18 +550,18 @@ int parse_measure( mes_t * measures )
}
#if VERBOSE > 1
- output( " Found %d rows\n", N );
+ output(" Found %d rows\n", N);
#endif
/* We will now alloc the array ... */
- Table = calloc( N, sizeof( struct row ) );
+ Table = calloc(N, sizeof(struct row));
if (Table == NULL)
{
- UNRESOLVED( errno, "Unable to alloc space for results parsing" );
+ UNRESOLVED(errno, "Unable to alloc space for results parsing");
}
/* ... and fill it */
@@ -571,8 +573,8 @@ int parse_measure( mes_t * measures )
{
cur = cur->next;
- Table[ N ].X = ( long ) cur->nsem;
- Table[ N ].LnX = log( ( double ) cur->nsem );
+ Table[ N ].X = (long) cur->nsem;
+ Table[ N ].LnX = log((double) cur->nsem);
if (array_max > N)
{
@@ -580,11 +582,11 @@ int parse_measure( mes_t * measures )
Table[ N ]._lnx = Table[ N ].LnX - LnXavg;
Table[ N ].Y_o = cur->_data_open;
Table[ N ]._y_o = Table[ N ].Y_o - Yavg_o ;
- Table[ N ].LnY_o = log( ( double ) cur->_data_open );
+ Table[ N ].LnY_o = log((double) cur->_data_open);
Table[ N ]._lny_o = Table[ N ].LnY_o - LnYavg_o;
Table[ N ].Y_c = cur->_data_close;
Table[ N ]._y_c = Table[ N ].Y_c - Yavg_c ;
- Table[ N ].LnY_c = log( ( double ) cur->_data_close );
+ Table[ N ].LnY_c = log((double) cur->_data_close);
Table[ N ]._lny_c = Table[ N ].LnY_c - LnYavg_c;
}
@@ -593,7 +595,7 @@ int parse_measure( mes_t * measures )
/* We won't need the list anymore -- we'll work with the array which should be faster. */
#if VERBOSE > 1
- output( " Data was stored in an array.\n" );
+ output(" Data was stored in an array.\n");
#endif
@@ -604,12 +606,12 @@ int parse_measure( mes_t * measures )
* -> "a" factor for linear (0), power (1) and exponential (2) approximations -- with using the _d and _q vars.
*/
#if VERBOSE > 1
- output( "Starting first pass...\n" );
+ output("Starting first pass...\n");
#endif
for (r = 0; r < array_max; r++)
{
- r1_o += ( ( double ) Table[ r ]._y_o / array_max ) * ( double ) Table[ r ]._y_o;
+ r1_o += ((double) Table[ r ]._y_o / array_max) * (double) Table[ r ]._y_o;
_q_o[ 0 ] += Table[ r ]._y_o * Table[ r ]._x;
_d_o[ 0 ] += Table[ r ]._x * Table[ r ]._x;
@@ -621,7 +623,7 @@ int parse_measure( mes_t * measures )
_d_o[ 2 ] += Table[ r ]._x * Table[ r ]._x;
- r1_c += ( ( double ) Table[ r ]._y_c / array_max ) * ( double ) Table[ r ]._y_c;
+ r1_c += ((double) Table[ r ]._y_c / array_max) * (double) Table[ r ]._y_c;
_q_c[ 0 ] += Table[ r ]._y_c * Table[ r ]._x;
_d_c[ 0 ] += Table[ r ]._x * Table[ r ]._x;
@@ -641,125 +643,125 @@ int parse_measure( mes_t * measures )
*/
#if VERBOSE > 1
- output( "Starting second pass...\n" );
+ output("Starting second pass...\n");
#endif
for (r = 0; r < array_max; r++)
{
/* r2 = avg((y - ax -b)²); t = (y - ax - b) = (y - yavg) - a (x - xavg); */
- t = ( Table[ r ]._y_o - ( ( _q_o[ 0 ] * Table[ r ]._x ) / _d_o[ 0 ] ) );
+ t = (Table[ r ]._y_o - ((_q_o[ 0 ] * Table[ r ]._x) / _d_o[ 0 ]));
r2_o += t * t / array_max ;
- t = ( Table[ r ]._y_c - ( ( _q_c[ 0 ] * Table[ r ]._x ) / _d_c[ 0 ] ) );
+ t = (Table[ r ]._y_c - ((_q_c[ 0 ] * Table[ r ]._x) / _d_c[ 0 ]));
r2_c += t * t / array_max ;
- /* r3 = avg(( y - c.x^a) ²);
+ /* r3 = avg((y - c.x^a) ²);
t = y - c * x ^ a
= y - log (LnYavg - (_q[1]/_d[1]) * LnXavg) * x ^ (_q[1]/_d[1])
*/
- t = ( Table[ r ].Y_o
- - ( logl ( LnYavg_o - ( _q_o[ 1 ] / _d_o[ 1 ] ) * LnXavg )
- * powl( Table[ r ].X, ( _q_o[ 1 ] / _d_o[ 1 ] ) )
- ) );
+ t = (Table[ r ].Y_o
+ - (logl (LnYavg_o - (_q_o[ 1 ] / _d_o[ 1 ]) * LnXavg)
+ * powl(Table[ r ].X, (_q_o[ 1 ] / _d_o[ 1 ]))
+ ));
r3_o += t * t / array_max ;
- t = ( Table[ r ].Y_c
- - ( logl ( LnYavg_c - ( _q_c[ 1 ] / _d_c[ 1 ] ) * LnXavg )
- * powl( Table[ r ].X, ( _q_c[ 1 ] / _d_c[ 1 ] ) )
- ) );
+ t = (Table[ r ].Y_c
+ - (logl (LnYavg_c - (_q_c[ 1 ] / _d_c[ 1 ]) * LnXavg)
+ * powl(Table[ r ].X, (_q_c[ 1 ] / _d_c[ 1 ]))
+ ));
r3_c += t * t / array_max ;
- /* r4 = avg(( y - exp(ax+b))²);
+ /* r4 = avg((y - exp(ax+b))²);
t = y - exp(ax+b)
- = y - exp( _q[2]/_d[2] * x + ( LnYavg - (_q[2]/_d[2] * Xavg) ));
- = y - exp( _q[2]/_d[2] * (x - Xavg) + LnYavg );
+ = y - exp(_q[2]/_d[2] * x + (LnYavg - (_q[2]/_d[2] * Xavg)));
+ = y - exp(_q[2]/_d[2] * (x - Xavg) + LnYavg);
*/
- t = ( Table[ r ].Y_o
- - expl( ( _q_o[ 2 ] / _d_o[ 2 ] ) * Table[ r ]._x + LnYavg_o ) );
+ t = (Table[ r ].Y_o
+ - expl((_q_o[ 2 ] / _d_o[ 2 ]) * Table[ r ]._x + LnYavg_o));
r4_o += t * t / array_max ;
- t = ( Table[ r ].Y_c
- - expl( ( _q_c[ 2 ] / _d_c[ 2 ] ) * Table[ r ]._x + LnYavg_c ) );
+ t = (Table[ r ].Y_c
+ - expl((_q_c[ 2 ] / _d_c[ 2 ]) * Table[ r ]._x + LnYavg_c));
r4_c += t * t / array_max ;
}
#if VERBOSE > 1
- output( "All computing terminated.\n" );
+ output("All computing terminated.\n");
#endif
ret = 0;
#if VERBOSE > 1
- output( " # of data: %i\n", array_max );
+ output(" # of data: %i\n", array_max);
- output( " Model: Y = k\n" );
+ output(" Model: Y = k\n");
- output( " sem_open:\n" );
+ output(" sem_open:\n");
- output( " k = %g\n", Yavg_o );
+ output(" k = %g\n", Yavg_o);
- output( " Divergence %g\n", r1_o );
+ output(" Divergence %g\n", r1_o);
- output( " sem_close:\n" );
+ output(" sem_close:\n");
- output( " k = %g\n", Yavg_c );
+ output(" k = %g\n", Yavg_c);
- output( " Divergence %g\n", r1_c );
+ output(" Divergence %g\n", r1_c);
- output( " Model: Y = a * X + b\n" );
+ output(" Model: Y = a * X + b\n");
- output( " sem_open:\n" );
+ output(" sem_open:\n");
- output( " a = %Lg\n", _q_o[ 0 ] / _d_o[ 0 ] );
+ output(" a = %Lg\n", _q_o[ 0 ] / _d_o[ 0 ]);
- output( " b = %Lg\n", Yavg_o - ( ( _q_o[ 0 ] / _d_o[ 0 ] ) * Xavg ) );
+ output(" b = %Lg\n", Yavg_o - ((_q_o[ 0 ] / _d_o[ 0 ]) * Xavg));
- output( " Divergence %g\n", r2_o );
+ output(" Divergence %g\n", r2_o);
- output( " sem_close:\n" );
+ output(" sem_close:\n");
- output( " a = %Lg\n", _q_c[ 0 ] / _d_c[ 0 ] );
+ output(" a = %Lg\n", _q_c[ 0 ] / _d_c[ 0 ]);
- output( " b = %Lg\n", Yavg_c - ( ( _q_c[ 0 ] / _d_c[ 0 ] ) * Xavg ) );
+ output(" b = %Lg\n", Yavg_c - ((_q_c[ 0 ] / _d_c[ 0 ]) * Xavg));
- output( " Divergence %g\n", r2_c );
+ output(" Divergence %g\n", r2_c);
- output( " Model: Y = c * X ^ a\n" );
+ output(" Model: Y = c * X ^ a\n");
- output( " sem_open:\n" );
+ output(" sem_open:\n");
- output( " a = %Lg\n", _q_o[ 1 ] / _d_o[ 1 ] );
+ output(" a = %Lg\n", _q_o[ 1 ] / _d_o[ 1 ]);
- output( " c = %Lg\n", logl ( LnYavg_o - ( _q_o[ 1 ] / _d_o[ 1 ] ) * LnXavg ) );
+ output(" c = %Lg\n", logl (LnYavg_o - (_q_o[ 1 ] / _d_o[ 1 ]) * LnXavg));
- output( " Divergence %g\n", r3_o );
+ output(" Divergence %g\n", r3_o);
- output( " sem_close:\n" );
+ output(" sem_close:\n");
- output( " a = %Lg\n", _q_c[ 1 ] / _d_c[ 1 ] );
+ output(" a = %Lg\n", _q_c[ 1 ] / _d_c[ 1 ]);
- output( " c = %Lg\n", logl ( LnYavg_c - ( _q_c[ 1 ] / _d_c[ 1 ] ) * LnXavg ) );
+ output(" c = %Lg\n", logl (LnYavg_c - (_q_c[ 1 ] / _d_c[ 1 ]) * LnXavg));
- output( " Divergence %g\n", r3_c );
+ output(" Divergence %g\n", r3_c);
- output( " Model: Y = exp(a * X + b)\n" );
+ output(" Model: Y = exp(a * X + b)\n");
- output( " sem_open:\n" );
+ output(" sem_open:\n");
- output( " a = %Lg\n", _q_o[ 2 ] / _d_o[ 2 ] );
+ output(" a = %Lg\n", _q_o[ 2 ] / _d_o[ 2 ]);
- output( " b = %Lg\n", LnYavg_o - ( ( _q_o[ 2 ] / _d_o[ 2 ] ) * Xavg ) );
+ output(" b = %Lg\n", LnYavg_o - ((_q_o[ 2 ] / _d_o[ 2 ]) * Xavg));
- output( " Divergence %g\n", r4_o );
+ output(" Divergence %g\n", r4_o);
- output( " sem_close:\n" );
+ output(" sem_close:\n");
- output( " a = %Lg\n", _q_c[ 2 ] / _d_c[ 2 ] );
+ output(" a = %Lg\n", _q_c[ 2 ] / _d_c[ 2 ]);
- output( " b = %Lg\n", LnYavg_c - ( ( _q_c[ 2 ] / _d_c[ 2 ] ) * Xavg ) );
+ output(" b = %Lg\n", LnYavg_c - ((_q_c[ 2 ] / _d_c[ 2 ]) * Xavg));
- output( " Divergence %g\n", r4_c );
+ output(" Divergence %g\n", r4_c);
#endif
@@ -767,20 +769,21 @@ int parse_measure( mes_t * measures )
{
/* Compare r1 to other values, with some ponderations */
- if (( r1_o > 1.1 * r2_o ) || ( r1_o > 1.2 * r3_o ) || ( r1_o > 1.3 * r4_o)
- || ( r1_c > 1.1 * r2_c ) || ( r1_c > 1.2 * r3_c ) || ( r1_c > 1.3 * r4_c ) )
+ if ((r1_o > 1.1 * r2_o) || (r1_o > 1.2 * r3_o) ||
+ (r1_o > 1.3 * r4_o) || (r1_c > 1.1 * r2_c) ||
+ (r1_c > 1.2 * r3_c) || (r1_c > 1.3 * r4_c))
ret++;
#if VERBOSE > 1
else
- output( " Sanction: OK\n" );
+ output(" Sanction: OK\n");
#endif
}
/* We need to free the array */
- free( Table );
+ free(Table);
/* We're done */
return ret;
diff --git a/testcases/open_posix_testsuite/stress/threads/sem_open/testfrmw.c b/testcases/open_posix_testsuite/stress/threads/sem_open/testfrmw.c
index 38adaa8d9..d075c0b7c 100644
--- a/testcases/open_posix_testsuite/stress/threads/sem_open/testfrmw.c
+++ b/testcases/open_posix_testsuite/stress/threads/sem_open/testfrmw.c
@@ -43,7 +43,7 @@ void output_init()
/* do nothing */
return;
}
-void output( char * string, ... )
+void output(char * string, ...)
{
va_list ap;
char *ts="[??:??:??]";
@@ -57,7 +57,7 @@ void output( char * string, ... )
printf(ts);
else
printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec);
- va_start( ap, string);
+ va_start(ap, string);
vprintf(string, ap);
va_end(ap);
pthread_mutex_unlock(&m_trace);