MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / ff_socket

Function ff_socket

libavformat/network.c:180–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178}
179
180int ff_socket(int af, int type, int proto, void *logctx)
181{
182 int fd;
183
184#ifdef SOCK_CLOEXEC
185 fd = socket(af, type | SOCK_CLOEXEC, proto);
186 if (fd == -1 && errno == EINVAL)
187#endif
188 {
189 fd = socket(af, type, proto);
190#if HAVE_FCNTL
191 if (fd != -1) {
192 if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
193 av_log(logctx, AV_LOG_DEBUG, "Failed to set close on exec\n");
194 }
195#endif
196 }
197#ifdef SO_NOSIGPIPE
198 if (fd != -1) {
199 if (setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &(int){1}, sizeof(int))) {
200 av_log(logctx, AV_LOG_WARNING, "setsockopt(SO_NOSIGPIPE) failed\n");
201 }
202 }
203#endif
204 return fd;
205}
206
207int ff_listen(int fd, const struct sockaddr *addr,
208 socklen_t addrlen, void *logctx)

Callers 5

start_connect_attemptFunction · 0.85
tcp_openFunction · 0.85
unix_openFunction · 0.85
sctp_openFunction · 0.85
udp_socket_createFunction · 0.85

Calls 1

av_logFunction · 0.85

Tested by

no test coverage detected