File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ add_library(ogc STATIC
88 lwpcompat/lwpc_mq.c
99
1010 ogc_sockets/soc_common.c
11+ ogc_sockets/soc_socket.c
1112
1213 console.c
1314 lwp_queue.c
Original file line number Diff line number Diff line change 55#include <string.h>
66#include <sys/iosupport.h>
77#include <gctypes.h>
8+ #include <network.h>
89
910#define SYNC_ERROR ENODEV
1011
Original file line number Diff line number Diff line change 1+ #include "soc_common.h"
2+ #include <errno.h>
3+
4+ int socket (int domain , int type , int protocol )
5+ {
6+ s32 ret = 0 ;
7+ int fd , dev ;
8+ __handle * handle ;
9+
10+ dev = FindDevice ("soc:" );
11+ if (dev < 0 ) {
12+ errno = ENODEV ;
13+ return -1 ;
14+ }
15+
16+ fd = __alloc_handle (dev );
17+ if (fd < 0 ) return fd ;
18+ handle = __get_handle (fd );
19+ handle -> device = dev ;
20+ handle -> fileStruct = ((void * )handle ) + sizeof (__handle );
21+
22+
23+ ret = net_socket ( domain , type , protocol );
24+
25+ if (ret < 0 ) {
26+ __release_handle (fd );
27+ errno = - ret ;
28+ return -1 ;
29+ }
30+
31+ * (Handle * )handle -> fileStruct = ret ;
32+
33+ return fd ;
34+ }
You can’t perform that action at this time.
0 commit comments