xref: /f-stack/tools/compat/include/sys/_callout.h (revision 1eaf0ac3)
1*1eaf0ac3Slogwang /*-
2*1eaf0ac3Slogwang  * Copyright (c) 1990, 1993
3*1eaf0ac3Slogwang  *	The Regents of the University of California.  All rights reserved.
4*1eaf0ac3Slogwang  * (c) UNIX System Laboratories, Inc.
5*1eaf0ac3Slogwang  * All or some portions of this file are derived from material licensed
6*1eaf0ac3Slogwang  * to the University of California by American Telephone and Telegraph
7*1eaf0ac3Slogwang  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8*1eaf0ac3Slogwang  * the permission of UNIX System Laboratories, Inc.
9*1eaf0ac3Slogwang  *
10*1eaf0ac3Slogwang  * Redistribution and use in source and binary forms, with or without
11*1eaf0ac3Slogwang  * modification, are permitted provided that the following conditions
12*1eaf0ac3Slogwang  * are met:
13*1eaf0ac3Slogwang  * 1. Redistributions of source code must retain the above copyright
14*1eaf0ac3Slogwang  *    notice, this list of conditions and the following disclaimer.
15*1eaf0ac3Slogwang  * 2. Redistributions in binary form must reproduce the above copyright
16*1eaf0ac3Slogwang  *    notice, this list of conditions and the following disclaimer in the
17*1eaf0ac3Slogwang  *    documentation and/or other materials provided with the distribution.
18*1eaf0ac3Slogwang  * 4. Neither the name of the University nor the names of its contributors
19*1eaf0ac3Slogwang  *    may be used to endorse or promote products derived from this software
20*1eaf0ac3Slogwang  *    without specific prior written permission.
21*1eaf0ac3Slogwang  *
22*1eaf0ac3Slogwang  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23*1eaf0ac3Slogwang  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24*1eaf0ac3Slogwang  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25*1eaf0ac3Slogwang  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26*1eaf0ac3Slogwang  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27*1eaf0ac3Slogwang  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28*1eaf0ac3Slogwang  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29*1eaf0ac3Slogwang  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30*1eaf0ac3Slogwang  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31*1eaf0ac3Slogwang  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32*1eaf0ac3Slogwang  * SUCH DAMAGE.
33*1eaf0ac3Slogwang  *
34*1eaf0ac3Slogwang  *	@(#)callout.h	8.2 (Berkeley) 1/21/94
35*1eaf0ac3Slogwang  * $FreeBSD$
36*1eaf0ac3Slogwang  */
37*1eaf0ac3Slogwang 
38*1eaf0ac3Slogwang #ifndef _SYS__CALLOUT_H
39*1eaf0ac3Slogwang #define	_SYS__CALLOUT_H
40*1eaf0ac3Slogwang 
41*1eaf0ac3Slogwang #include <sys/queue.h>
42*1eaf0ac3Slogwang 
43*1eaf0ac3Slogwang struct lock_object;
44*1eaf0ac3Slogwang 
45*1eaf0ac3Slogwang LIST_HEAD(callout_list, callout);
46*1eaf0ac3Slogwang SLIST_HEAD(callout_slist, callout);
47*1eaf0ac3Slogwang TAILQ_HEAD(callout_tailq, callout);
48*1eaf0ac3Slogwang 
49*1eaf0ac3Slogwang struct callout {
50*1eaf0ac3Slogwang 	union {
51*1eaf0ac3Slogwang 		LIST_ENTRY(callout) le;
52*1eaf0ac3Slogwang 		SLIST_ENTRY(callout) sle;
53*1eaf0ac3Slogwang 		TAILQ_ENTRY(callout) tqe;
54*1eaf0ac3Slogwang 	} c_links;
55*1eaf0ac3Slogwang 	sbintime_t c_time;			/* ticks to the event */
56*1eaf0ac3Slogwang 	sbintime_t c_precision;			/* delta allowed wrt opt */
57*1eaf0ac3Slogwang 	void	*c_arg;				/* function argument */
58*1eaf0ac3Slogwang 	void	(*c_func)(void *);		/* function to call */
59*1eaf0ac3Slogwang 	struct lock_object *c_lock;		/* lock to handle */
60*1eaf0ac3Slogwang 	short	c_flags;			/* User State */
61*1eaf0ac3Slogwang 	short	c_iflags;			/* Internal State */
62*1eaf0ac3Slogwang 	volatile int c_cpu;			/* CPU we're scheduled on */
63*1eaf0ac3Slogwang };
64*1eaf0ac3Slogwang 
65*1eaf0ac3Slogwang #endif
66