Commit db712cc1 authored by Philippe Gerum's avatar Philippe Gerum
Browse files

lib: rename evl_udelay() to evl_usleep()

evl_udelay() was an annoying misnomer for people with kernel
development background, as this relates to a busy wait loop, not to a
sleeping call, which evl_udelay() actually was.

Rename this call to evl_usleep(), converging to the glibc signature
for usleep(3) in the same move.
parent d816bdc9
......@@ -62,7 +62,7 @@ int evl_sleep_until(int clockfd, const struct timespec *timeout)
return 0;
}
int evl_udelay(unsigned int usecs)
int evl_usleep(useconds_t usecs)
{
struct timespec delay;
int ret;
......
......@@ -44,7 +44,7 @@ int evl_get_clock_resolution(int clockfd, struct timespec *tp);
int evl_sleep_until(int clockfd, const struct timespec *timeout);
int evl_udelay(unsigned int usecs);
int evl_usleep(useconds_t usecs);
#ifdef __cplusplus
}
......
......@@ -9,7 +9,7 @@
#include <evl/syscall.h>
#define __EVL__ 6 /* API version */
#define __EVL__ 7 /* API version */
struct evl_version {
int api_level; /* libevl.so: __EVL__ */
......
......@@ -40,7 +40,7 @@ int evl_adjust_clock(int clockfd, struct timex *tx);
int evl_sleep_until(int clockfd, const struct timespec *timeout);
int evl_udelay(unsigned int usecs);
int evl_usleep(useconds_t usecs);
#ifdef __cplusplus
}
......
......@@ -20,7 +20,7 @@
#include <evl/poll.h>
#include <evl/proxy.h>
#define __EVL__ 8 /* API version */
#define __EVL__ 9 /* API version */
struct evl_version {
int api_level; /* libevl.so: __EVL__ */
......
......@@ -99,7 +99,7 @@ static void timespec_add_ns(struct timespec *__restrict r,
}
}
int evl_udelay(unsigned int usecs)
int evl_usleep(useconds_t usecs)
{
struct timespec now, next;
......
......@@ -88,7 +88,7 @@ static inline void breathe(int loops)
* to progress, let's nap a bit during the test.
*/
if ((loops % 1000) == 0)
evl_udelay(300);
evl_usleep(300);
}
static inline long diff_ts(struct timespec *left, struct timespec *right)
......
......@@ -142,7 +142,7 @@ int main(int argc, char *argv[])
__Tcall_assert(ret, evl_get_sem(&c.sem));
/* Wait for the receiver to enter evl_wait_event() */
__Tcall_assert(ret, evl_udelay(1000));
__Tcall_assert(ret, evl_usleep(1000));
__Tcall_assert(ret, evl_lock_mutex(&c.lock));
c.condition = 3;
......
......@@ -119,7 +119,7 @@ int main(int argc, char *argv[])
__Texpr_assert(bits == 0x12121212);
#endif
__Tcall_assert(ret, evl_get_sem(&c.sem));
__Tcall_assert(ret, evl_udelay(1000));
__Tcall_assert(ret, evl_usleep(1000));
__Tcall_assert(ret, evl_post_flags(&c.flags, 0x76767676));
__Tcall_assert(ret, evl_get_sem(&c.sem));
__Texpr_assert(pthread_join(receiver, &status) == 0);
......
......@@ -47,13 +47,13 @@ int main(int argc, char *argv[])
EVL_CLOCK_MONOTONIC, LOW_PRIO, name));
__Tcall_assert(ret, evl_lock_mutex(&lock));
/* Commit PP boost, no priority change expected. */
__Tcall_assert(ret, evl_udelay(1000));
__Tcall_assert(ret, evl_usleep(1000));
__Texpr_assert(check_priority(tfd, LOW_PRIO));
__Tcall_assert(ret, evl_unlock_mutex(&lock));
__Tcall_assert(ret, evl_set_mutex_ceiling(&lock, HIGH_PRIO));
__Tcall_assert(ret, evl_lock_mutex(&lock));
/* Commit PP boost, should be boosted to HIGH_PRIO. */
__Tcall_assert(ret, evl_udelay(1000));
__Tcall_assert(ret, evl_usleep(1000));
__Texpr_assert(check_priority(tfd, HIGH_PRIO));
__Tcall_assert(ret, evl_unlock_mutex(&lock));
......
......@@ -47,7 +47,7 @@ int main(int argc, char *argv[])
EVL_CLOCK_MONOTONIC, LOW_PRIO, name));
__Tcall_assert(ret, evl_lock_mutex(&lock));
/* Commit PP, no priority change expected. */
__Tcall_assert(ret, evl_udelay(1000));
__Tcall_assert(ret, evl_usleep(1000));
__Texpr_assert(check_priority(tfd, HIGH_PRIO));
__Tcall_assert(ret, evl_unlock_mutex(&lock));
__Texpr_assert(check_priority(tfd, HIGH_PRIO));
......
......@@ -53,11 +53,11 @@ int main(int argc, char *argv[])
__Tcall_assert(ret, evl_lock_mutex(&lock_medium));
/* Commit PP, expected switch to medium priority. */
__Tcall_assert(ret, evl_udelay(1000));
__Tcall_assert(ret, evl_usleep(1000));
__Texpr_assert(check_priority(tfd, MEDIUM_PRIO));
__Tcall_assert(ret, evl_lock_mutex(&lock_high));
/* Commit PP, expected switch to high priority. */
__Tcall_assert(ret, evl_udelay(1000));
__Tcall_assert(ret, evl_usleep(1000));
__Texpr_assert(check_priority(tfd, HIGH_PRIO));
__Tcall_assert(ret, evl_unlock_mutex(&lock_high));
__Texpr_assert(check_priority(tfd, MEDIUM_PRIO));
......
......@@ -95,7 +95,7 @@ int main(int argc, char *argv[])
*/
__Tcall_errno_assert(ret, oob_ioctl(tfd, EVL_THRIOC_CLEAR_MODE, &mode));
__Tcall_assert(ret, evl_lock_mutex(&lock_pp));
__Tcall_assert(ret, evl_udelay(5000)); /* Commit PP boost. */
__Tcall_assert(ret, evl_usleep(5000)); /* Commit PP boost. */
__Texpr_assert(check_priority(tfd, MEDIUM_PRIO));
__Tcall_assert(ret, evl_lock_mutex(&c.lock));
__Tcall_assert(ret, evl_put_sem(&c.start));
......
......@@ -47,7 +47,7 @@ int main(int argc, char *argv[])
EVL_CLOCK_MONOTONIC, HIGH_PRIO, name));
__Tcall_assert(ret, evl_lock_mutex(&lock));
__Tcall_assert(ret, evl_udelay(1000)); /* Commit PP boost. */
__Tcall_assert(ret, evl_usleep(1000)); /* Commit PP boost. */
__Texpr_assert(check_priority(tfd, HIGH_PRIO));
__Tcall_assert(ret, evl_unlock_mutex(&lock));
__Texpr_assert(check_priority(tfd, LOW_PRIO));
......
......@@ -50,7 +50,7 @@ int main(int argc, char *argv[])
__Tcall_assert(ret, evl_switch_oob());
__Tcall_assert(ret, evl_lock_mutex(&lock));
__Texpr_assert(evl_trylock_mutex(&lock) == -EDEADLK);
__Tcall_assert(ret, evl_udelay(1000)); /* Commit PP boost. */
__Tcall_assert(ret, evl_usleep(1000)); /* Commit PP boost. */
__Texpr_assert(check_priority(tfd, HIGH_PRIO));
__Tcall_assert(ret, evl_unlock_mutex(&lock));
__Texpr_assert(check_priority(tfd, LOW_PRIO));
......
......@@ -48,7 +48,7 @@ int main(int argc, char *argv[])
__Tcall_assert(ret, evl_lock_mutex(&lock));
/* Commit PP, we should have inherited SCHED_FIFO, HIGH_PRIO. */
__Tcall_assert(ret, evl_udelay(1000));
__Tcall_assert(ret, evl_usleep(1000));
__Texpr_assert(check_priority(tfd, SCHED_FIFO, HIGH_PRIO));
__Tcall_assert(ret, evl_unlock_mutex(&lock));
__Texpr_assert(check_priority(tfd, SCHED_WEAK, LOW_PRIO));
......
......@@ -76,7 +76,7 @@ static void test_steal(bool do_steal)
* Wait for the victim to block on the lock. Sleep for 200ms
* (for slow VMs)
*/
evl_udelay(200000);
evl_usleep(200000);
/*
* Pass the lock ownership to the victim, but we have higher
......@@ -89,7 +89,7 @@ static void test_steal(bool do_steal)
__Tcall_assert(ret, evl_lock_mutex(&c.lock)); /* Steal it. */
__Fexpr_assert(c.acquired);
} else {
evl_udelay(200000);
evl_usleep(200000);
__Tcall_assert(ret, evl_lock_mutex(&c.lock));
__Texpr_assert(c.acquired);
}
......
......@@ -45,7 +45,7 @@ int main(int argc, char *argv[])
new_thread(&poller, SCHED_FIFO, 1, polling_thread, NULL);
/* Wait for evl_poll() to start, then close the polled fd. */
__Tcall_assert(ret, evl_udelay(200000));
__Tcall_assert(ret, evl_usleep(200000));
close(xfd);
__Texpr_assert(pthread_join(poller, NULL) == 0);
close(pfd);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment