File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ add_library(ogc STATIC
1515 ogc_sockets/soc_recv.c
1616 ogc_sockets/soc_connect.c
1717 ogc_sockets/soc_shutdown.c
18+ ogc_sockets/soc_accept.c
1819
1920 console.c
2021 lwp_queue.c
Original file line number Diff line number Diff line change 1+ #include "soc_common.h"
2+ #include <errno.h>
3+ #include <sys/socket.h>
4+
5+ int accept (int sockfd , struct sockaddr * addr , socklen_t * addrlen )
6+ {
7+ sockfd = soc_get_fd (sockfd );
8+
9+ if (sockfd < 0 ) {
10+ errno = - sockfd ;
11+ return -1 ;
12+ }
13+
14+ int dev = FindDevice ("soc:" );
15+ if (dev < 0 ) {
16+ errno = ENODEV ;
17+ return -1 ;
18+ }
19+
20+ int fd = __alloc_handle (dev );
21+ if (fd < 0 ) return fd ;
22+
23+
24+ int ret = net_accept (sockfd , addr , addrlen );
25+ if (ret < 0 ) {
26+ errno = - ret ;
27+ return -1 ;
28+ }
29+
30+ __handle * handle = __get_handle (fd );
31+ * (Handle * )handle -> fileStruct = ret ;
32+
33+ return fd ;
34+ }
You can’t perform that action at this time.
0 commit comments