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 @@