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/timevar.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 /*      $NetBSD: timevar.h,v 1.23 2008/07/15 16:18:09 christos Exp $    */
    2 
    3 /*
    4  *  Copyright (c) 2005, 2008 The NetBSD Foundation.
    5  *  All rights reserved.
    6  *
    7  *  Redistribution and use in source and binary forms, with or without
    8  *  modification, are permitted provided that the following conditions
    9  *  are met:
   10  *  1. Redistributions of source code must retain the above copyright
   11  *     notice, this list of conditions and the following disclaimer.
   12  *  2. Redistributions in binary form must reproduce the above copyright
   13  *     notice, this list of conditions and the following disclaimer in the
   14  *     documentation and/or other materials provided with the distribution.
   15  *
   16  *  THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   17  *  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   18  *  TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   19  *  PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   20  *  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   21  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   22  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   23  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   24  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   25  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   26  *  POSSIBILITY OF SUCH DAMAGE.
   27  */
   28 
   29 /*
   30  * Copyright (c) 1982, 1986, 1993
   31  *      The Regents of the University of California.  All rights reserved.
   32  *
   33  * Redistribution and use in source and binary forms, with or without
   34  * modification, are permitted provided that the following conditions
   35  * are met:
   36  * 1. Redistributions of source code must retain the above copyright
   37  *    notice, this list of conditions and the following disclaimer.
   38  * 2. Redistributions in binary form must reproduce the above copyright
   39  *    notice, this list of conditions and the following disclaimer in the
   40  *    documentation and/or other materials provided with the distribution.
   41  * 3. Neither the name of the University nor the names of its contributors
   42  *    may be used to endorse or promote products derived from this software
   43  *    without specific prior written permission.
   44  *
   45  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   46  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   47  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   48  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   49  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   50  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   51  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   52  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   53  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   54  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   55  * SUCH DAMAGE.
   56  *
   57  *      @(#)time.h      8.5 (Berkeley) 5/4/95
   58  */
   59 
   60 #ifndef _SYS_TIMEVAR_H_
   61 #define _SYS_TIMEVAR_H_
   62 
   63 #include <sys/callout.h>
   64 #include <sys/queue.h>
   65 #include <sys/signal.h>
   66 #include <sys/systm.h>
   67 
   68 /*
   69  * Structure used to manage timers in a process.
   70  */
   71 struct  ptimer {
   72         union {
   73                 callout_t       pt_ch;
   74                 struct {
   75                         LIST_ENTRY(ptimer)      pt_list;
   76                         int     pt_active;
   77                 } pt_nonreal;
   78         } pt_data;
   79         struct  sigevent pt_ev;
   80         struct  itimerspec pt_time;
   81         struct  ksiginfo pt_info;
   82         int     pt_overruns;    /* Overruns currently accumulating */
   83         int     pt_poverruns;   /* Overruns associated w/ a delivery */
   84         int     pt_type;
   85         int     pt_entry;
   86         int     pt_queued;
   87         struct proc *pt_proc;
   88         TAILQ_ENTRY(ptimer) pt_chain;
   89 };
   90 
   91 #define pt_ch   pt_data.pt_ch
   92 #define pt_list pt_data.pt_nonreal.pt_list
   93 #define pt_active       pt_data.pt_nonreal.pt_active
   94 
   95 #define TIMER_MAX       32      /* See ptimers->pts_fired if you enlarge this */
   96 #define TIMERS_ALL      0
   97 #define TIMERS_POSIX    1
   98 
   99 LIST_HEAD(ptlist, ptimer);
  100 
  101 struct  ptimers {
  102         struct ptlist pts_virtual;
  103         struct ptlist pts_prof;
  104         struct ptimer *pts_timers[TIMER_MAX];
  105         int pts_fired;
  106 };
  107 
  108 /*
  109  * Functions for looking at our clock: [get]{bin,nano,micro}[up]time()
  110  *
  111  * Functions without the "get" prefix returns the best timestamp
  112  * we can produce in the given format.
  113  *
  114  * "bin"   == struct bintime  == seconds + 64 bit fraction of seconds.
  115  * "nano"  == struct timespec == seconds + nanoseconds.
  116  * "micro" == struct timeval  == seconds + microseconds.
  117  *              
  118  * Functions containing "up" returns time relative to boot and
  119  * should be used for calculating time intervals.
  120  *
  121  * Functions without "up" returns GMT time.
  122  *
  123  * Functions with the "get" prefix returns a less precise result
  124  * much faster than the functions without "get" prefix and should
  125  * be used where a precision of 1/HZ (eg 10 msec on a 100HZ machine)
  126  * is acceptable or where performance is priority.
  127  * (NB: "precision", _not_ "resolution" !) 
  128  * 
  129  */
  130 
  131 void    binuptime(struct bintime *);
  132 void    nanouptime(struct timespec *);
  133 void    microuptime(struct timeval *);
  134 
  135 void    bintime(struct bintime *);
  136 void    nanotime(struct timespec *);
  137 void    microtime(struct timeval *);
  138 
  139 void    getbinuptime(struct bintime *);
  140 void    getnanouptime(struct timespec *);
  141 void    getmicrouptime(struct timeval *);
  142 
  143 void    getbintime(struct bintime *);
  144 void    getnanotime(struct timespec *);
  145 void    getmicrotime(struct timeval *);
  146 
  147 /* Other functions */
  148 int     adjtime1(const struct timeval *, struct timeval *, struct proc *);
  149 int     clock_settime1(struct proc *, clockid_t, const struct timespec *, bool);
  150 int     dogetitimer(struct proc *, int, struct itimerval *);
  151 int     dosetitimer(struct proc *, int, struct itimerval *);
  152 int     dotimer_gettime(int, struct proc *, struct itimerspec *);
  153 int     dotimer_settime(int, struct itimerspec *, struct itimerspec *, int,
  154             struct proc *);
  155 int     tshzto(const struct timespec *);
  156 int     tvhzto(const struct timeval *);
  157 void    inittimecounter(void);
  158 int     itimerfix(struct timeval *);
  159 int     itimespecfix(struct timespec *);
  160 int     ppsratecheck(struct timeval *, int *, int);
  161 int     ratecheck(struct timeval *, const struct timeval *);
  162 void    realtimerexpire(void *);
  163 int     settime(struct proc *p, struct timespec *);
  164 int     nanosleep1(struct lwp *l, struct timespec *, struct timespec *);
  165 int     settimeofday1(const struct timeval *, bool,
  166             const void *, struct lwp *, bool);
  167 int     timer_create1(timer_t *, clockid_t, struct sigevent *, copyin_t,
  168             struct lwp *);
  169 void    timer_gettime(struct ptimer *, struct itimerspec *);
  170 void    timer_settime(struct ptimer *);
  171 struct  ptimers *timers_alloc(struct proc *);
  172 void    timers_free(struct proc *, int);
  173 void    timer_tick(struct lwp *, bool);
  174 int     tstohz(const struct timespec *);
  175 int     tvtohz(const struct timeval *);
  176 int     inittimeleft(struct timeval *, struct timeval *);
  177 int     gettimeleft(struct timeval *, struct timeval *);
  178 void    timerupcall(struct lwp *);
  179 void    time_init(void);
  180 void    time_init2(void);
  181 
  182 extern time_t time_second;      /* current second in the epoch */
  183 extern time_t time_uptime;      /* system uptime in seconds */
  184 
  185 #endif /* !_SYS_TIMEVAR_H_ */

Cache object: 60e75de60680c567af612e79e3dc1486


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