MCPcopy Create free account
hub / github.com/F-Stack/f-stack / anetUnixServer

Function anetUnixServer

app/redis-6.2.6/src/anet.c:486–502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

484}
485
486int anetUnixServer(char *err, char *path, mode_t perm, int backlog)
487{
488 int s;
489 struct sockaddr_un sa;
490
491 if ((s = anetCreateSocket(err,AF_LOCAL)) == ANET_ERR)
492 return ANET_ERR;
493
494 memset(&sa,0,sizeof(sa));
495 sa.sun_family = AF_LOCAL;
496 strncpy(sa.sun_path,path,sizeof(sa.sun_path)-1);
497 if (anetListen(err,s,(struct sockaddr*)&sa,sizeof(sa),backlog) == ANET_ERR)
498 return ANET_ERR;
499 if (perm)
500 chmod(sa.sun_path, perm);
501 return s;
502}
503
504static int anetGenericAccept(char *err, int s, struct sockaddr *sa, socklen_t *len) {
505 int fd;

Callers 1

initServerFunction · 0.85

Calls 4

anetCreateSocketFunction · 0.85
memsetFunction · 0.85
strncpyFunction · 0.85
anetListenFunction · 0.85

Tested by

no test coverage detected