Coverage Report

Created: 2025-11-07 06:54

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/mosquitto/src/mux.c
Line
Count
Source
1
/*
2
Copyright (c) 2009-2021 Roger Light <roger@atchoo.org>
3
4
All rights reserved. This program and the accompanying materials
5
are made available under the terms of the Eclipse Public License 2.0
6
and Eclipse Distribution License v1.0 which accompany this distribution.
7
8
The Eclipse Public License is available at
9
   https://www.eclipse.org/legal/epl-2.0/
10
and the Eclipse Distribution License is available at
11
  http://www.eclipse.org/org/documents/edl-v10.php.
12
13
SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
14
15
Contributors:
16
   Roger Light - initial implementation and documentation.
17
   Tatsuzo Osawa - Add epoll.
18
*/
19
20
#include "mux.h"
21
22
23
int mux__init(void)
24
0
{
25
0
#ifdef WITH_EPOLL
26
0
  return mux_epoll__init();
27
#elif defined(WITH_KQUEUE)
28
  return mux_kqueue__init();
29
#else
30
  return mux_poll__init();
31
#endif
32
0
}
33
34
35
int mux__add_listeners(struct mosquitto__listener_sock *listensock, int listensock_count)
36
0
{
37
0
#ifdef WITH_EPOLL
38
0
  return mux_epoll__add_listeners(listensock, listensock_count);
39
#elif defined(WITH_KQUEUE)
40
  return mux_kqueue__add_listeners(listensock, listensock_count);
41
#else
42
  return mux_poll__add_listeners(listensock, listensock_count);
43
#endif
44
0
}
45
46
47
int mux__delete_listeners(struct mosquitto__listener_sock *listensock, int listensock_count)
48
0
{
49
0
#ifdef WITH_EPOLL
50
0
  return mux_epoll__delete_listeners(listensock, listensock_count);
51
#elif defined(WITH_KQUEUE)
52
  return mux_kqueue__delete_listeners(listensock, listensock_count);
53
#else
54
  return mux_poll__delete_listeners(listensock, listensock_count);
55
#endif
56
0
}
57
58
59
int mux__add_out(struct mosquitto *context)
60
0
{
61
0
#ifdef WITH_EPOLL
62
0
  return mux_epoll__add_out(context);
63
#elif defined(WITH_KQUEUE)
64
  return mux_kqueue__add_out(context);
65
#else
66
  return mux_poll__add_out(context);
67
#endif
68
0
}
69
70
71
int mux__remove_out(struct mosquitto *context)
72
0
{
73
0
#ifdef WITH_EPOLL
74
0
  return mux_epoll__remove_out(context);
75
#elif defined(WITH_KQUEUE)
76
  return mux_kqueue__remove_out(context);
77
#else
78
  return mux_poll__remove_out(context);
79
#endif
80
0
}
81
82
83
int mux__new(struct mosquitto *context)
84
0
{
85
0
#ifdef WITH_EPOLL
86
0
  return mux_epoll__new(context);
87
#elif defined(WITH_KQUEUE)
88
  return mux_kqueue__new(context);
89
#else
90
  return mux_poll__new(context);
91
#endif
92
0
}
93
94
95
int mux__delete(struct mosquitto *context)
96
0
{
97
0
#ifdef WITH_EPOLL
98
0
  return mux_epoll__delete(context);
99
#elif defined(WITH_KQUEUE)
100
  return mux_kqueue__delete(context);
101
#else
102
  return mux_poll__delete(context);
103
#endif
104
0
}
105
106
107
int mux__handle(struct mosquitto__listener_sock *listensock, int listensock_count)
108
0
{
109
0
#ifdef WITH_EPOLL
110
0
  UNUSED(listensock);
111
0
  UNUSED(listensock_count);
112
0
  return mux_epoll__handle();
113
#elif defined(WITH_KQUEUE)
114
  UNUSED(listensock);
115
  UNUSED(listensock_count);
116
  return mux_kqueue__handle();
117
#else
118
  return mux_poll__handle(listensock, listensock_count);
119
#endif
120
0
}
121
122
123
int mux__cleanup(void)
124
0
{
125
0
#ifdef WITH_EPOLL
126
0
  return mux_epoll__cleanup();
127
#elif defined(WITH_KQUEUE)
128
  return mux_kqueue__cleanup();
129
#else
130
  return mux_poll__cleanup();
131
#endif
132
0
}