[kaffe] CVS kaffe (robilad): Fixed TARGET_*SEEK* calls to use thread safe wrappers

Kaffe CVS cvs-commits at kaffe.org
Wed Aug 3 19:04:30 PDT 2005


PatchSet 6781 
Date: 2005/08/04 01:59:55
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Fixed TARGET_*SEEK* calls to use thread safe wrappers

2005-08-04  Dalibor Topic  <robilad at kaffe.org>

* libraries/clib/target/Linux/target_native_file.h
(TARGET_NATIVE_FILE_SEEK_END, TARGET_NATIVE_FILE_SEEK_CURRENT,
TARGET_NATIVE_FILE_SEEK_BEGIN): New macros used to delegate
system calls to thread-safe wrappers for system calls.

Members: 
	ChangeLog:1.4306->1.4307 
	libraries/clib/target/Linux/target_native_file.h:1.2->1.3 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4306 kaffe/ChangeLog:1.4307
--- kaffe/ChangeLog:1.4306	Thu Aug  4 00:57:40 2005
+++ kaffe/ChangeLog	Thu Aug  4 01:59:55 2005
@@ -1,3 +1,10 @@
+2005-08-04  Dalibor Topic  <robilad at kaffe.org>
+
+	* libraries/clib/target/Linux/target_native_file.h 
+	(TARGET_NATIVE_FILE_SEEK_END, TARGET_NATIVE_FILE_SEEK_CURRENT,
+	TARGET_NATIVE_FILE_SEEK_BEGIN): New macros used to delegate
+	system calls to thread-safe wrappers for system calls.
+
 2005-08-03 Dalibor Topic  <robilad at kaffe.org>
 
 	* configure.ac: Check for fstat.
Index: kaffe/libraries/clib/target/Linux/target_native_file.h
diff -u kaffe/libraries/clib/target/Linux/target_native_file.h:1.2 kaffe/libraries/clib/target/Linux/target_native_file.h:1.3
--- kaffe/libraries/clib/target/Linux/target_native_file.h:1.2	Tue Aug  2 09:52:14 2005
+++ kaffe/libraries/clib/target/Linux/target_native_file.h	Thu Aug  4 01:59:56 2005
@@ -240,6 +240,49 @@
     } while (0)
 #endif
 
+/***********************************************************************\
+* Name       : TARGET_NATIVE_FILE_SEEK_BEGIN|CURRENT|END
+* Purpose    : set file position relativ to begin/current/end
+* Input      : -
+* Output     : -
+* Return     : -
+* Side-effect: unknown
+* Notes      : -
+\***********************************************************************/
+
+#ifndef TARGET_NATIVE_FILE_SEEK_BEGIN
+  #include <sys/types.h>
+  #include <unistd.h>
+  #define TARGET_NATIVE_FILE_SEEK_BEGIN(filedescriptor,offset,newoffset,result) \
+    do { \
+      int klseek_result; \
+      klseek_result=KLSEEK(filedescriptor,offset,SEEK_SET, &newoffset);			\
+      result=(klseek_result==0)?TARGET_NATIVE_OK:TARGET_NATIVE_ERROR; \
+    } while (0)
+#endif
+#ifndef TARGET_NATIVE_FILE_SEEK_CURRENT
+  #include <sys/types.h>
+  #include <unistd.h>
+  #define TARGET_NATIVE_FILE_SEEK_CURRENT(filedescriptor,offset,newoffset,result) \
+    do { \
+      int klseek_result; \
+      klseek_result=KLSEEK(filedescriptor,offset,SEEK_CUR, &newoffset);	      \
+      result=(klseek_result==0)?TARGET_NATIVE_OK:TARGET_NATIVE_ERROR; \
+    } while (0)
+#endif
+#ifndef TARGET_NATIVE_FILE_SEEK_END
+  #include <sys/types.h>
+  #include <unistd.h>
+  #define TARGET_NATIVE_FILE_SEEK_END(filedescriptor,offset,newoffset,result) \
+    do { \
+      int klseek_result; \
+      klseek_result=KLSEEK(filedescriptor,offset,SEEK_END, &newoffset);		\
+      result=(klseek_result==0)?TARGET_NATIVE_OK:TARGET_NATIVE_ERROR; \
+    } while (0)
+#endif
+
+/* TODO: WRITE, READ, TRUNCATE, FSYNC */
+
 /* include rest of definitions from generic file (do not move it to 
    another position!) */
 #include "target_generic_file.h"




More information about the kaffe mailing list