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.31 2008/04/28 20:24:10 martin Exp $      */
    2 
    3 /*-
    4  * Copyright (c) 2000, 2003, 2006, 2007, 2008 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, and by Andrew Doran.
   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  *
   20  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   22  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   23  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   24  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   30  * POSSIBILITY OF SUCH DAMAGE.
   31  */
   32 
   33 #ifndef _SYS_CALLOUT_H_
   34 #define _SYS_CALLOUT_H_
   35 
   36 #include <sys/types.h>
   37 
   38 /*
   39  * The callout implementation is private to kern_timeout.c yet uses
   40  * caller-supplied storage, as lightweight callout operations are
   41  * critical to system performance.
   42  *
   43  * The size of callout_t must remain constant in order to ensure ABI
   44  * compatibility for kernel modules: it may become smaller, but must
   45  * not grow.  If more space is required, rearrange the members of
   46  * callout_impl_t.
   47  */
   48 typedef struct callout {
   49         void    *_c_store[10];
   50 } callout_t;
   51 
   52 /* Internal flags. */
   53 #define CALLOUT_BOUND           0x0001  /* bound to a specific CPU */
   54 #define CALLOUT_PENDING         0x0002  /* callout is on the queue */
   55 #define CALLOUT_FIRED           0x0004  /* callout has fired */
   56 #define CALLOUT_INVOKING        0x0008  /* callout function is being invoked */
   57 
   58 /* End-user flags. */
   59 #define CALLOUT_MPSAFE          0x0100  /* does not need kernel_lock */
   60 #define CALLOUT_FLAGMASK        0xff00
   61 
   62 #ifdef _CALLOUT_PRIVATE
   63 
   64 /* The following funkyness is to appease gcc3's strict aliasing. */
   65 struct callout_circq {
   66         /* next element */
   67         union {
   68                 struct callout_impl     *elem;
   69                 struct callout_circq    *list;
   70         } cq_next;
   71         /* previous element */
   72         union {
   73                 struct callout_impl     *elem;
   74                 struct callout_circq    *list;
   75         } cq_prev;
   76 };
   77 #define cq_next_e       cq_next.elem
   78 #define cq_prev_e       cq_prev.elem
   79 #define cq_next_l       cq_next.list
   80 #define cq_prev_l       cq_prev.list
   81 
   82 struct callout_cpu;
   83 
   84 typedef struct callout_impl {
   85         struct callout_circq c_list;            /* linkage on queue */
   86         void    (*c_func)(void *);              /* function to call */
   87         void    *c_arg;                         /* function argument */
   88         struct callout_cpu * volatile c_cpu;    /* associated CPU */
   89         int     c_time;                         /* when callout fires */
   90         u_int   c_flags;                        /* state of this entry */
   91         u_int   c_magic;                        /* magic number */
   92 } callout_impl_t;
   93 #define CALLOUT_MAGIC           0x11deeba1
   94 
   95 #endif  /* _CALLOUT_PRIVATE */
   96 
   97 #ifdef _KERNEL
   98 struct cpu_info;
   99 
  100 void    callout_startup(void);
  101 void    callout_init_cpu(struct cpu_info *);
  102 void    callout_hardclock(void);
  103 
  104 void    callout_init(callout_t *, u_int);
  105 void    callout_destroy(callout_t *);
  106 void    callout_setfunc(callout_t *, void (*)(void *), void *);
  107 void    callout_reset(callout_t *, int, void (*)(void *), void *);
  108 void    callout_schedule(callout_t *, int);
  109 bool    callout_stop(callout_t *);
  110 bool    callout_halt(callout_t *, void *);
  111 bool    callout_pending(callout_t *);
  112 bool    callout_expired(callout_t *);
  113 bool    callout_active(callout_t *);
  114 bool    callout_invoking(callout_t *);
  115 void    callout_ack(callout_t *);
  116 void    callout_bind(callout_t *, struct cpu_info *);
  117 #endif  /* _KERNEL */
  118 
  119 #endif /* !_SYS_CALLOUT_H_ */

Cache object: 98bf4f84ab3b7506279ebc9c52439c19


[ 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.