summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShih-wei Liao <sliao@google.com>2012-02-06 00:47:00 -0800
committerShih-wei Liao <sliao@google.com>2012-02-06 00:47:14 -0800
commite5cd7f4870e945467989aef4355506988ea46e1d (patch)
treea343c381cb0e52f68bad80554d432587dac6e8f7
parent12945f8c461564f1a3b0120fb75b763a78b5ef82 (diff)
downloadgdk-e5cd7f4870e945467989aef4355506988ea46e1d.tar.gz
Finish socket implementation
Change-Id: Ifa4c628656a81255478c1ce4d786e7209d45ffbb Author: Chris Dearman <chris@mips.com>
-rw-r--r--libportable/arch-mips/socket.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/libportable/arch-mips/socket.c b/libportable/arch-mips/socket.c
index fc0e4fd..aab73c8 100644
--- a/libportable/arch-mips/socket.c
+++ b/libportable/arch-mips/socket.c
@@ -2,8 +2,13 @@
#include <sys/socket.h>
#include <sys/linux-syscalls.h>
-#define SOCK_STREAM_PORTABLE 1
-#define SOCK_DGRAM_PORTABLE 2
+/* From ndk/platforms/android-3/include/sys/socket.h */
+#define SOCK_STREAM_PORTABLE 1
+#define SOCK_DGRAM_PORTABLE 2
+#define SOCK_RAW_PORTABLE 3
+#define SOCK_RDM_PORTABLE 4
+#define SOCK_SEQPACKET_PORTABLE 5
+#define SOCK_PACKET_PORTABLE 10
#if SOCK_STREAM==SOCK_STREAM_PORTABLE
#error Bad build environment
@@ -12,8 +17,12 @@
static inline int mips_change_type(int type)
{
switch (type) {
- case SOCK_DGRAM_PORTABLE: return SOCK_DGRAM;
case SOCK_STREAM_PORTABLE: return SOCK_STREAM;
+ case SOCK_DGRAM_PORTABLE: return SOCK_DGRAM;
+ case SOCK_RAW_PORTABLE: return SOCK_RAW;
+ case SOCK_RDM_PORTABLE: return SOCK_RDM;
+ case SOCK_SEQPACKET_PORTABLE: return SOCK_SEQPACKET;
+ case SOCK_PACKET_PORTABLE: return SOCK_PACKET;
}
return type;
}
@@ -21,5 +30,5 @@ static inline int mips_change_type(int type)
extern int socket(int, int, int);
int socket_portable(int domain, int type, int protocol) {
- return socket(domain,mips_change_type(type),protocol);
+ return socket(domain, mips_change_type(type), protocol);
}