@@ -73,8 +73,9 @@ int main(int argc, char *argv[])
/*
* Requeue a waiter from f1 to f2, and wake f2.
*/
- if (pthread_create(&waiter[0], NULL, waiterfn, NULL))
- error("pthread_create failed\n", errno);
+ res = pthread_create(&waiter[0], NULL, waiterfn, NULL);
+ if (res)
+ error("pthread_create failed\n", res);
usleep(WAKE_WAIT_US);
@@ -105,8 +106,9 @@ int main(int argc, char *argv[])
* At futex_wake, wake INT_MAX (should be exactly 7).
*/
for (i = 0; i < 10; i++) {
- if (pthread_create(&waiter[i], NULL, waiterfn, NULL))
- error("pthread_create failed\n", errno);
+ res = pthread_create(&waiter[i], NULL, waiterfn, NULL);
+ if (res)
+ error("pthread_create failed\n", res);
}
usleep(WAKE_WAIT_US);
@@ -79,8 +79,9 @@ int main(int argc, char *argv[])
ksft_print_msg("%s: Detect mismatched requeue_pi operations\n",
basename(argv[0]));
- if (pthread_create(&child, NULL, blocking_child, NULL)) {
- error("pthread_create\n", errno);
+ ret = pthread_create(&child, NULL, blocking_child, NULL);
+ if (ret) {
+ error("pthread_create\n", ret);
ret = RET_ERROR;
goto out;
}
@@ -78,8 +78,9 @@ int main(int argc, char *argv[])
/* Testing a private futex */
info("Calling private futex_wait on futex: %p\n", futex);
- if (pthread_create(&waiter, NULL, waiterfn, (void *) &flags))
- error("pthread_create failed\n", errno);
+ res = pthread_create(&waiter, NULL, waiterfn, (void *) &flags);
+ if (res)
+ error("pthread_create failed\n", res);
usleep(WAKE_WAIT_US);
@@ -106,8 +107,9 @@ int main(int argc, char *argv[])
futex = shared_data;
info("Calling shared (page anon) futex_wait on futex: %p\n", futex);
- if (pthread_create(&waiter, NULL, waiterfn, NULL))
- error("pthread_create failed\n", errno);
+ res = pthread_create(&waiter, NULL, waiterfn, NULL);
+ if (res)
+ error("pthread_create failed\n", res);
usleep(WAKE_WAIT_US);
@@ -145,8 +147,9 @@ int main(int argc, char *argv[])
futex = shm;
info("Calling shared (file backed) futex_wait on futex: %p\n", futex);
- if (pthread_create(&waiter, NULL, waiterfn, NULL))
- error("pthread_create failed\n", errno);
+ res = pthread_create(&waiter, NULL, waiterfn, NULL);
+ if (res)
+ error("pthread_create failed\n", res);
usleep(WAKE_WAIT_US);
@@ -100,7 +100,7 @@ int main(int argc, char **argv)
basename(argv[0]));
ret = pthread_create(&thr, NULL, thr_futex_wait, NULL);
- if (ret < 0) {
+ if (ret) {
fprintf(stderr, "pthread_create error\n");
ret = RET_ERROR;
goto out;
@@ -103,7 +103,7 @@ int main(int argc, char **argv)
ret = pthread_create(&thr, NULL, wait_thread, NULL);
if (ret) {
- error("pthread_create\n", errno);
+ error("pthread_create\n", ret);
ret = RET_ERROR;
goto out;
}
@@ -94,8 +94,9 @@ int main(int argc, char *argv[])
}
/* Private waitv */
- if (pthread_create(&waiter, NULL, waiterfn, NULL))
- error("pthread_create failed\n", errno);
+ res = pthread_create(&waiter, NULL, waiterfn, NULL);
+ if (res)
+ error("pthread_create failed\n", res);
usleep(WAKE_WAIT_US);
@@ -127,8 +128,9 @@ int main(int argc, char *argv[])
waitv[i].__reserved = 0;
}
- if (pthread_create(&waiter, NULL, waiterfn, NULL))
- error("pthread_create failed\n", errno);
+ res = pthread_create(&waiter, NULL, waiterfn, NULL);
+ if (res)
+ error("pthread_create failed\n", res);
usleep(WAKE_WAIT_US);