* @brief Creates a pair of connected sockets. * * This system call creates two connected sockets that can be used for bidirectional communication * between processes or threads. The sockets are returned as file descriptors in the `fd` array. * * @param[in] domain Specifies the protocol family to be used for the sockets. Common values include: * - `AF_UNIX`: Local commu
| 6253 | * @see sys_socket(), sys_close() |
| 6254 | */ |
| 6255 | sysret_t sys_socketpair(int domain, int type, int protocol, int fd[2]) |
| 6256 | { |
| 6257 | #ifdef RT_USING_SAL |
| 6258 | int ret = 0; |
| 6259 | int k_fd[2]; |
| 6260 | |
| 6261 | if (!lwp_user_accessable((void *)fd, sizeof(int [2]))) |
| 6262 | { |
| 6263 | return -EFAULT; |
| 6264 | } |
| 6265 | |
| 6266 | ret = socketpair(domain, type, protocol, k_fd); |
| 6267 | |
| 6268 | if (ret == 0) |
| 6269 | { |
| 6270 | lwp_put_to_user(fd, k_fd, sizeof(int [2])); |
| 6271 | } |
| 6272 | |
| 6273 | return ret; |
| 6274 | #else |
| 6275 | return -ELIBACC; |
| 6276 | #endif |
| 6277 | } |
| 6278 | |
| 6279 | /** |
| 6280 | * @brief Closes an open socket. |
nothing calls this directly
no test coverage detected