Ignore:
Timestamp:
2018-08-23T21:14:56Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Children:
f33c989e
Parents:
e2625b1a
git-author:
Jakub Jermar <jakub@…> (2018-08-21 21:58:52)
git-committer:
Jakub Jermar <jakub@…> (2018-08-23 21:14:56)
Message:

Get rid of sys/time.h

This commit moves the POSIX-like time functionality from libc's
sys/time.h to libposix and introduces C99-like or HelenOS-specific
interfaces to libc.

Specifically, use of sys/time.h, struct timeval, suseconds_t and
gettimeofday is replaced by time.h (C99), struct timespec (C99),
usec_t (HelenOS) and getuptime / getrealtime (HelenOS).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/private/futex.h

    re2625b1a r205f1add  
    102102 *
    103103 */
    104 static inline errno_t futex_down_composable(futex_t *futex, const struct timeval *expires)
     104static inline errno_t futex_down_composable(futex_t *futex,
     105    const struct timespec *expires)
    105106{
    106107        // TODO: Add tests for this.
     
    109110                return EOK;
    110111
    111         suseconds_t timeout;
     112        usec_t timeout;
    112113
    113114        if (!expires) {
     
    119120                        timeout = 1;
    120121                } else {
    121                         struct timeval tv;
     122                        struct timespec tv;
    122123                        getuptime(&tv);
    123                         timeout = tv_gteq(&tv, expires) ? 1 :
    124                             tv_sub_diff(expires, &tv);
     124                        timeout = ts_gteq(&tv, expires) ? 1 :
     125                            NSEC2USEC(ts_sub_diff(expires, &tv));
    125126                }
    126127
     
    148149}
    149150
    150 static inline errno_t futex_down_timeout(futex_t *futex, const struct timeval *expires)
    151 {
    152         if (expires && expires->tv_sec == 0 && expires->tv_usec == 0) {
     151static inline errno_t futex_down_timeout(futex_t *futex,
     152    const struct timespec *expires)
     153{
     154        if (expires && expires->tv_sec == 0 && expires->tv_nsec == 0) {
    153155                /* Nonblocking down. */
    154156
     
    209211         * trydown.
    210212         */
    211         struct timeval tv = { .tv_sec = 0, .tv_usec = 0 };
     213        struct timespec tv = { .tv_sec = 0, .tv_nsec = 0 };
    212214        return futex_down_timeout(futex, &tv) == EOK;
    213215}
Note: See TracChangeset for help on using the changeset viewer.