xref: /illumos-gate/usr/src/cmd/bhyve/mevent.h (revision 32640292)
1bf21cd93STycho Nightingale /*-
2*32640292SAndy Fiddaman  * SPDX-License-Identifier: BSD-2-Clause
34c87aefeSPatrick Mooney  *
4bf21cd93STycho Nightingale  * Copyright (c) 2011 NetApp, Inc.
5bf21cd93STycho Nightingale  * All rights reserved.
6bf21cd93STycho Nightingale  *
7bf21cd93STycho Nightingale  * Redistribution and use in source and binary forms, with or without
8bf21cd93STycho Nightingale  * modification, are permitted provided that the following conditions
9bf21cd93STycho Nightingale  * are met:
10bf21cd93STycho Nightingale  * 1. Redistributions of source code must retain the above copyright
11bf21cd93STycho Nightingale  *    notice, this list of conditions and the following disclaimer.
12bf21cd93STycho Nightingale  * 2. Redistributions in binary form must reproduce the above copyright
13bf21cd93STycho Nightingale  *    notice, this list of conditions and the following disclaimer in the
14bf21cd93STycho Nightingale  *    documentation and/or other materials provided with the distribution.
15bf21cd93STycho Nightingale  *
16bf21cd93STycho Nightingale  * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND
17bf21cd93STycho Nightingale  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18bf21cd93STycho Nightingale  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19bf21cd93STycho Nightingale  * ARE DISCLAIMED.  IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE
20bf21cd93STycho Nightingale  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21bf21cd93STycho Nightingale  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22bf21cd93STycho Nightingale  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23bf21cd93STycho Nightingale  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24bf21cd93STycho Nightingale  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25bf21cd93STycho Nightingale  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26bf21cd93STycho Nightingale  * SUCH DAMAGE.
27bf21cd93STycho Nightingale  */
28bf21cd93STycho Nightingale 
294c87aefeSPatrick Mooney #ifndef	_MEVENT_H_
304c87aefeSPatrick Mooney #define	_MEVENT_H_
314c87aefeSPatrick Mooney 
324c87aefeSPatrick Mooney enum ev_type {
334c87aefeSPatrick Mooney 	EVF_READ,
344c87aefeSPatrick Mooney 	EVF_WRITE,
354c87aefeSPatrick Mooney 	EVF_TIMER,
36b0de25cbSAndy Fiddaman 	EVF_SIGNAL,
37b0de25cbSAndy Fiddaman 	EVF_VNODE,
384c87aefeSPatrick Mooney };
394c87aefeSPatrick Mooney 
40b0de25cbSAndy Fiddaman /* Filter flags for EVF_VNODE */
41b0de25cbSAndy Fiddaman #define	EVFF_ATTRIB	0x0001
42b0de25cbSAndy Fiddaman 
434c87aefeSPatrick Mooney struct mevent;
444c87aefeSPatrick Mooney 
456dc98349SAndy Fiddaman struct mevent *mevent_add(int fd, enum ev_type type,
464c87aefeSPatrick Mooney 			  void (*func)(int, enum ev_type, void *),
474c87aefeSPatrick Mooney 			  void *param);
48b0de25cbSAndy Fiddaman struct mevent *mevent_add_flags(int fd, enum ev_type type, int fflags,
49b0de25cbSAndy Fiddaman 			  void (*func)(int, enum ev_type, void *),
50b0de25cbSAndy Fiddaman 			  void *param);
51154972afSPatrick Mooney struct mevent *mevent_add_disabled(int fd, enum ev_type type,
52154972afSPatrick Mooney 			  void (*func)(int, enum ev_type, void *),
53154972afSPatrick Mooney 			  void *param);
544c87aefeSPatrick Mooney int	mevent_enable(struct mevent *evp);
554c87aefeSPatrick Mooney int	mevent_disable(struct mevent *evp);
564c87aefeSPatrick Mooney int	mevent_delete(struct mevent *evp);
574c87aefeSPatrick Mooney int	mevent_delete_close(struct mevent *evp);
58bf21cd93STycho Nightingale 
594c87aefeSPatrick Mooney void	mevent_dispatch(void);
60bf21cd93STycho Nightingale 
614c87aefeSPatrick Mooney #endif	/* _MEVENT_H_ */
62