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/timers.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 2005 David Xu <davidxu@freebsd.org>
    3  * Copyright (c) 1994 by Chris Provenzano, proven@mit.edu
    4  * All rights reserved.
    5  *
    6  * Redistribution and use in source and binary forms, with or without
    7  * modification, are permitted provided that the following conditions
    8  * are met:
    9  * 1. Redistributions of source code must retain the above copyright
   10  *    notice, this list of conditions and the following disclaimer.
   11  * 2. Redistributions in binary form must reproduce the above copyright
   12  *    notice, this list of conditions and the following disclaimer in the
   13  *    documentation and/or other materials provided with the distribution.
   14  * 3. All advertising materials mentioning features or use of this software
   15  *    must display the following acknowledgement:
   16  *  This product includes software developed by Chris Provenzano.
   17  * 4. The name of Chris Provenzano may not be used to endorse or promote
   18  *    products derived from this software without specific prior written
   19  *    permission.
   20  *
   21  * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND
   22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   24  * ARE DISCLAIMED.  IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY
   25  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   26  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   27  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   28  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   31  * SUCH DAMAGE.
   32  *
   33  * $FreeBSD: releng/8.0/sys/sys/timers.h 156137 2006-03-01 06:48:31Z davidxu $
   34  *
   35  * Description : Basic timers header.
   36  */
   37 
   38 #ifndef _SYS_TIMERS_H_
   39 #define _SYS_TIMERS_H_
   40 
   41 #include <sys/time.h>
   42 
   43 #ifdef _KERNEL
   44 /*
   45  * Structures used to manage POSIX timers in a process.
   46  */
   47 struct itimer {
   48         struct mtx              it_mtx;
   49         struct sigevent         it_sigev;
   50         struct itimerspec       it_time;
   51         struct proc             *it_proc;
   52         int     it_flags;
   53         int     it_usecount;
   54         int     it_overrun;             /* Overruns currently accumulating */
   55         int     it_overrun_last;        /* Overruns associated w/ a delivery */
   56         int     it_clockid;
   57         int     it_timerid;
   58         ksiginfo_t      it_ksi;
   59         union {
   60                 /* realtime */
   61                 struct {
   62                         struct callout it_callout;
   63                 } _rt;
   64 
   65                 /* cpu timer */
   66                 struct {
   67                         LIST_ENTRY(itimer)      it_link;
   68                         TAILQ_ENTRY(itimer)     it_worklink;
   69                         int                     it_active;
   70                         int                     it_cflags;
   71                 } _cpu;
   72         } _data;
   73 };
   74 
   75 #define it_callout      _data._rt.it_callout
   76 #define it_link         _data._cpu.it_link
   77 #define it_active       _data._cpu.it_active
   78 #define it_worklink     _data._cpu.it_worklink
   79 #define it_cflags       _data._cpu.it_cflags
   80 
   81 #define ITF_DELETING    0x01
   82 #define ITF_WANTED      0x02
   83 
   84 #define ITCF_ONWORKLIST 0x01
   85 
   86 #define TIMER_MAX       32
   87 
   88 #define ITIMER_LOCK(it)         mtx_lock(&(it)->it_mtx)
   89 #define ITIMER_UNLOCK(it)       mtx_unlock(&(it)->it_mtx)
   90 
   91 LIST_HEAD(itimerlist, itimer);
   92 
   93 struct  itimers {
   94         struct itimerlist       its_virtual;
   95         struct itimerlist       its_prof;
   96         TAILQ_HEAD(, itimer)    its_worklist;
   97         struct itimer           *its_timers[TIMER_MAX];
   98 };
   99 
  100 struct  kclock {
  101         int (*timer_create)(struct itimer *timer);
  102         int (*timer_settime)(struct itimer * timer, int flags,
  103                 struct itimerspec * new_value,
  104                 struct itimerspec * old_value);
  105         int (*timer_delete)(struct itimer * timer);
  106         int (*timer_gettime)(struct itimer * timer,
  107                 struct itimerspec * cur_value);
  108         void (*event_hook)(struct proc *p, clockid_t clock_id, int event);
  109 };
  110 
  111 /* Event values for event_hook() */
  112 #define ITIMER_EV_EXEC  0
  113 #define ITIMER_EV_EXIT  1
  114 
  115 int     itimer_accept(struct proc *p, int tid, ksiginfo_t *ksi);
  116 #endif
  117 #endif /* !_SYS_TIMERS_H_ */

Cache object: fbab103effae2ca95ab3dd6fcc6328b5


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