Changeset 205f1add in mainline for uspace/lib/drv/generic/remote_nic.c


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/drv/generic/remote_nic.c

    re2625b1a r205f1add  
    3939#include <errno.h>
    4040#include <ipc/services.h>
    41 #include <sys/time.h>
     41#include <time.h>
    4242#include <macros.h>
    4343
     
    12621262 */
    12631263errno_t nic_poll_get_mode(async_sess_t *dev_sess, nic_poll_mode_t *mode,
    1264     struct timeval *period)
     1264    struct timespec *period)
    12651265{
    12661266        assert(mode);
     
    12801280
    12811281        if (period != NULL)
    1282                 rc = async_data_read_start(exch, period, sizeof(struct timeval));
     1282                rc = async_data_read_start(exch, period, sizeof(struct timespec));
    12831283
    12841284        async_exchange_end(exch);
     
    12961296 */
    12971297errno_t nic_poll_set_mode(async_sess_t *dev_sess, nic_poll_mode_t mode,
    1298     const struct timeval *period)
     1298    const struct timespec *period)
    12991299{
    13001300        async_exch_t *exch = async_exchange_begin(dev_sess);
     
    13051305        errno_t rc;
    13061306        if (period)
    1307                 rc = async_data_write_start(exch, period, sizeof(struct timeval));
     1307                rc = async_data_write_start(exch, period, sizeof(struct timespec));
    13081308        else
    13091309                rc = EOK;
     
    24052405        nic_poll_mode_t mode = NIC_POLL_IMMEDIATE;
    24062406        int request_data = IPC_GET_ARG2(*call);
    2407         struct timeval period = {
     2407        struct timespec period = {
    24082408                .tv_sec = 0,
    2409                 .tv_usec = 0
     2409                .tv_nsec = 0
    24102410        };
    24112411
     
    24212421                }
    24222422
    2423                 if (max_len != sizeof(struct timeval)) {
     2423                if (max_len != sizeof(struct timespec)) {
    24242424                        async_answer_0(&data, ELIMIT);
    24252425                        async_answer_0(call, ELIMIT);
     
    24282428
    24292429                async_data_read_finalize(&data, &period,
    2430                     sizeof(struct timeval));
     2430                    sizeof(struct timespec));
    24312431        }
    24322432
     
    24412441        nic_poll_mode_t mode = IPC_GET_ARG2(*call);
    24422442        int has_period = IPC_GET_ARG3(*call);
    2443         struct timeval period_buf;
    2444         struct timeval *period = NULL;
     2443        struct timespec period_buf;
     2444        struct timespec *period = NULL;
    24452445        size_t length;
    24462446
     
    24532453                }
    24542454
    2455                 if (length != sizeof(struct timeval)) {
     2455                if (length != sizeof(struct timespec)) {
    24562456                        async_answer_0(&data, ELIMIT);
    24572457                        async_answer_0(call, ELIMIT);
Note: See TracChangeset for help on using the changeset viewer.