1 #include <unistd.h> 2 #include <sys/socket.h> 3 #include <sys/linux-syscalls.h> 4 5 /* From ndk/platforms/android-3/include/sys/socket.h */ 6 #define SOCK_STREAM_PORTABLE 1 7 #define SOCK_DGRAM_PORTABLE 2 8 #define SOCK_RAW_PORTABLE 3 9 #define SOCK_RDM_PORTABLE 4 10 #define SOCK_SEQPACKET_PORTABLE 5 11 #define SOCK_PACKET_PORTABLE 10 12 13 #if SOCK_STREAM==SOCK_STREAM_PORTABLE 14 #error Bad build environment 15 #endif 16 17 static inline int mips_change_type(int type) 18 { 19 switch (type) { 20 case SOCK_STREAM_PORTABLE: return SOCK_STREAM; 21 case SOCK_DGRAM_PORTABLE: return SOCK_DGRAM; 22 case SOCK_RAW_PORTABLE: return SOCK_RAW; 23 case SOCK_RDM_PORTABLE: return SOCK_RDM; 24 case SOCK_SEQPACKET_PORTABLE: return SOCK_SEQPACKET; 25 case SOCK_PACKET_PORTABLE: return SOCK_PACKET; 26 } 27 return type; 28 } 29 30 extern int socket(int, int, int); 31 32 int socket_portable(int domain, int type, int protocol) { 33 return socket(domain, mips_change_type(type), protocol); 34 } 35