[kaffe] CVS kaffe (robilad): Implemented thread safe wrappers for some target system calls

2005-08-02 Thread Kaffe CVS
PatchSet 6776 
Date: 2005/08/02 09:52:11
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Implemented thread safe wrappers for some target system calls

2005-08-02 Dalibor Topic  [EMAIL PROTECTED]

* include/jsyscall.h:
(KOPEN, KLSEEK, KCLOSE, KFSTAT) Documented.

* libraries/clib/target/Linux/target_native_file.h
(TARGET_NATIVE_FILE_OPEN, TARGET_NATIVE_FILE_CLOSE,
TARGET_NATIVE_FILE_AVAILABLE, TARGET_NATIVE_FILE_SIZE,
TARGET_NATIVE_FILE_TELL): New macros used to delegate
system calls to thread-safe wrappers for system calls.

Reported by:  Guilhem Lavaux [EMAIL PROTECTED]

Members: 
ChangeLog:1.4301-1.4302 
include/jsyscall.h:1.21-1.22 
libraries/clib/target/Linux/target_native_file.h:1.1-1.2 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4301 kaffe/ChangeLog:1.4302
--- kaffe/ChangeLog:1.4301  Mon Aug  1 20:53:36 2005
+++ kaffe/ChangeLog Tue Aug  2 09:52:11 2005
@@ -1,3 +1,16 @@
+2005-08-02 Dalibor Topic  [EMAIL PROTECTED]
+
+   * include/jsyscall.h:
+   (KOPEN, KLSEEK, KCLOSE, KFSTAT) Documented.
+
+   * libraries/clib/target/Linux/target_native_file.h
+   (TARGET_NATIVE_FILE_OPEN, TARGET_NATIVE_FILE_CLOSE,
+   TARGET_NATIVE_FILE_AVAILABLE, TARGET_NATIVE_FILE_SIZE,
+   TARGET_NATIVE_FILE_TELL): New macros used to delegate
+   system calls to thread-safe wrappers for system calls.
+
+   Reported by:  Guilhem Lavaux [EMAIL PROTECTED]
+
 2005-08-01  Guilhem Lavaux [EMAIL PROTECTED]
 
* test/jni/Makefile.am: Fixed typo.
@@ -32,7 +45,7 @@
 
* test/regression/Makefile.in: regenerated.
 
-2005-07-26 Dalibor Topic  [EMAIL PROTECTED]
+2005-07-30 Dalibor Topic  [EMAIL PROTECTED]
 
Resynced with GNU Classpath.
 
Index: kaffe/include/jsyscall.h
diff -u kaffe/include/jsyscall.h:1.21 kaffe/include/jsyscall.h:1.22
--- kaffe/include/jsyscall.h:1.21   Tue May 31 17:55:49 2005
+++ kaffe/include/jsyscall.hTue Aug  2 09:52:14 2005
@@ -108,12 +108,56 @@
  * Define some convenience macros
  */
 
-#defineKOPEN(A,B,C,D)  (*Kaffe_SystemCallInterface._open)(A,B,C,D)
+/**
+ * Open a file in a platform-independant, thread-safe way, and
+ * set the filedescriptor to the opened file's descriptor.
+ *
+ * @param filename name of file to open.
+ * @param flags flags to pass to open
+ * @param permissions permissions with which the file is to be opened
+ * @param filedescriptor pointer to the filedescriptor to store the result in
+ * 
+ * @return 0 on success, or errno on failure.
+ */
+#defineKOPEN(filename, flags, permissions, filedescriptor) \
+  (*Kaffe_SystemCallInterface._open)(filename, flags, permissions, 
filedescriptor)
+
 #defineKREAD(A,B,C,D)  (*Kaffe_SystemCallInterface._read)(A,B,C,D)
 #defineKWRITE(A,B,C,D) (*Kaffe_SystemCallInterface._write)(A,B,C,D)
-#defineKLSEEK(A,B,C,D) (*Kaffe_SystemCallInterface._lseek)(A,B,C,D)
-#defineKCLOSE(A)   (*Kaffe_SystemCallInterface._close)(A)
-#defineKFSTAT(A,B) (*Kaffe_SystemCallInterface._fstat)(A,B)
+
+/**
+ * Reposition read/write offset in a file in a 
+ * platform-independant, thread-safe way.
+ *
+ * @param filedescriptor filedescriptor to stat
+ * @param offset offset to set
+ * @param whence how to set the offset
+ * @param new_offset new value of read/write offset
+ * 
+ * @return 0 on success, or errno on failure.
+ */
+#defineKLSEEK(filedescriptor, offset, whence, new_offset) \
+  (*Kaffe_SystemCallInterface._lseek)(filedescriptor, offset, whence, 
new_offset)
+
+/**
+ * Close a file in a platform-independant, thread-safe way.
+ *
+ * @param filedescriptor filedescriptor to close
+ * 
+ * @return 0 on success, or errno on failure.
+ */
+#defineKCLOSE(filedescriptor)  \
+  (*Kaffe_SystemCallInterface._close)(filedescriptor)
+
+/**
+ * FStat a file in a platform-independant, thread-safe way.
+ *
+ * @param filedescriptor filedescriptor to stat
+ * @param stats return buffer
+ * 
+ * @return 0 on success, or errno on failure.
+ */
+#defineKFSTAT(filedescriptor, stats)   
(*Kaffe_SystemCallInterface._fstat)(filedescriptor, stats)
 #defineKSTAT(A,B)  (*Kaffe_SystemCallInterface._stat)(A,B)
 #define KFTRUNCATE(A,B) (*Kaffe_SystemCallInterface._ftruncate)(A,B)
 #define KFSYNC(A)   (*Kaffe_SystemCallInterface._fsync)(A)
