MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / sal_socketpair

Function sal_socketpair

components/net/sal/src/sal_socket.c:1120–1148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1118}
1119
1120int sal_socketpair(int domain, int type, int protocol, int *fds)
1121{
1122 int unix_fd[2];
1123 struct sal_socket *socka;
1124 struct sal_socket *sockb;
1125 struct sal_proto_family *pf;
1126
1127 if (domain == AF_UNIX)
1128 {
1129 /* get the socket object by socket descriptor */
1130 SAL_SOCKET_OBJ_GET(socka, fds[0]);
1131 SAL_SOCKET_OBJ_GET(sockb, fds[1]);
1132
1133 /* valid the network interface socket opreation */
1134 SAL_NETDEV_SOCKETOPS_VALID(socka->netdev, pf, socket);
1135
1136 unix_fd[0] = (int)(size_t)socka->user_data;
1137 unix_fd[1] = (int)(size_t)sockb->user_data;
1138
1139 if (pf->skt_ops->socketpair)
1140 {
1141 return pf->skt_ops->socketpair(domain, type, protocol, unix_fd);
1142 }
1143 }
1144
1145 rt_set_errno(EINVAL);
1146
1147 return -1;
1148}
1149
1150int sal_closesocket(int socket)
1151{

Callers 1

socketpairFunction · 0.85

Calls 1

rt_set_errnoFunction · 0.85

Tested by

no test coverage detected