OSDN Git Service

Bug 15093
[pf3gnuchains/gcc-fork.git] / libjava / include / posix.h
index ad93753..c8cd5e2 100644 (file)
@@ -48,6 +48,19 @@ details.  */
 #define _Jv_platform_solib_suffix ".so"
 #endif
 
+// Some POSIX systems don't have O_SYNC and O_DYSNC so we define them here.
+// Needed in java/io/natFileDescriptorPosix.cc.
+#if !defined (O_SYNC) && defined (O_FSYNC)
+#define O_SYNC O_FSYNC
+#endif
+#if !defined (O_DSYNC) && defined (O_FSYNC)
+#define O_DSYNC O_FSYNC
+#endif
+// If O_DSYNC is still not defined, use O_SYNC (needed for newlib)
+#if !defined (O_DSYNC) 
+#define O_DSYNC O_SYNC
+#endif
+
 // Separator for file name components.
 #define _Jv_platform_file_separator ((jchar) '/')
 // Separator for path components.
@@ -79,6 +92,10 @@ _Jv_platform_close_on_exec (jint fd)
 #undef fcntl
 
 #ifdef JV_HASH_SYNCHRONIZATION
+#ifndef HAVE_USLEEP_DECL
+extern "C" int usleep (useconds_t useconds);
+#endif /* not HAVE_USLEEP_DECL */
+
 inline void
 _Jv_platform_usleep (unsigned long usecs)
 {
@@ -161,4 +178,11 @@ _Jv_read(int s, void *buf, int len)
 
 #endif /* DISABLE_JAVA_NET */
 
+// Wraps ::pipe
+static inline int
+_Jv_pipe (int filedes[2])
+{
+  return ::pipe (filedes);
+}
+
 #endif /* __JV_POSIX_H__ */