mirror of
https://github.com/wiiu-env/wut.git
synced 2024-12-05 03:44:19 +01:00
33 lines
557 B
C
33 lines
557 B
C
#include "wut_socket.h"
|
|
|
|
int
|
|
accept(int sockfd,
|
|
struct sockaddr *address,
|
|
socklen_t *addrlen)
|
|
{
|
|
int rc, fd, dev;
|
|
|
|
fd = __wut_get_nsysnet_fd(sockfd);
|
|
if (fd == -1) {
|
|
return -1;
|
|
}
|
|
|
|
dev = __get_handle(sockfd)->device;
|
|
sockfd = fd;
|
|
|
|
fd = __alloc_handle(dev);
|
|
if (fd == -1) {
|
|
return -1;
|
|
}
|
|
|
|
rc = RPLWRAP(accept)(sockfd, address, addrlen);
|
|
if (rc == -1) {
|
|
__release_handle(fd);
|
|
return __wut_get_nsysnet_result(NULL, rc);
|
|
}
|
|
|
|
*(int *)__get_handle(fd)->fileStruct = rc;
|
|
return fd;
|
|
}
|
|
|