File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -159,6 +159,8 @@ void net_wc24cleanup(void);
159159s32 net_get_mac_address (void * mac_buf );
160160void net_deinit (void );
161161
162+ s32 _net_convert_error (s32 ios_retval );
163+
162164u32 net_gethostip (void );
163165s32 net_socket (u32 domain ,u32 type ,u32 protocol );
164166s32 net_bind (s32 s ,struct sockaddr * name ,socklen_t namelen );
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ add_library(ogc STATIC
77 lwpcompat/lwpc_sem.c
88 lwpcompat/lwpc_mq.c
99
10+ ogc_sockets/soc_common.c
11+
1012 console.c
1113 lwp_queue.c
1214 lwp_wkspace.c
Original file line number Diff line number Diff line change @@ -69,7 +69,6 @@ distribution.
6969#define IOCTL_NCD_GETLINKSTATUS 0x07
7070#define IOCTLV_NCD_GETMACADDRESS 0x08
7171
72- #define NET_UNKNOWN_ERROR_OFFSET -10000
7372
7473#define IOCTLV_SO_GETINTERFACEOPT_LEVEL 0x0000FFFE;
7574
@@ -191,87 +190,6 @@ struct getinterfaceopt_iproute{
191190 u64 ticks ;
192191};
193192
194- // 0 means we don't know what this error code means
195- // I sense a pattern here...
196- static u8 _net_error_code_map [] = {
197- 0 , // 0
198- E2BIG ,
199- EACCES ,
200- EADDRINUSE ,
201- EADDRNOTAVAIL ,
202- EAFNOSUPPORT , // 5
203- EAGAIN ,
204- EALREADY ,
205- EBADFD ,
206- EBADMSG ,
207- EBUSY , // 10
208- ECANCELED ,
209- ECHILD ,
210- ECONNABORTED ,
211- ECONNREFUSED ,
212- ECONNRESET , // 15
213- EDEADLK ,
214- EDESTADDRREQ ,
215- EDOM ,
216- EDQUOT ,
217- EEXIST , // 20
218- EFAULT ,
219- EFBIG ,
220- EHOSTUNREACH ,
221- EIDRM ,
222- EILSEQ , // 25
223- EINPROGRESS ,
224- EINTR ,
225- EINVAL ,
226- EIO ,
227- EISCONN , // 30
228- EISDIR ,
229- ELOOP ,
230- EMFILE ,
231- EMLINK ,
232- EMSGSIZE , // 35
233- EMULTIHOP ,
234- ENAMETOOLONG ,
235- ENETDOWN ,
236- ENETRESET ,
237- ENETUNREACH , // 40
238- ENFILE ,
239- ENOBUFS ,
240- ENODATA ,
241- ENODEV ,
242- ENOENT , // 45
243- ENOEXEC ,
244- ENOLCK ,
245- ENOLINK ,
246- ENOMEM ,
247- ENOMSG , // 50
248- ENOPROTOOPT ,
249- ENOSPC ,
250- ENOSR ,
251- ENOSTR ,
252- ENOSYS , // 55
253- ENOTCONN ,
254- ENOTDIR ,
255- ENOTEMPTY ,
256- ENOTSOCK ,
257- ENOTSUP , // 60
258- ENOTTY ,
259- ENXIO ,
260- EOPNOTSUPP ,
261- EOVERFLOW ,
262- EPERM , // 65
263- EPIPE ,
264- EPROTO ,
265- EPROTONOSUPPORT ,
266- EPROTOTYPE ,
267- ERANGE , // 70
268- EROFS ,
269- ESPIPE ,
270- ESRCH ,
271- ESTALE ,
272- ETIME , // 75
273- ETIMEDOUT ,
274- };
275193
276194static const s32 maxblocksize = (NET_HEAP_SIZE /2 );
277195static volatile bool _init_busy = false;
@@ -324,16 +242,6 @@ static BOOL net_free(void *ptr)
324242 return __lwp_heap_free (& __net_heap , ptr );
325243}
326244
327- static s32 _net_convert_error (s32 ios_retval )
328- {
329- // return ios_retval;
330- if (ios_retval >= 0 ) return ios_retval ;
331- if (ios_retval < - sizeof (_net_error_code_map )
332- || !_net_error_code_map [- ios_retval ])
333- return NET_UNKNOWN_ERROR_OFFSET + ios_retval ;
334- return - _net_error_code_map [- ios_retval ];
335- }
336-
337245u32 net_gethostip (void )
338246{
339247 u32 ip_addr = 0 ;
Original file line number Diff line number Diff line change 1+ #include "soc_common.h"
2+
3+
4+ #define NET_UNKNOWN_ERROR_OFFSET -10000
5+
6+ // 0 means we don't know what this error code means
7+ // I sense a pattern here...
8+ static u8 _net_error_code_map [] = {
9+ 0 , // 0
10+ E2BIG ,
11+ EACCES ,
12+ EADDRINUSE ,
13+ EADDRNOTAVAIL ,
14+ EAFNOSUPPORT , // 5
15+ EAGAIN ,
16+ EALREADY ,
17+ EBADFD ,
18+ EBADMSG ,
19+ EBUSY , // 10
20+ ECANCELED ,
21+ ECHILD ,
22+ ECONNABORTED ,
23+ ECONNREFUSED ,
24+ ECONNRESET , // 15
25+ EDEADLK ,
26+ EDESTADDRREQ ,
27+ EDOM ,
28+ EDQUOT ,
29+ EEXIST , // 20
30+ EFAULT ,
31+ EFBIG ,
32+ EHOSTUNREACH ,
33+ EIDRM ,
34+ EILSEQ , // 25
35+ EINPROGRESS ,
36+ EINTR ,
37+ EINVAL ,
38+ EIO ,
39+ EISCONN , // 30
40+ EISDIR ,
41+ ELOOP ,
42+ EMFILE ,
43+ EMLINK ,
44+ EMSGSIZE , // 35
45+ EMULTIHOP ,
46+ ENAMETOOLONG ,
47+ ENETDOWN ,
48+ ENETRESET ,
49+ ENETUNREACH , // 40
50+ ENFILE ,
51+ ENOBUFS ,
52+ ENODATA ,
53+ ENODEV ,
54+ ENOENT , // 45
55+ ENOEXEC ,
56+ ENOLCK ,
57+ ENOLINK ,
58+ ENOMEM ,
59+ ENOMSG , // 50
60+ ENOPROTOOPT ,
61+ ENOSPC ,
62+ ENOSR ,
63+ ENOSTR ,
64+ ENOSYS , // 55
65+ ENOTCONN ,
66+ ENOTDIR ,
67+ ENOTEMPTY ,
68+ ENOTSOCK ,
69+ ENOTSUP , // 60
70+ ENOTTY ,
71+ ENXIO ,
72+ EOPNOTSUPP ,
73+ EOVERFLOW ,
74+ EPERM , // 65
75+ EPIPE ,
76+ EPROTO ,
77+ EPROTONOSUPPORT ,
78+ EPROTOTYPE ,
79+ ERANGE , // 70
80+ EROFS ,
81+ ESPIPE ,
82+ ESRCH ,
83+ ESTALE ,
84+ ETIME , // 75
85+ ETIMEDOUT ,
86+ };
87+
88+ s32 _net_convert_error (s32 ios_retval )
89+ {
90+ // return ios_retval;
91+ if (ios_retval >= 0 ) return ios_retval ;
92+ if (ios_retval < - sizeof (_net_error_code_map )
93+ || !_net_error_code_map [- ios_retval ])
94+ return NET_UNKNOWN_ERROR_OFFSET + ios_retval ;
95+ return - _net_error_code_map [- ios_retval ];
96+ }
Original file line number Diff line number Diff line change 1+ #pragma once
2+ #define __LINUX_ERRNO_EXTENSIONS__
3+
4+ #include <errno.h>
5+ #include <string.h>
6+ #include <sys/iosupport.h>
7+ #include <gctypes.h>
8+
9+ #define SYNC_ERROR ENODEV
10+
11+ typedef s32 Handle ;
12+
13+ static inline int
14+ soc_get_fd (int fd )
15+ {
16+ __handle * handle = __get_handle (fd );
17+ if (handle == NULL )
18+ return - ENODEV ;
19+ if (strcmp (devoptab_list [handle -> device ]-> name , "soc" ) != 0 )
20+ return - ENOTSOCK ;
21+ return * (Handle * )handle -> fileStruct ;
22+ }
23+
24+ s32 _net_convert_error (s32 sock_retval );
You can’t perform that action at this time.
0 commit comments