tree: convert to evl_set/clear_thread_mode()
Signed-off-by: Philippe Gerum <rpm@xenomai.org>
This commit is contained in:
parent
dbb8d32f08
commit
928717d5cc
|
@ -382,17 +382,15 @@ static void *timer_responder(void *arg)
|
|||
__u64 timestamp = 0;
|
||||
struct timespec now;
|
||||
int ret, efd;
|
||||
__u32 mode;
|
||||
|
||||
/* Make it a public thread only for demo purpose. */
|
||||
efd = evl_attach_self("/timer-responder:%d", getpid());
|
||||
if (efd < 0)
|
||||
error(1, -efd, "evl_attach_self() failed");
|
||||
|
||||
mode = T_WOSS;
|
||||
ret = oob_ioctl(efd, EVL_THRIOC_SET_MODE, &mode);
|
||||
ret = evl_set_thread_mode(efd, T_WOSS, NULL);
|
||||
if (ret)
|
||||
error(1, errno, "ioctl(EVL_THRIOC_SET_MODE) failed");
|
||||
error(1, -ret, "evl_set_thread_mode(T_WOSS) failed");
|
||||
|
||||
for (;;) {
|
||||
ret = oob_ioctl(latmus_fd, EVL_LATIOC_PULSE, ×tamp);
|
||||
|
@ -519,7 +517,6 @@ static void *gpio_responder_thread(void *arg)
|
|||
typeof(read) *do_read;
|
||||
const int ackval = 0; /* Remote observes falling edges. */
|
||||
int fds[2], efd, ret;
|
||||
__u32 mode;
|
||||
|
||||
setup_gpio_pins(fds);
|
||||
|
||||
|
@ -528,10 +525,9 @@ static void *gpio_responder_thread(void *arg)
|
|||
if (efd < 0)
|
||||
error(1, -efd, "evl_attach_self() failed");
|
||||
|
||||
mode = T_WOSS;
|
||||
ret = oob_ioctl(efd, EVL_THRIOC_SET_MODE, &mode);
|
||||
ret = evl_set_thread_mode(efd, T_WOSS, NULL);
|
||||
if (ret)
|
||||
error(1, errno, "ioctl(EVL_THRIOC_SET_MODE) failed");
|
||||
error(1, -ret, "evl_set_thread_mode(T_WOSS) failed");
|
||||
|
||||
do_ioctl = oob_ioctl;
|
||||
do_read = oob_read;
|
||||
|
|
|
@ -36,7 +36,6 @@ int main(int argc, char *argv[])
|
|||
struct sched_param param;
|
||||
struct sigaction sa;
|
||||
int tfd, ret;
|
||||
__u32 mode;
|
||||
double f;
|
||||
|
||||
srand(time(NULL));
|
||||
|
@ -50,13 +49,12 @@ int main(int argc, char *argv[])
|
|||
SCHED_FIFO, ¶m) == 0);
|
||||
__Tcall_assert(tfd, evl_attach_self("fpu-preload:%d", getpid()));
|
||||
|
||||
mode = T_WOSS;
|
||||
__Tcall_errno_assert(ret, oob_ioctl(tfd, EVL_THRIOC_SET_MODE, &mode));
|
||||
__Tcall_assert(ret, evl_set_thread_mode(tfd, T_WOSS, NULL));
|
||||
f = get_float() * get_float();
|
||||
__Tcall_errno_assert(ret, oob_ioctl(tfd, EVL_THRIOC_CLEAR_MODE, &mode));
|
||||
__Tcall_assert(ret, evl_clear_thread_mode(tfd, T_WOSS, NULL));
|
||||
if (fork() == 0) {
|
||||
__Tcall_assert(tfd, evl_attach_self("fpu-preload-child:%d", getpid()));
|
||||
__Tcall_errno_assert(ret, oob_ioctl(tfd, EVL_THRIOC_SET_MODE, &mode));
|
||||
__Tcall_assert(ret, evl_set_thread_mode(tfd, T_WOSS, NULL));
|
||||
f = get_float() * get_float();
|
||||
}
|
||||
|
||||
|
|
|
@ -29,14 +29,14 @@ struct test_context {
|
|||
static void *deadlocking_thread(void *arg)
|
||||
{
|
||||
struct test_context *p = arg;
|
||||
int ret, tfd, mode = T_WOLI;
|
||||
int ret, tfd;
|
||||
|
||||
__Tcall_assert(tfd, evl_attach_self("monitor-dlk-B:%d", getpid()));
|
||||
/*
|
||||
* Disable WOLI in case CONFIG_EVL_DEBUG_WOLI is set, as we
|
||||
* are about to sleep while holding a mutex.
|
||||
*/
|
||||
__Tcall_errno_assert(ret, oob_ioctl(tfd, EVL_THRIOC_CLEAR_MODE, &mode));
|
||||
__Tcall_assert(ret, evl_clear_thread_mode(tfd, T_WOLI, NULL));
|
||||
__Tcall_assert(ret, evl_lock_mutex(&p->lock_b));
|
||||
__Tcall_assert(ret, evl_put_sem(&p->sync));
|
||||
__Tcall_assert(ret, evl_get_sem(&p->start));
|
||||
|
@ -49,8 +49,8 @@ static void *deadlocking_thread(void *arg)
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int tfd, gfd, sfd, ret, mode = T_WOLI;
|
||||
struct sched_param param;
|
||||
int tfd, gfd, sfd, ret;
|
||||
struct test_context c;
|
||||
pthread_t deadlocker;
|
||||
char *name;
|
||||
|
@ -80,7 +80,7 @@ int main(int argc, char *argv[])
|
|||
* Disable WOLI in case CONFIG_EVL_DEBUG_WOLI is set, as we
|
||||
* are about to sleep while holding a mutex.
|
||||
*/
|
||||
__Tcall_errno_assert(ret, oob_ioctl(tfd, EVL_THRIOC_CLEAR_MODE, &mode));
|
||||
__Tcall_assert(ret, evl_clear_thread_mode(tfd, T_WOLI, NULL));
|
||||
__Tcall_assert(ret, evl_lock_mutex(&c.lock_a));
|
||||
__Fcall_assert(ret, evl_lock_mutex(&c.lock_a)); /* stupid deadlock */
|
||||
__Texpr_assert(ret == -EDEADLK);
|
||||
|
|
|
@ -40,10 +40,7 @@ static void *event_receiver(void *arg)
|
|||
* Disable WOLI in case CONFIG_EVL_DEBUG_WOLI is set, as we
|
||||
* are about to sleep while holding a mutex.
|
||||
*/
|
||||
{
|
||||
int mode = T_WOLI;
|
||||
__Tcall_errno_assert(ret, oob_ioctl(receiverfd, EVL_THRIOC_CLEAR_MODE, &mode));
|
||||
}
|
||||
__Tcall_assert(ret, evl_clear_thread_mode(receiverfd, T_WOLI, NULL));
|
||||
#endif
|
||||
__Tcall_assert(ret, evl_get_sem(&p->start));
|
||||
evl_read_clock(EVL_CLOCK_MONOTONIC, &now);
|
||||
|
|
|
@ -30,14 +30,14 @@ struct test_context {
|
|||
static void *deadlocking_thread(void *arg)
|
||||
{
|
||||
struct test_context *p = arg;
|
||||
int ret, tfd, mode = T_WOLI;
|
||||
int ret, tfd;
|
||||
|
||||
__Tcall_assert(tfd, evl_attach_self("monitor-pi-dlk-B:%d", getpid()));
|
||||
/*
|
||||
* Disable WOLI in case CONFIG_EVL_DEBUG_WOLI is set, as we
|
||||
* are about to sleep while holding a mutex.
|
||||
*/
|
||||
__Tcall_errno_assert(ret, oob_ioctl(tfd, EVL_THRIOC_CLEAR_MODE, &mode));
|
||||
__Tcall_assert(ret, evl_clear_thread_mode(tfd, T_WOLI, NULL));
|
||||
__Tcall_assert(ret, evl_lock_mutex(&p->lock_b));
|
||||
__Tcall_assert(ret, evl_put_sem(&p->sync));
|
||||
__Tcall_assert(ret, evl_get_sem(&p->start));
|
||||
|
|
|
@ -57,8 +57,8 @@ static bool check_priority(int tfd, int prio)
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int tfd, gfd, sfd, ret, mode = T_WOLI;
|
||||
struct sched_param param;
|
||||
int tfd, gfd, sfd, ret;
|
||||
struct test_context c;
|
||||
pthread_t contender;
|
||||
void *status = NULL;
|
||||
|
@ -87,7 +87,7 @@ int main(int argc, char *argv[])
|
|||
* Disable WOLI in case CONFIG_EVL_DEBUG_WOLI is set, as we
|
||||
* are about to sleep while holding a mutex.
|
||||
*/
|
||||
__Tcall_errno_assert(ret, oob_ioctl(tfd, EVL_THRIOC_CLEAR_MODE, &mode));
|
||||
__Tcall_assert(ret, evl_clear_thread_mode(tfd, T_WOLI, NULL));
|
||||
__Tcall_assert(ret, evl_lock_mutex(&c.lock));
|
||||
__Tcall_assert(ret, evl_put_sem(&c.start));
|
||||
__Tcall_assert(ret, evl_get_sem(&c.sem));
|
||||
|
|
|
@ -58,9 +58,9 @@ static bool check_priority(int tfd, int prio)
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int tfd, gfd, sfd, ret, mode = T_WOLI;
|
||||
struct sched_param param;
|
||||
struct evl_mutex lock_pp;
|
||||
int tfd, gfd, sfd, ret;
|
||||
struct test_context c;
|
||||
pthread_t contender;
|
||||
void *status = NULL;
|
||||
|
@ -93,7 +93,7 @@ int main(int argc, char *argv[])
|
|||
* Disable WOLI in case CONFIG_EVL_DEBUG_WOLI is set, as we
|
||||
* are about to sleep while holding a mutex.
|
||||
*/
|
||||
__Tcall_errno_assert(ret, oob_ioctl(tfd, EVL_THRIOC_CLEAR_MODE, &mode));
|
||||
__Tcall_assert(ret, evl_clear_thread_mode(tfd, T_WOLI, NULL));
|
||||
__Tcall_assert(ret, evl_lock_mutex(&lock_pp));
|
||||
__Tcall_assert(ret, evl_usleep(5000)); /* Commit PP boost. */
|
||||
__Texpr_assert(check_priority(tfd, MEDIUM_PRIO));
|
||||
|
|
|
@ -38,11 +38,9 @@ static void sigdebug_handler(int sig, siginfo_t *si, void *context)
|
|||
static void *test_thread(void *arg)
|
||||
{
|
||||
int tfd, ret;
|
||||
__u32 mode;
|
||||
|
||||
__Tcall_assert(tfd, evl_attach_self("stax-warn-test:%d", getpid()));
|
||||
mode = T_WOSX;
|
||||
__Tcall_errno_assert(ret, oob_ioctl(tfd, EVL_THRIOC_SET_MODE, &mode));
|
||||
__Tcall_assert(ret, evl_set_thread_mode(tfd, T_WOSX, NULL));
|
||||
|
||||
/*
|
||||
* In-band main() currently holds the stax, we should get
|
||||
|
|
Loading…
Reference in New Issue