1.\" 2.\" Copyright (c) 2010, The DragonFly Project. 3.\" 4.\" This software is derived from software contributed to the DragonFly Project 5.\" by Venkatesh Srinivas <me@endeavour.zapto.org>. 6.\" 7.\" Permission to use, copy, modify, or distribute this software for any 8.\" purpose with or without fee is hereby granted, provided that the above 9.\" copyright notice and this permission notice appear in all copies. 10.\" 11.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR OTHER DAMAGES 15.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN 16.\" ACTION OF CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF 17.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18.\" 19.Dd August 19, 2010 20.Dt SYSTIMER 9 21.Os 22.Sh NAME 23.Nm systimer_init_periodic , 24.Nm systimer_init_periodic_nq , 25.Nm systimer_adjust_periodic , 26.Nm systimer_init_oneshot 27.Nd periodic callbacks 28.Sh SYNOPSIS 29.In sys/systimer.h 30.Ft void 31.Fn systimer_init_periodic "systimer_t info" "void *func" "void *data" "int hz" 32.Ft void 33.Fn systimer_init_periodic_nq "systimer_t info" "void *func" "void *data" "int hz" 34.Ft void 35.Fn systimer_adjust_periodic "systimer_t info" "int hz" 36.Ft void 37.Fn systimer_init_oneshot "systimer_t info" "void *func" "void *data" "int us" 38.Sh DESCRIPTION 39.Pp 40Systimers invoke callbacks at either fixed frequencies or after time delays. 41The callbacks are invoked in an interrupt thread and should only be used 42for limited work. 43.Pp 44The 45.Fn systimer_init_periodic 46function initializes a systimer callback function to be called at frequency 47.Fa hz . 48The 49.Fa info 50argument is an allocated systimer structure; the 51.Fa func 52argument is the function to call, with argument 53.Fa data . 54.Pp 55The 56.Fn systimer_init_periodic_nq 57function initializes a systimer callback function to be called at a frequency 58.Fa hz . 59Unlike the 60.Fn systimer_init_periodic 61function, the 62.Fn systimer_init_periodic_nq 63function's callback is only called once at a given time, even if delays caused 64multiple time intervals to have occurred. 65.Pp 66The 67.Fn systimer_adjust_periodic 68function changes the frequency at which a systimer's callback is invoked. 69The 70current time interval is not affected. 71The 72.Fa hz 73argument specifies the new frequency. 74.Pp 75The 76.Fn systimer_init_oneshot 77function arranges for a systimer callback function 78.Fa func 79to be invoked with argument 80.Fa data 81once, after at least 82.Fa us 83microseconds. 84.Sh EXAMPLE 85A simple example of using a one-short systimer to call a function after a short 86time: 87.Bd -literal -offset indent 88\&... 89static struct systimer short_st; 90char *str = "goodbye!"; 91\&... 92systimer_init_oneshot(&short_st, panic, str, 1000); 93\&... 94.Ed 95.Sh FILES 96The systimer implementation is in 97.Pa /sys/kern/kern_systimer.c . 98.Sh SEE ALSO 99.Xr callout 9 100.Sh HISTORY 101Systimers first appeared in 102.Dx 1.0 . 103