MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / anetUnixServer

Function anetUnixServer

src/anet.c:495–511  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

493}
494
495int anetUnixServer(char *err, char *path, mode_t perm, int backlog)
496{
497 int s;
498 struct sockaddr_un sa;
499
500 if ((s = anetCreateSocket(err,AF_LOCAL)) == ANET_ERR)
501 return ANET_ERR;
502
503 memset(&sa,0,sizeof(sa));
504 sa.sun_family = AF_LOCAL;
505 strncpy(sa.sun_path,path,sizeof(sa.sun_path)-1);
506 if (anetListen(err,s,(struct sockaddr*)&sa,sizeof(sa),backlog) == ANET_ERR)
507 return ANET_ERR;
508 if (perm)
509 chmod(sa.sun_path, perm);
510 return s;
511}
512
513static int anetGenericAccept(char *err, int s, struct sockaddr *sa, socklen_t *len) {
514 int fd;

Callers 1

initNetworkingFunction · 0.85

Calls 2

anetCreateSocketFunction · 0.85
anetListenFunction · 0.85

Tested by

no test coverage detected