Coverage Report

Created: 2025-08-26 06:48

/src/mosquitto/src/mux.c
Line
Count
Source (jump to first uncovered line)
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
int mux__init(void)
23
0
{
24
0
#ifdef WITH_EPOLL
25
0
  return mux_epoll__init();
26
#elif defined(WITH_KQUEUE)
27
  return mux_kqueue__init();
28
#else
29
  return mux_poll__init();
30
#endif
31
0
}
32
33
int mux__add_listeners(struct mosquitto__listener_sock *listensock, int listensock_count)
34
0
{
35
0
#ifdef WITH_EPOLL
36
0
  return mux_epoll__add_listeners(listensock, listensock_count);
37
#elif defined(WITH_KQUEUE)
38
  return mux_kqueue__add_listeners(listensock, listensock_count);
39
#else
40
  return mux_poll__add_listeners(listensock, listensock_count);
41
#endif
42
0
}
43
44
int mux__delete_listeners(struct mosquitto__listener_sock *listensock, int listensock_count)
45
0
{
46
0
#ifdef WITH_EPOLL
47
0
  return mux_epoll__delete_listeners(listensock, listensock_count);
48
#elif defined(WITH_KQUEUE)
49
  return mux_kqueue__delete_listeners(listensock, listensock_count);
50
#else
51
  return mux_poll__delete_listeners(listensock, listensock_count);
52
#endif
53
0
}
54
55
int mux__add_out(struct mosquitto *context)
56
0
{
57
0
#ifdef WITH_EPOLL
58
0
  return mux_epoll__add_out(context);
59
#elif defined(WITH_KQUEUE)
60
  return mux_kqueue__add_out(context);
61
#else
62
  return mux_poll__add_out(context);
63
#endif
64
0
}
65
66
67
int mux__remove_out(struct mosquitto *context)
68
0
{
69
0
#ifdef WITH_EPOLL
70
0
  return mux_epoll__remove_out(context);
71
#elif defined(WITH_KQUEUE)
72
  return mux_kqueue__remove_out(context);
73
#else
74
  return mux_poll__remove_out(context);
75
#endif
76
0
}
77
78
79
int mux__new(struct mosquitto *context)
80
0
{
81
0
#ifdef WITH_EPOLL
82
0
  return mux_epoll__new(context);
83
#elif defined(WITH_KQUEUE)
84
  return mux_kqueue__new(context);
85
#else
86
  return mux_poll__new(context);
87
#endif
88
0
}
89
90
91
int mux__delete(struct mosquitto *context)
92
0
{
93
0
#ifdef WITH_EPOLL
94
0
  return mux_epoll__delete(context);
95
#elif defined(WITH_KQUEUE)
96
  return mux_kqueue__delete(context);
97
#else
98
  return mux_poll__delete(context);
99
#endif
100
0
}
101
102
103
int mux__handle(struct mosquitto__listener_sock *listensock, int listensock_count)
104
0
{
105
0
#ifdef WITH_EPOLL
106
0
  UNUSED(listensock);
107
0
  UNUSED(listensock_count);
108
0
  return mux_epoll__handle();
109
#elif defined(WITH_KQUEUE)
110
  UNUSED(listensock);
111
  UNUSED(listensock_count);
112
  return mux_kqueue__handle();
113
#else
114
  return mux_poll__handle(listensock, listensock_count);
115
#endif
116
0
}
117
118
119
int mux__cleanup(void)
120
0
{
121
0
#ifdef WITH_EPOLL
122
0
  return mux_epoll__cleanup();
123
#elif defined(WITH_KQUEUE)
124
  return mux_kqueue__cleanup();
125
#else
126
  return mux_poll__cleanup();
127
#endif
128
0
}