Deleted Added
full compact
mevent.c (330449) mevent.c (336161)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2011 NetApp, Inc.
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

--- 11 unchanged lines hidden (view full) ---

20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2011 NetApp, Inc.
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

--- 11 unchanged lines hidden (view full) ---

20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $FreeBSD: stable/11/usr.sbin/bhyve/mevent.c 330449 2018-03-05 07:26:05Z eadler $
28 * $FreeBSD: stable/11/usr.sbin/bhyve/mevent.c 336161 2018-07-10 04:26:32Z araujo $
29 */
30
31/*
32 * Micro event library for FreeBSD, designed for a single i/o thread
33 * using kqueue, and having events be persistent by default.
34 */
35
36#include <sys/cdefs.h>
29 */
30
31/*
32 * Micro event library for FreeBSD, designed for a single i/o thread
33 * using kqueue, and having events be persistent by default.
34 */
35
36#include <sys/cdefs.h>
37__FBSDID("$FreeBSD: stable/11/usr.sbin/bhyve/mevent.c 330449 2018-03-05 07:26:05Z eadler $");
37__FBSDID("$FreeBSD: stable/11/usr.sbin/bhyve/mevent.c 336161 2018-07-10 04:26:32Z araujo $");
38
39#include <assert.h>
40#include <err.h>
41#include <errno.h>
42#include <stdlib.h>
43#include <stdio.h>
44#include <string.h>
45#include <sysexits.h>

--- 20 unchanged lines hidden (view full) ---

66
67extern char *vmname;
68
69static pthread_t mevent_tid;
70static int mevent_timid = 43;
71static int mevent_pipefd[2];
72static pthread_mutex_t mevent_lmutex = PTHREAD_MUTEX_INITIALIZER;
73
38
39#include <assert.h>
40#include <err.h>
41#include <errno.h>
42#include <stdlib.h>
43#include <stdio.h>
44#include <string.h>
45#include <sysexits.h>

--- 20 unchanged lines hidden (view full) ---

66
67extern char *vmname;
68
69static pthread_t mevent_tid;
70static int mevent_timid = 43;
71static int mevent_pipefd[2];
72static pthread_mutex_t mevent_lmutex = PTHREAD_MUTEX_INITIALIZER;
73
74struct mevent {
74struct mevent {
75 void (*me_func)(int, enum ev_type, void *);
76#define me_msecs me_fd
77 int me_fd;
78 int me_timid;
79 enum ev_type me_type;
80 void *me_param;
81 int me_cq;
82 int me_state;
83 int me_closefd;
75 void (*me_func)(int, enum ev_type, void *);
76#define me_msecs me_fd
77 int me_fd;
78 int me_timid;
79 enum ev_type me_type;
80 void *me_param;
81 int me_cq;
82 int me_state;
83 int me_closefd;
84 LIST_ENTRY(mevent) me_list;
84 LIST_ENTRY(mevent) me_list;
85};
86
87static LIST_HEAD(listhead, mevent) global_head, change_head;
88
89static void
90mevent_qlock(void)
91{
92 pthread_mutex_lock(&mevent_lmutex);

--- 388 unchanged lines hidden ---
85};
86
87static LIST_HEAD(listhead, mevent) global_head, change_head;
88
89static void
90mevent_qlock(void)
91{
92 pthread_mutex_lock(&mevent_lmutex);

--- 388 unchanged lines hidden ---