MCPcopy Create free account
hub / github.com/COVESA/vsomeip / react

Function react

implementation/utility/src/wrappers.cpp:180–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178} /* extern "C" */
179
180void react(int fd, const char* func, int _errno) {
181 // if this happens, there is a serious logical issue somewhere:
182 // 1) application accidentally close'd a descriptor that belongs to libvsomeip
183 // 2) libvsomeip itself double close'd a descriptor
184
185 const int e = (_errno != 0) ? _errno : errno;
186
187 char errno_buf[32];
188 const char* errno_str;
189 // EBADF and EINVAL are handled differently in order to keep compatibility.
190 // Previous versions had a "EBADF" and `strerrorname_np` is GNU/Linux only.
191 if (errno == EBADF) {
192 errno_str = "EBADF";
193 } else if (errno == EINVAL) {
194 errno_str = "EINVAL";
195 } else {
196 snprintf(errno_buf, sizeof(errno_buf), "%d", e);
197 errno_str = errno_buf;
198 }
199
200 std::string msg = std::string(func) + "(" + std::to_string(fd) + ") failed with errno " + std::string(errno_str) + ", descriptor leak!";
201
202 VSOMEIP_FATAL << msg;
203 std::cerr << "[libvsomeip] " << msg << "\n";
204
205 const auto st = boost::stacktrace::stacktrace();
206 for (const auto& frame : st) {
207 VSOMEIP_FATAL << frame;
208 std::cerr << frame;
209 }
210
211 VSOMEIP_TERMINATE(msg.c_str());
212}
213
214#endif

Callers 8

set_stateMethod · 0.85
__wrap_closeFunction · 0.85
__wrap_recvfromFunction · 0.85
__wrap_recvmsgFunction · 0.85
__wrap_sendtoFunction · 0.85
__wrap_sendmsgFunction · 0.85
__wrap_epoll_waitFunction · 0.85
__wrap_epoll_pwaitFunction · 0.85

Calls 1

to_stringFunction · 0.50

Tested by

no test coverage detected