Changeset c40e45b in rtems-libbsd for freebsd/sys/sys/callout.h


Ignore:
Timestamp:
Oct 7, 2016, 1:10:20 PM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
afaeccc05a556f6aa25ba044a7e49d6aa634a59e, master
Children:
2956924
Parents:
8c0eeba
git-author:
Sebastian Huber <sebastian.huber@…> (10/07/16 13:10:20)
git-committer:
Sebastian Huber <sebastian.huber@…> (01/10/17 08:53:31)
Message:

Update to FreeBSD head 2016-08-23

Git mirror commit 9fe7c416e6abb28b1398fd3e5687099846800cfd.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • freebsd/sys/sys/callout.h

    r8c0eeba rc40e45b  
    4444#define CALLOUT_ACTIVE          0x0002 /* callout is currently active */
    4545#define CALLOUT_PENDING         0x0004 /* callout is waiting for timeout */
    46 #define CALLOUT_MPSAFE          0x0008 /* callout handler is mp safe */
     46#define CALLOUT_MPSAFE          0x0008 /* deprecated */
    4747#define CALLOUT_RETURNUNLOCKED  0x0010 /* handler returns with mtx unlocked */
    4848#define CALLOUT_SHAREDLOCK      0x0020 /* callout lock held in shared mode */
    4949#define CALLOUT_DFRMIGRATION    0x0040 /* callout in deferred migration mode */
     50#define CALLOUT_PROCESSED       0x0080 /* callout in wheel or processing list? */
     51#define CALLOUT_DIRECT          0x0100 /* allow exec from hw int context */
     52
     53#define C_DIRECT_EXEC           0x0001 /* direct execution of callout */
     54#define C_PRELBITS              7
     55#define C_PRELRANGE             ((1 << C_PRELBITS) - 1)
     56#define C_PREL(x)               (((x) + 1) << 1)
     57#define C_PRELGET(x)            (int)((((x) >> 1) & C_PRELRANGE) - 1)
     58#define C_HARDCLOCK             0x0100 /* align to hardclock() calls */
     59#define C_ABSOLUTE              0x0200 /* event time is absolute. */
     60#define C_PRECALC               0x0400 /* event time is pre-calculated. */
    5061
    5162struct callout_handle {
     
    5364};
    5465
     66/* Flags for callout_stop_safe() */
     67#define CS_DRAIN                0x0001 /* callout_drain(), wait allowed */
     68#define CS_EXECUTING            0x0002 /* Positive return value indicates that
     69                                          the callout was executing */
     70
    5571#ifdef _KERNEL
    56 extern int ncallout;
    57 
     72/*
     73 * Note the flags field is actually *two* fields. The c_flags
     74 * field is the one that caller operations that may, or may not have
     75 * a lock touches i.e. callout_deactivate(). The other, the c_iflags,
     76 * is the internal flags that *must* be kept correct on which the
     77 * callout system depend on e.g. callout_pending().
     78 * The c_iflag is used internally by the callout system to determine which
     79 * list the callout is on and track internal state. Callers *should not*
     80 * use the c_flags field directly but should use the macros provided.
     81 * 
     82 * The c_iflags field holds internal flags that are protected by internal
     83 * locks of the callout subsystem.  The c_flags field holds external flags.
     84 * The caller must hold its own lock while manipulating or reading external
     85 * flags via callout_active(), callout_deactivate(), callout_reset*(), or
     86 * callout_stop() to avoid races.
     87 */
    5888#define callout_active(c)       ((c)->c_flags & CALLOUT_ACTIVE)
    5989#define callout_deactivate(c)   ((c)->c_flags &= ~CALLOUT_ACTIVE)
    60 #define callout_drain(c)        _callout_stop_safe(c, 1)
     90#define callout_drain(c)        _callout_stop_safe(c, CS_DRAIN, NULL)
    6191void    callout_init(struct callout *, int);
    6292void    _callout_init_lock(struct callout *, struct lock_object *, int);
     
    6494        _callout_init_lock((c), ((mtx) != NULL) ? &(mtx)->lock_object : \
    6595            NULL, (flags))
     96#define callout_init_rm(c, rm, flags)                                   \
     97        _callout_init_lock((c), ((rm) != NULL) ? &(rm)->lock_object :   \
     98            NULL, (flags))
    6699#define callout_init_rw(c, rw, flags)                                   \
    67100        _callout_init_lock((c), ((rw) != NULL) ? &(rw)->lock_object :   \
    68101           NULL, (flags))
    69 #define callout_pending(c)      ((c)->c_flags & CALLOUT_PENDING)
    70 int     callout_reset_on(struct callout *, int, void (*)(void *), void *, int);
     102#define callout_pending(c)      ((c)->c_iflags & CALLOUT_PENDING)
     103int     callout_reset_sbt_on(struct callout *, sbintime_t, sbintime_t,
     104            void (*)(void *), void *, int, int);
     105#define callout_reset_sbt(c, sbt, pr, fn, arg, flags)                   \
     106    callout_reset_sbt_on((c), (sbt), (pr), (fn), (arg), -1, (flags))
     107#define callout_reset_sbt_curcpu(c, sbt, pr, fn, arg, flags)            \
     108    callout_reset_sbt_on((c), (sbt), (pr), (fn), (arg), PCPU_GET(cpuid),\
     109        (flags))
     110#define callout_reset_on(c, to_ticks, fn, arg, cpu)                     \
     111    callout_reset_sbt_on((c), tick_sbt * (to_ticks), 0, (fn), (arg),    \
     112        (cpu), C_HARDCLOCK)
    71113#define callout_reset(c, on_tick, fn, arg)                              \
    72     callout_reset_on((c), (on_tick), (fn), (arg), (c)->c_cpu)
     114    callout_reset_on((c), (on_tick), (fn), (arg), -1)
    73115#define callout_reset_curcpu(c, on_tick, fn, arg)                       \
    74116    callout_reset_on((c), (on_tick), (fn), (arg), PCPU_GET(cpuid))
     117#define callout_schedule_sbt_on(c, sbt, pr, cpu, flags)                 \
     118    callout_reset_sbt_on((c), (sbt), (pr), (c)->c_func, (c)->c_arg,     \
     119        (cpu), (flags))
     120#define callout_schedule_sbt(c, sbt, pr, flags)                         \
     121    callout_schedule_sbt_on((c), (sbt), (pr), -1, (flags))
     122#define callout_schedule_sbt_curcpu(c, sbt, pr, flags)                  \
     123    callout_schedule_sbt_on((c), (sbt), (pr), PCPU_GET(cpuid), (flags))
    75124int     callout_schedule(struct callout *, int);
    76125int     callout_schedule_on(struct callout *, int, int);
    77126#define callout_schedule_curcpu(c, on_tick)                             \
    78127    callout_schedule_on((c), (on_tick), PCPU_GET(cpuid))
    79 #define callout_stop(c)         _callout_stop_safe(c, 0)
    80 int     _callout_stop_safe(struct callout *, int);
    81 void    callout_tick(void);
    82 int     callout_tickstofirst(int limit);
    83 extern void (*callout_new_inserted)(int cpu, int ticks);
    84 
     128#define callout_stop(c)         _callout_stop_safe(c, 0, NULL)
     129int     _callout_stop_safe(struct callout *, int, void (*)(void *));
     130void    callout_process(sbintime_t now);
     131#define callout_async_drain(c, d)                                       \
     132    _callout_stop_safe(c, 0, d)
     133void callout_when(sbintime_t sbt, sbintime_t precision, int flags,
     134    sbintime_t *sbt_res, sbintime_t *prec_res);
    85135#endif
    86136
Note: See TracChangeset for help on using the changeset viewer.