1139749Simp/*-
214258Sgibbs * SPDX-License-Identifier: BSD-3-Clause
314258Sgibbs *
414258Sgibbs * Copyright (c) 1990, 1993
514258Sgibbs *	The Regents of the University of California.  All rights reserved.
614258Sgibbs * (c) UNIX System Laboratories, Inc.
714258Sgibbs * All or some portions of this file are derived from material licensed
814258Sgibbs * to the University of California by American Telephone and Telegraph
914258Sgibbs * Co. or Unix System Laboratories, Inc. and are reproduced herein with
1014258Sgibbs * the permission of UNIX System Laboratories, Inc.
1114258Sgibbs *
1214258Sgibbs * Redistribution and use in source and binary forms, with or without
1314258Sgibbs * modification, are permitted provided that the following conditions
1414258Sgibbs * are met:
1514258Sgibbs * 1. Redistributions of source code must retain the above copyright
1614258Sgibbs *    notice, this list of conditions and the following disclaimer.
1714258Sgibbs * 2. Redistributions in binary form must reproduce the above copyright
1814258Sgibbs *    notice, this list of conditions and the following disclaimer in the
1914258Sgibbs *    documentation and/or other materials provided with the distribution.
2014258Sgibbs * 3. Neither the name of the University nor the names of its contributors
2114258Sgibbs *    may be used to endorse or promote products derived from this software
2214258Sgibbs *    without specific prior written permission.
23117700Smarkm *
24117700Smarkm * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25117700Smarkm * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2614258Sgibbs * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2714258Sgibbs * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2814258Sgibbs * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2918892Sbde * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3045791Speter * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3145791Speter * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3214258Sgibbs * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3345791Speter * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3445791Speter * SUCH DAMAGE.
35117700Smarkm */
3614258Sgibbs
3714258Sgibbs#ifndef _SYS__CALLOUT_H
3852549Smdodd#define	_SYS__CALLOUT_H
39117700Smarkm
4014258Sgibbs#include <sys/_types.h>
41112845Smdodd#include <sys/queue.h>
42112845Smdodd
4351879Smdoddstruct lock_object;
4451879Smdodd
4551879SmdoddLIST_HEAD(callout_list, callout);
4614258SgibbsSLIST_HEAD(callout_slist, callout);
4714258SgibbsTAILQ_HEAD(callout_tailq, callout);
4814258Sgibbs
4914258Sgibbstypedef void callout_func_t(void *);
5014258Sgibbs
5114258Sgibbsstruct callout {
5214258Sgibbs	union {
5314258Sgibbs		LIST_ENTRY(callout) le;
5414258Sgibbs		SLIST_ENTRY(callout) sle;
5514258Sgibbs		TAILQ_ENTRY(callout) tqe;
5614258Sgibbs	} c_links;
5714258Sgibbs	__sbintime_t c_time;			/* ticks to the event */
5814258Sgibbs	__sbintime_t c_precision;		/* delta allowed wrt opt */
5914258Sgibbs	void	*c_arg;				/* function argument */
6014258Sgibbs	callout_func_t *c_func;			/* function to call */
6114258Sgibbs	struct lock_object *c_lock;		/* lock to handle */
6214258Sgibbs	short	c_flags;			/* User State */
6314258Sgibbs	short	c_iflags;			/* Internal State */
6414258Sgibbs	volatile int c_cpu;			/* CPU we're scheduled on */
6514258Sgibbs};
6614258Sgibbs
6714258Sgibbs#endif
6814258Sgibbs