MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / socket

Function socket

src/remote/inet.cpp:3382–3404  ·  view source on GitHub ↗

force socket descriptor to have SOCK_CLOEXEC set

Source from the content-addressed store, hash-verified

3380
3381// force socket descriptor to have SOCK_CLOEXEC set
3382SOCKET socket(int domain, int type, int protocol)
3383{
3384#ifdef WIN_NT
3385 return ::socket(domain, type, protocol);
3386#else
3387 int fd;
3388#if HAVE_DECL_SOCK_CLOEXEC
3389 do {
3390 fd = ::socket(domain, type | SOCK_CLOEXEC, protocol);
3391 } while (fd < 0 && SYSCALL_INTERRUPTED(errno));
3392
3393 if (fd < 0 && errno == EINVAL) // probably SOCK_CLOEXEC not accepted
3394#endif
3395 {
3396 do {
3397 fd = ::socket(domain, type, protocol);
3398 } while (fd < 0 && SYSCALL_INTERRUPTED(errno));
3399 }
3400
3401 setCloseOnExec(fd);
3402 return fd;
3403#endif
3404}
3405
3406// force socket descriptor to have SOCK_CLOEXEC set
3407SOCKET accept(SOCKET sockfd, struct sockaddr* addr, socklen_t* addrlen)

Callers 3

INET_connectFunction · 0.85
aux_connectFunction · 0.85
aux_requestFunction · 0.85

Calls 1

setCloseOnExecFunction · 0.85

Tested by

no test coverage detected