The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/callout.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: callout.h,v 1.21 2005/03/04 05:51:41 mycroft Exp $     */
    2 
    3 /*-
    4  * Copyright (c) 2000, 2003 The NetBSD Foundation, Inc.
    5  * All rights reserved.
    6  *
    7  * This code is derived from software contributed to The NetBSD Foundation
    8  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
    9  * NASA Ames Research Center.
   10  *
   11  * Redistribution and use in source and binary forms, with or without
   12  * modification, are permitted provided that the following conditions
   13  * are met:
   14  * 1. Redistributions of source code must retain the above copyright
   15  *    notice, this list of conditions and the following disclaimer.
   16  * 2. Redistributions in binary form must reproduce the above copyright
   17  *    notice, this list of conditions and the following disclaimer in the
   18  *    documentation and/or other materials provided with the distribution.
   19  * 3. All advertising materials mentioning features or use of this software
   20  *    must display the following acknowledgement:
   21  *      This product includes software developed by the NetBSD
   22  *      Foundation, Inc. and its contributors.
   23  * 4. Neither the name of The NetBSD Foundation nor the names of its
   24  *    contributors may be used to endorse or promote products derived
   25  *    from this software without specific prior written permission.
   26  *
   27  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   28  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   29  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   30  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   31  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   32  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   33  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   34  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   35  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   36  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   37  * POSSIBILITY OF SUCH DAMAGE.
   38  */
   39 
   40 /*
   41  * Copyright (c) 2000-2001 Artur Grabowski <art@openbsd.org>
   42  * All rights reserved.
   43  *
   44  * Redistribution and use in source and binary forms, with or without
   45  * modification, are permitted provided that the following conditions
   46  * are met:
   47  *
   48  * 1. Redistributions of source code must retain the above copyright
   49  *    notice, this list of conditions and the following disclaimer.
   50  * 2. Redistributions in binary form must reproduce the above copyright
   51  *    notice, this list of conditions and the following disclaimer in the
   52  *    documentation and/or other materials provided with the distribution.
   53  * 3. The name of the author may not be used to endorse or promote products
   54  *    derived from this software without specific prior written permission.
   55  *
   56  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
   57  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
   58  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
   59  * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
   60  * EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLUDING, BUT NOT LIMITED TO,
   61  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
   62  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
   63  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
   64  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
   65  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   66  */
   67 
   68 #ifndef _SYS_CALLOUT_H_
   69 #define _SYS_CALLOUT_H_
   70 
   71 /*
   72  * The following funkyness is to appease gcc3's strict aliasing.
   73  */
   74 struct callout;
   75 struct callout_circq {
   76         /* next element */
   77         union {
   78                 struct callout          *elem;
   79                 struct callout_circq    *list;
   80         } cq_next;
   81         /* previous element */
   82         union {
   83                 struct callout          *elem;
   84                 struct callout_circq    *list;
   85         } cq_prev;
   86 };
   87 #define cq_next_e       cq_next.elem
   88 #define cq_prev_e       cq_prev.elem
   89 #define cq_next_l       cq_next.list
   90 #define cq_prev_l       cq_prev.list
   91 
   92 struct callout {
   93         struct callout_circq c_list;            /* linkage on queue */
   94         void    (*c_func)(void *);              /* function to call */
   95         void    *c_arg;                         /* function argument */
   96         int     c_time;                         /* when callout fires */
   97         int     c_flags;                        /* state of this entry */
   98 };
   99 
  100 #define CALLOUT_PENDING         0x0002  /* callout is on the queue */
  101 #define CALLOUT_FIRED           0x0004  /* callout has fired */
  102 #define CALLOUT_INVOKING        0x0008  /* callout function is being invoked */
  103 
  104 #define CALLOUT_INITIALIZER_SETFUNC(func, arg)                          \
  105                                 { {{NULL}, {NULL}}, func, arg, 0, 0 }
  106 
  107 #define CALLOUT_INITIALIZER     CALLOUT_INITIALIZER_SETFUNC(NULL, NULL)
  108 
  109 #ifdef _KERNEL
  110 void    callout_startup(void);
  111 void    callout_init(struct callout *);
  112 void    callout_setfunc(struct callout *, void (*)(void *), void *);
  113 void    callout_reset(struct callout *, int, void (*)(void *), void *);
  114 void    callout_schedule(struct callout *, int);
  115 void    callout_stop(struct callout *);
  116 int     callout_hardclock(void);
  117 
  118 #define callout_setfunc(c, f, a)                                        \
  119 do {                                                                    \
  120         (c)->c_func = (f);                                              \
  121         (c)->c_arg = (a);                                               \
  122 } while (/*CONSTCOND*/0)
  123 
  124 #define callout_pending(c)      ((c)->c_flags & CALLOUT_PENDING)
  125 #define callout_expired(c)      ((c)->c_flags & CALLOUT_FIRED)
  126 #define callout_active(c)       ((c)->c_flags & (CALLOUT_PENDING|CALLOUT_FIRED))
  127 #define callout_invoking(c)     ((c)->c_flags & CALLOUT_INVOKING)
  128 #define callout_ack(c)          ((c)->c_flags &= ~CALLOUT_INVOKING)
  129 #endif /* _KERNEL */
  130 
  131 #endif /* !_SYS_CALLOUT_H_ */

Cache object: 60236769e9a0028242de7a8a915322fd


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.