Changeset 12a885c in rtems-libbsd


Ignore:
Timestamp:
Aug 24, 2018, 6:55:00 AM (8 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
647dd08ae2aa69b935c2847ea450fb824322ecae, c6261f97870562d4c797cfb1ff1ba0affb85a916
Children:
0963419
Parents:
8e35aaa
git-author:
Sebastian Huber <sebastian.huber@…> (08/24/18 06:55:00)
git-committer:
Sebastian Huber <sebastian.huber@…> (08/24/18 06:57:10)
Message:

Update due to <sys/time.h> API changes

Changes correspond to FreeBSD commit:

"Make timespecadd(3) and friends public

The timespecadd(3) family of macros were imported from NetBSD back in
r35029. However, they were initially guarded by #ifdef _KERNEL. In the
meantime, we have grown at least 28 syscalls that use timespecs in some
way, leading many programs both inside and outside of the base system to
redefine those macros. It's better just to make the definitions public.

Our kernel currently defines two-argument versions of timespecadd and
timespecsub. NetBSD, OpenBSD, and FreeDesktop?.org's libbsd, however, define
three-argument versions. Solaris also defines a three-argument version, but
only in its kernel. This revision changes our definition to match the
common three-argument version.

Bump _FreeBSD_version due to the breaking KPI change.

Discussed with: cem, jilles, ian, bde
Differential Revision: https://reviews.freebsd.org/D14725"

Update #3472.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • freebsd/sys/kern/kern_time.c

    r8e35aaa r12a885c  
    553553                        error = kern_clock_gettime(td, clock_id, &now);
    554554                        KASSERT(error == 0, ("kern_clock_gettime: %d", error));
    555                         timespecsub(&ts, &now);
     555                        timespecsub(&ts, &now, &ts);
    556556                }
    557557                if (ts.tv_sec < 0 || (ts.tv_sec == 0 && ts.tv_nsec == 0)) {
     
    15331533        *ovalue = it->it_time;
    15341534        if (ovalue->it_value.tv_sec != 0 || ovalue->it_value.tv_nsec != 0) {
    1535                 timespecsub(&ovalue->it_value, &cts);
     1535                timespecsub(&ovalue->it_value, &cts, &ovalue->it_value);
    15361536                if (ovalue->it_value.tv_sec < 0 ||
    15371537                    (ovalue->it_value.tv_sec == 0 &&
     
    15741574                if ((flags & TIMER_ABSTIME) == 0) {
    15751575                        /* Convert to absolute time. */
    1576                         timespecadd(&it->it_time.it_value, &cts);
     1576                        timespecadd(&it->it_time.it_value, &cts,
     1577                            &it->it_time.it_value);
    15771578                } else {
    1578                         timespecsub(&ts, &cts);
     1579                        timespecsub(&ts, &cts, &ts);
    15791580                        /*
    15801581                         * We don't care if ts is negative, tztohz will
     
    16441645                if (timespecisset(&it->it_time.it_interval)) {
    16451646                        timespecadd(&it->it_time.it_value,
    1646                                     &it->it_time.it_interval);
     1647                                    &it->it_time.it_interval,
     1648                                    &it->it_time.it_value);
    16471649                        while (timespeccmp(&cts, &it->it_time.it_value, >=)) {
    16481650                                if (it->it_overrun < INT_MAX)
     
    16511653                                        it->it_ksi.ksi_errno = ERANGE;
    16521654                                timespecadd(&it->it_time.it_value,
    1653                                             &it->it_time.it_interval);
     1655                                            &it->it_time.it_interval,
     1656                                            &it->it_time.it_value);
    16541657                        }
    16551658                } else {
     
    16581661                }
    16591662                if (timespecisset(&it->it_time.it_value)) {
    1660                         ts = it->it_time.it_value;
    1661                         timespecsub(&ts, &cts);
     1663                        timespecsub(&it->it_time.it_value, &cts, &ts);
    16621664                        TIMESPEC_TO_TIMEVAL(&tv, &ts);
    16631665                        callout_reset(&it->it_callout, tvtohz(&tv),
     
    16701672                itimer_leave(it);
    16711673        } else if (timespecisset(&it->it_time.it_value)) {
    1672                 ts = it->it_time.it_value;
    1673                 timespecsub(&ts, &cts);
     1674                timespecsub(&it->it_time.it_value, &cts, &ts);
    16741675                TIMESPEC_TO_TIMEVAL(&tv, &ts);
    16751676                callout_reset(&it->it_callout, tvtohz(&tv), realtimer_expire,
  • freebsd/sys/opencrypto/crypto.c

    r8e35aaa r12a885c  
    10321032                delta.sec--;
    10331033        bintime2timespec(&delta, &t);
    1034         timespecadd(&ts->acc, &t);
     1034        timespecadd(&ts->acc, &t, &ts->acc);
    10351035        if (timespeccmp(&t, &ts->min, <))
    10361036                ts->min = t;
  • rtemsbsd/powerpc/include/linux/time.h

    r8e35aaa r12a885c  
    7171        struct timespec ts;
    7272
    73         ts.tv_sec = lhs.tv_sec;
    74         ts.tv_nsec = lhs.tv_nsec;
    75         timespecsub(&ts, &rhs);
     73        timespecsub(&lhs, &rhs, &ts);
    7674
    7775        return ts;
Note: See TracChangeset for help on using the changeset viewer.