MCPcopy Create free account
hub / github.com/catboost/catboost / TFeatureCheck

Method TFeatureCheck

util/network/nonblock.cpp:19–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17namespace {
18 struct TFeatureCheck {
19 inline TFeatureCheck()
20 : Accept4(nullptr)
21 , HaveSockNonBlock(false)
22 {
23#if defined(_unix_) && defined(SOCK_NONBLOCK)
24 {
25 Accept4 = reinterpret_cast<TAccept4>(dlsym(RTLD_DEFAULT, "accept4"));
26
27 #if defined(_musl_)
28 // musl always statically linked
29 if (!Accept4) {
30 Accept4 = accept4;
31 }
32 #endif
33
34 if (Accept4) {
35 Accept4(-1, nullptr, nullptr, SOCK_NONBLOCK);
36
37 if (errno == ENOSYS) {
38 Accept4 = nullptr;
39 }
40 }
41 }
42#endif
43
44#if defined(SOCK_NONBLOCK)
45 {
46 TSocketHolder tmp(socket(PF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0));
47
48 HaveSockNonBlock = !tmp.Closed();
49 }
50#endif
51 }
52
53 inline SOCKET FastAccept(SOCKET s, struct sockaddr* addr, socklen_t* addrlen) const {
54#if defined(SOCK_NONBLOCK)

Callers

nothing calls this directly

Calls 2

Accept4Function · 0.85
ClosedMethod · 0.45

Tested by

no test coverage detected