Changeset 6695d02 in rtems


Ignore:
Timestamp:
Aug 23, 2018, 12:39:33 PM (11 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
59a0541c
Parents:
ba0e9631
Message:

Update FreeBSD kernel timespec support

This change is based on the following 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"

To make the change public (outside #ifdef _KERNEL) it must be integrated
in Newlib.

Update #3472.

Location:
cpukit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/include/machine/_kernel_time.h

    rba0e9631 r6695d02  
    3838            ((tvp)->tv_nsec cmp (uvp)->tv_nsec) :                       \
    3939            ((tvp)->tv_sec cmp (uvp)->tv_sec))
    40 #define timespecadd(vvp, uvp)                                           \
     40
     41#define timespecadd(tsp, usp, vsp)                                      \
    4142        do {                                                            \
    42                 (vvp)->tv_sec += (uvp)->tv_sec;                         \
    43                 (vvp)->tv_nsec += (uvp)->tv_nsec;                       \
    44                 if ((vvp)->tv_nsec >= 1000000000) {                     \
    45                         (vvp)->tv_sec++;                                \
    46                         (vvp)->tv_nsec -= 1000000000;                   \
     43                (vsp)->tv_sec = (tsp)->tv_sec + (usp)->tv_sec;          \
     44                (vsp)->tv_nsec = (tsp)->tv_nsec + (usp)->tv_nsec;       \
     45                if ((vsp)->tv_nsec >= 1000000000L) {                    \
     46                        (vsp)->tv_sec++;                                \
     47                        (vsp)->tv_nsec -= 1000000000L;                  \
    4748                }                                                       \
    4849        } while (0)
    49 #define timespecsub(vvp, uvp)                                           \
     50#define timespecsub(tsp, usp, vsp)                                      \
    5051        do {                                                            \
    51                 (vvp)->tv_sec -= (uvp)->tv_sec;                         \
    52                 (vvp)->tv_nsec -= (uvp)->tv_nsec;                       \
    53                 if ((vvp)->tv_nsec < 0) {                               \
    54                         (vvp)->tv_sec--;                                \
    55                         (vvp)->tv_nsec += 1000000000;                   \
     52                (vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec;          \
     53                (vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec;       \
     54                if ((vsp)->tv_nsec < 0) {                               \
     55                        (vsp)->tv_sec--;                                \
     56                        (vsp)->tv_nsec += 1000000000L;                  \
    5657                }                                                       \
    5758        } while (0)
  • cpukit/score/src/kern_tc.c

    rba0e9631 r6695d02  
    20452045
    20462046        if (foff) {
    2047                 timespecadd(tsp, osp);
     2047                timespecadd(tsp, osp, tsp);
    20482048                if (tsp->tv_nsec < 0) {
    20492049                        tsp->tv_nsec += 1000000000;
Note: See TracChangeset for help on using the changeset viewer.