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

Cache object: 18a7df6b39dc1db3899c496aa4388818


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