Index: kaffe/libraries/clib/target/Linux/target_native_file.h
diff -u kaffe/libraries/clib/target/Linux/target_native_file.h:1.1 
kaffe/libraries/clib/target/Linux/target_native_file.h:1.2
--- kaffe/libraries/clib/target/Linux/target_native_file.h:1.1  Tue Jul 19 
01:16:37 2005
+++ kaffe/libraries/clib/target/Linux/target_native_file.h  Tue Aug  2 
09:52:14 2005
@@ -49,6 +49,8 @@
 
 #include stdlib.h
 
+#include jsyscall.h
+
 /** Conditional compilation switches ***/
 
 /* Constants ***/
@@ -67,6 +69,175 @@
 
 

[kaffe] CVS kaffe (kaz): test/regression/BufferedInputStreamAvailableTest.java:

2005-08-02 Thread Kaffe CVS
PatchSet 6777 
Date: 2005/08/02 16:23:07
Author: kaz
Branch: HEAD
Tag: (none) 
Log:
2005-08-02 Ito Kazumitsu  [EMAIL PROTECTED]

* test/regression/BufferedInputStreamAvailableTest.java:
Weakened the criterion.

Members: 
ChangeLog:1.4302-1.4303 
test/regression/BufferedInputStreamAvailableTest.java:1.1-1.2 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4302 kaffe/ChangeLog:1.4303
--- kaffe/ChangeLog:1.4302  Tue Aug  2 09:52:11 2005
+++ kaffe/ChangeLog Tue Aug  2 16:23:07 2005
@@ -1,3 +1,8 @@
+2005-08-02 Ito Kazumitsu  [EMAIL PROTECTED]
+
+   * test/regression/BufferedInputStreamAvailableTest.java:
+   Weakened the criterion.
+
 2005-08-02 Dalibor Topic  [EMAIL PROTECTED]
 
* include/jsyscall.h:
Index: kaffe/test/regression/BufferedInputStreamAvailableTest.java
diff -u kaffe/test/regression/BufferedInputStreamAvailableTest.java:1.1 
kaffe/test/regression/BufferedInputStreamAvailableTest.java:1.2
--- kaffe/test/regression/BufferedInputStreamAvailableTest.java:1.1 Sun Jul 
31 10:44:46 2005
+++ kaffe/test/regression/BufferedInputStreamAvailableTest.java Tue Aug  2 
16:23:10 2005
@@ -8,7 +8,9 @@
BufferedInputStream is = new BufferedInputStream(
  new FileInputStream(file), (int)flen);
int alen = is.available();
-   System.out.println((int)flen == alen);
+   // System.out.println((int)flen == alen);
+   // We are happy if (int)flen == alen, but that is not necessarily true.
+   System.out.println(alen = 0);
 }
 }
 

___
kaffe mailing list
kaffe@kaffe.org
http://kaffe.org/cgi-bin/mailman/listinfo/kaffe


Re: [kaffe] CVS kaffe (kaz): test/regression/BufferedInputStreamAvailableTest.java:

2005-08-02 Thread Ito Kazumitsu
From: Kaffe CVS [EMAIL PROTECTED]
Subject: [kaffe] CVS kaffe (kaz): 
test/regression/BufferedInputStreamAvailableTest.java:
Date: Tue, 02 Aug 2005 09:29:24 -0700

   BufferedInputStream is = new BufferedInputStream(
 new FileInputStream(file), (int)flen);
   int alen = is.available();
 - System.out.println((int)flen == alen);
 + // System.out.println((int)flen == alen);
 + // We are happy if (int)flen == alen, but that is not necessarily true.
 + System.out.println(alen = 0);

I added this test in order to know whether the problem about
FreeBSD's ioctl (http://www.kaffe.org/pipermail/kaffe/2005-July/103009.html)
has been solved.

But this test failed on Linux 2.6.7-co-0.6.2 because available()
returned 1. So I changed the test criterion.

By the way, isn't it a problem that available() returns 1 when
a several hundred byte file is being read?

___
kaffe mailing list
kaffe@kaffe.org
http://kaffe.org/cgi-bin/mailman/listinfo/kaffe