bs/libc/net: implement socketpair (3)

N/A

Reference here:
https://www.freebsd.org/cgi/man.cgi?apropos=0&sektion=2&query=socketpair&manpath=FreeBSD+7.0-current&format=html

Change-Id: I2d09f5148b2a720d1e7f380503deb8910c951599
Signed-off-by: danguanghua <danguanghua@xiaomi.com>
This commit is contained in:
danguanghua
2020-12-31 20:33:14 +08:00
committed by Xiang Xiao
parent 22b67c8cd4
commit b71d5f0e84
2 changed files with 3 additions and 5 deletions
+1 -2
View File
@@ -39,10 +39,9 @@ CSRCS += lib_addrconfig.c lib_base64.c lib_htons.c lib_htonl.c
CSRCS += lib_inetaddr.c lib_inetaton.c lib_inetntoa.c
CSRCS += lib_inetntop.c lib_inetpton.c
CSRCS += lib_etherntoa.c lib_etheraton.c
CSRCS += lib_socketpair.c
ifeq ($(CONFIG_NET),y)
CSRCS += lib_recvmsg.c lib_sendmsg.c lib_shutdown.c
CSRCS += lib_recvmsg.c lib_sendmsg.c lib_shutdown.c lib_socketpair.c
endif
ifeq ($(CONFIG_NET_LOOPBACK),y)
+2 -3
View File
@@ -72,7 +72,7 @@ static int create_socket(int domain, int type, int protocol,
int socketfd;
socketfd = socket(domain, type, protocol);
if (socketfd < -1)
if (socketfd < 0)
{
return socketfd;
}
@@ -162,12 +162,11 @@ int socketpair(int domain, int type, int protocol, int sv[2])
}
sv[0] = accept(listener, &addr[0].addr, &len);
close(listener);
if (sv[0] < 0)
{
goto err;
}
close(listener);
}
return 0;