MCPcopy Create free account
hub / github.com/dermesser/libsocket / accept_unix_stream_socket

Function accept_unix_stream_socket

C/unix/libunixsocket.c:367–377  ·  view source on GitHub ↗

* @brief Accept connections on a passive UNIX socket * * @param sfd The server socket * @param flags Flags for `accept4(3)` (therefore useless on any other system * than Linux) * * @retval >0 Return value is a socket connected to the client * @retval <0 Error at `accept[4]()` */

Source from the content-addressed store, hash-verified

365 * @retval <0 Error at `accept[4]()`
366 */
367int accept_unix_stream_socket(int sfd, int flags) {
368 int cfd;
369
370 if (sfd < 0) return -1;
371#if LIBSOCKET_LINUX
372 if (-1 == check_error(cfd = accept4(sfd, 0, 0, flags))) return -1;
373#else
374 if (-1 == check_error(cfd = accept(sfd, 0, 0))) return -1;
375#endif
376 return cfd;
377}
378
379/**
380 * @brief Receive datagram from another UNIX socket

Callers 2

acceptMethod · 0.85
mainFunction · 0.85

Calls 1

check_errorFunction · 0.70

Tested by

no test coverage detected