* src/vm/os.hpp (os::send): New function.
authorChristian Thalinger <twisti@complang.tuwien.ac.at>
Tue, 21 Oct 2008 09:42:00 +0000 (11:42 +0200)
committerChristian Thalinger <twisti@complang.tuwien.ac.at>
Tue, 21 Oct 2008 09:42:00 +0000 (11:42 +0200)
* src/native/vm/openjdk/jvm.cpp (JVM_Send): Implemented.

src/native/vm/openjdk/jvm.cpp
src/vm/os.hpp

index 1bbdd3ea40c39472427f9ac537ecbfba18d06d51..9b393d3bf53ab69f17260117462762223109a0e9 100644 (file)
@@ -2717,9 +2717,13 @@ jint JVM_Recv(jint fd, char *buf, jint nBytes, jint flags)
 
 jint JVM_Send(jint fd, char *buf, jint nBytes, jint flags)
 {
-       log_println("JVM_Send: IMPLEMENT ME!");
+       TRACEJVMCALLSENTER(("JVM_Send(fd=%d, buf=%p, nBytes=%d, flags=%d", fd, buf, nBytes, flags));
 
-       return 0;
+       int result = os::send(fd, buf, nBytes, flags);
+
+       TRACEJVMCALLSEXIT(("->%d", result));
+
+       return result;
 }
 
 
index 66de93d5155630e879a91ecd66cb3e81a2b945bb..052c0a370da758378dfb04365d88079499e86bb3 100644 (file)
@@ -145,6 +145,7 @@ public:
        static inline int     mprotect(void* addr, size_t len, int prot);
        static inline ssize_t readlink(const char* path, char* buf, size_t bufsiz);
        static inline int     scandir(const char* dir, struct dirent*** namelist, int(*filter)(const struct dirent*), int(*compar)(const void*, const void*));
+       static inline ssize_t send(int s, const void* buf, size_t len, int flags);
        static inline int     setsockopt(int s, int level, int optname, const void* optval, socklen_t optlen);
        static inline int     shutdown(int s, int how);
        static inline int     socket(int domain, int type, int protocol);
@@ -527,6 +528,16 @@ inline int os::scandir(const char *dir, struct dirent ***namelist, int(*filter)(
 #endif
 }
 
+inline ssize_t os::send(int s, const void* buf, size_t len, int flags)
+{
+       // TODO Should be restartable on Linux and interruptible on Solaris.
+#if defined(HAVE_SEND)
+       return ::send(s, buf, len, flags);
+#else
+# error send not available
+#endif
+}
+
 inline int os::setsockopt(int s, int level, int optname, const void* optval, socklen_t optlen)
 {
 #if defined(HAVE_SETSOCKOPT)