[kaffe] CVS kaffe (robilad): Fixed TARGET_*SEEK* calls to use thread safe wrappers
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 <[EMAIL PROTECTED]> * 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 <[EMAIL PROTECTED]> + + * 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 <[EMAIL PROTECTED]> * 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 + #include + #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 + #include + #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 + #include + #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" ___ kaffe mailing list kaffe@kaffe.org http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
Re: [kaffe] VxWorks / Transvirtual
Andreas Fenkart wrote: Hi list I'm looking for a jvm for VxWorks. Somehow the kaffe configure script bombs, probably due VxWorks binaries not being runnable Yes I seen that thread on the list. Hallo Andreas, could you post the error message from the configure script? I'd expect it to bomb, since the vxworks port has not been merged back into the main tree. You can grab the sources for x86-vxworks at http://www.kaffe.org/cgi-bin/viewcvs.cgi/pocketlinux/XOE_1.0/src/kaffe-all/src/config/i386/vxworks/ or http://www.kaffe.org/cgi-bin/viewcvs.cgi/pocketlinux/XOE_1.0/src/kaffe-all/src/config/mips/vxworks/ the two ports to vxworks available in the pocketlinux fork of kaffe. Note that the code there may need to be tweaked to current interfaces (in Kaffe and/or VxWorks), since it is a few years old, and pretty close to the system. But I guess with a bit of work you should be able to get it to work with 1.0.7 or 1.1.5. Depending on what your application needs, 1.0.7 may be easier for 1.1-style apps, while 1.1.5 would be better for 1.4-APIs utilising apps. I heard there is a commercial product from transvirtual, because I'm spoilt and like to be spoon fed, this seems a good option to me. The problem is that I was not able to find the homepage from transvirtual.. can someone give hint. Transvirtual has ceased to exist in mid 2002. cheers, dalibor topic ___ kaffe mailing list kaffe@kaffe.org http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
[kaffe] CVS kaffe (robilad): Added check for fstat
PatchSet 6780 Date: 2005/08/04 00:57:40 Author: robilad Branch: HEAD Tag: (none) Log: Added check for fstat 2005-08-03 Dalibor Topic <[EMAIL PROTECTED]> * configure.ac: Check for fstat. Reported by: Ito Kazumitsu <[EMAIL PROTECTED]> Members: ChangeLog:1.4305->1.4306 configure:1.474->1.475 configure.ac:1.157->1.158 config/config.h.in:1.148->1.149 Index: kaffe/ChangeLog diff -u kaffe/ChangeLog:1.4305 kaffe/ChangeLog:1.4306 --- kaffe/ChangeLog:1.4305 Wed Aug 3 23:09:14 2005 +++ kaffe/ChangeLog Thu Aug 4 00:57:40 2005 @@ -1,5 +1,11 @@ 2005-08-03 Dalibor Topic <[EMAIL PROTECTED]> + * configure.ac: Check for fstat. + + Reported by: Ito Kazumitsu <[EMAIL PROTECTED]> + +2005-08-03 Dalibor Topic <[EMAIL PROTECTED]> + * test/regression/BufferedInputStreamAvailableTest.java: Use file TestScript for testing input, as it exists in both builddir and srcdir, so if these are different, the Index: kaffe/configure diff -u kaffe/configure:1.474 kaffe/configure:1.475 --- kaffe/configure:1.474 Sat Jul 30 16:39:00 2005 +++ kaffe/configure Thu Aug 4 00:57:41 2005 @@ -37934,7 +37934,8 @@ -for ac_func in select socket getsockname getpagesize + +for ac_func in select socket getsockname getpagesize fstat do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 Index: kaffe/configure.ac diff -u kaffe/configure.ac:1.157 kaffe/configure.ac:1.158 --- kaffe/configure.ac:1.157Sat Jul 30 16:39:06 2005 +++ kaffe/configure.ac Thu Aug 4 00:57:46 2005 @@ -1330,7 +1330,7 @@ AC_FUNC_MMAP AC_FUNC_UTIME_NULL -AC_CHECK_FUNCS([select socket getsockname getpagesize]) +AC_CHECK_FUNCS([select socket getsockname getpagesize fstat]) AC_CHECK_FUNCS([memcpy memmove]) AC_CHECK_FUNCS([mkdir rmdir]) AC_CHECK_FUNCS([getcwd chdir getwd gettimeofday ftime time uname getuid]) Index: kaffe/config/config.h.in diff -u kaffe/config/config.h.in:1.148 kaffe/config/config.h.in:1.149 --- kaffe/config/config.h.in:1.148 Sat Jul 30 16:39:06 2005 +++ kaffe/config/config.h.inThu Aug 4 00:57:49 2005 @@ -135,6 +135,9 @@ /* Define to 1 if you have the `fork' function. */ #undef HAVE_FORK +/* Define to 1 if you have the `fstat' function. */ +#undef HAVE_FSTAT + /* Define to 1 if you have the `fsync' function. */ #undef HAVE_FSYNC ___ kaffe mailing list kaffe@kaffe.org http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
Re: [kaffe] CVS kaffe (kaz): test/regression/BufferedInputStreamAvailableTest.java:
Ito Kazumitsu wrote: 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. Thanks, Ito. I think the problems were caused by my merge of native portion of FileChannelImpl from GNU Classpath, in particular by the TARGET_* layer not being adapated to utilize Kaffe's K* thread-safe native wrapper functions. I've in the mean time fixed some of the issues, and am atm working on fixing the others. I am sorry for the inconvenience, I did not realize the extent of problems this change would cause. ;( I've removed the ioctl based implementation of avail in the target layer since Kaffe does not have a thread safe ioctl wrapper, and I did not want to introduce one without need. But this test failed on Linux 2.6.7-co-0.6.2 because available() returned 1. So I changed the test criterion. Thanks! By the way, isn't it a problem that available() returns 1 when a several hundred byte file is being read? The current implementation should be able to return the full file size for normal files when fstat is used. Unfortunately, I had forgotten to add a check for fstat to configure.ac, which caused that code to be ignored, and instead the select implementation of available to be used. The select implementation can only detect whether something is available for reading or not, so therefore the 0 or 1 answers for available length. I have added the missing test to configure.ac, and checked it in. Thank you very much for reporting and tracking down the bug, Ito! cheers, dalibor topic ___ kaffe mailing list kaffe@kaffe.org http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
[kaffe] CVS kaffe (robilad): Fixed small bug in BufferedInputStreamAvailable test
PatchSet 6779 Date: 2005/08/03 23:09:14 Author: robilad Branch: HEAD Tag: (none) Log: Fixed small bug in BufferedInputStreamAvailable test 2005-08-03 Dalibor Topic <[EMAIL PROTECTED]> * test/regression/BufferedInputStreamAvailableTest.java: Use file TestScript for testing input, as it exists in both builddir and srcdir, so if these are different, the test still passes. Members: ChangeLog:1.4304->1.4305 test/regression/BufferedInputStreamAvailableTest.java:1.2->1.3 Index: kaffe/ChangeLog diff -u kaffe/ChangeLog:1.4304 kaffe/ChangeLog:1.4305 --- kaffe/ChangeLog:1.4304 Wed Aug 3 15:01:39 2005 +++ kaffe/ChangeLog Wed Aug 3 23:09:14 2005 @@ -1,3 +1,10 @@ +2005-08-03 Dalibor Topic <[EMAIL PROTECTED]> + + * test/regression/BufferedInputStreamAvailableTest.java: + Use file TestScript for testing input, as it exists in + both builddir and srcdir, so if these are different, the + test still passes. + 2005-08-03 Guilhem Lavaux <[EMAIL PROTECTED]> * config/powerpc/trampolines.S: Changed commentary type for Index: kaffe/test/regression/BufferedInputStreamAvailableTest.java diff -u kaffe/test/regression/BufferedInputStreamAvailableTest.java:1.2 kaffe/test/regression/BufferedInputStreamAvailableTest.java:1.3 --- kaffe/test/regression/BufferedInputStreamAvailableTest.java:1.2 Tue Aug 2 16:23:10 2005 +++ kaffe/test/regression/BufferedInputStreamAvailableTest.java Wed Aug 3 23:09:18 2005 @@ -3,7 +3,7 @@ public class BufferedInputStreamAvailableTest { public static void main(String av[]) throws Exception { - File file = new File("BufferedInputStreamAvailableTest.java"); + File file = new File("TestScript"); long flen = file.length(); BufferedInputStream is = new BufferedInputStream( new FileInputStream(file), (int)flen); ___ kaffe mailing list kaffe@kaffe.org http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
Re: [kaffe] Apache Jakarta Commons Net does not work on Linux
Hi Guilhem, Thank you for looking into my problem. From: Guilhem Lavaux <[EMAIL PROTECTED]> Subject: Re: [kaffe] Apache Jakarta Commons Net does not work on Linux Date: Wed, 03 Aug 2005 19:10:21 +0200 > Btw, I haven't got the assert error you mentioned. It should be a > problem in the libc itself as I am not tweaking the mutexes but on the > contrary raising protections around them. (What is Linux > 2.6.7-co-0.6.2 ?) I haven't got the assert error, either, on another Linux machine. Cooperative Linux (short-named coLinux) is a Linux which runs on Microsoft Windows (http://www.colinux.org/). Being a FreeBSD user not skilled in Linux, I bought a package of coLinux and installed it on a Windows XP machine, which serves as an X terminal of my FreeBSD machine. ___ kaffe mailing list kaffe@kaffe.org http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
Re: [kaffe] Apache Jakarta Commons Net does not work on Linux
Hi Ito, Two things: * Commons-Net is flawed. * Kaffe is flawed. :) First kaffe: I know that from the transvirtual times we have inherited a synchronized access to native socket operations. That way we are sure two threads are not accessing the same socket at the same time. However it is not compatible with what is done by commons-net (and I think the JDK) Second commons-net: It should not access the same socket with two threads. Looking at the code, the reader thread hangs in read() and then can call write() from another thread. I am not sure it is really allowed from the OS point of view and generally I would not advise it. So now, what to do ? I will check whether the IO operations are reentrant and then will move the mutexes. Btw, I haven't got the assert error you mentioned. It should be a problem in the libc itself as I am not tweaking the mutexes but on the contrary raising protections around them. (What is Linux 2.6.7-co-0.6.2 ?) Regards, Guilhem. On Wed, 2005-08-03 at 23:46 +0900, Ito Kazumitsu wrote: > From: Ito Kazumitsu <[EMAIL PROTECTED]> > Subject: [kaffe] Apache Jakarta Commons Net does not work on Linux > Date: Tue, 02 Aug 2005 00:10:49 +0900 (JST) > > > I have found that apache Jakarta Commons Net does not work > > with current Kaffe on Linux. > > I slightly changed the test program to find the following. > > (1) Telnet client including FTP client of Apache Commons Net > performs its socket input operation in a different thread > called reader thread. > > (2) When run on Kaffe on Linux, there seems to occur a deadlock > between the reader thread and the current thread. The writing > operation of the current thread cannot be finished until some > state of the reader thread changes. But the reading thread is > waiting for a response from the server, which will never come > until the writing operation of the current thread is finished. > > (3) Such deadlock does not occur when run on Sun's JDK > or on Kaffe on FreeBSD. > > (4) By setting some socket timeout value, the deadlock of (2) > can be releasd. But such timeout means the death of the reading > thread and this cannot be a solusion of the problem. > > And on Linux 2.6.7-co-0.6.2, setting a timeout causes another > error like > > $ java TestCommonsNet somehost foo bar 5000 true > 220 > kaffe-bin: pthread_mutex_lock.c:78: __pthread_mutex_lock: Assertion > `mutex->__data.__owner == 0' failed. > Aborted > > (5) Telnet client including FTP client of Apache Commons Net has > an option of disabling the use of reader thread. This helps > to avoid the deadlock of (2). > > Application system users can be satisfied with (5), but the problem > (2) seen only on Kaffe on Linux indicates some bugs in Kaffe. > > My test program follows. > > import org.apache.commons.net.ftp.*; > > public class TestCommonsNet { > public static void main(String[] args) throws Exception { > String hostName = args[0]; > int port = 21; > String userName = args[1]; > String password = args[2]; > int timeout = Integer.parseInt(args[3]); > boolean readerThread = (args[4].equals("true")); > > FTPClient _ftpClient = new FTPClient(); > _ftpClient.setDefaultTimeout(timeout); > _ftpClient.setReaderThread(readerThread); > _ftpClient.connect(hostName, port); > System.err.println(_ftpClient.getReplyCode()); > _ftpClient.login(userName, password); > System.err.flush(); > System.err.println(_ftpClient.getReplyCode()); > _ftpClient.logout(); > System.err.println(_ftpClient.getReplyCode()); > > } > } > > ___ > kaffe mailing list > kaffe@kaffe.org > http://kaffe.org/cgi-bin/mailman/listinfo/kaffe ___ kaffe mailing list kaffe@kaffe.org http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
[kaffe] CVS kaffe (guilhem): config/powerpc/trampolines.S: Changed commentary type for
PatchSet 6778 Date: 2005/08/03 15:01:39 Author: guilhem Branch: HEAD Tag: (none) Log: 2005-08-03 Guilhem Lavaux <[EMAIL PROTECTED]> * config/powerpc/trampolines.S: Changed commentary type for gcc. Reported by: Riccardo Mottola <[EMAIL PROTECTED]>. Members: ChangeLog:1.4303->1.4304 config/powerpc/trampolines.S:1.5->1.6 Index: kaffe/ChangeLog diff -u kaffe/ChangeLog:1.4303 kaffe/ChangeLog:1.4304 --- kaffe/ChangeLog:1.4303 Tue Aug 2 16:23:07 2005 +++ kaffe/ChangeLog Wed Aug 3 15:01:39 2005 @@ -1,3 +1,10 @@ +2005-08-03 Guilhem Lavaux <[EMAIL PROTECTED]> + + * config/powerpc/trampolines.S: Changed commentary type for + gcc. + + Reported by: Riccardo Mottola <[EMAIL PROTECTED]>. + 2005-08-02 Ito Kazumitsu <[EMAIL PROTECTED]> * test/regression/BufferedInputStreamAvailableTest.java: Index: kaffe/config/powerpc/trampolines.S diff -u kaffe/config/powerpc/trampolines.S:1.5 kaffe/config/powerpc/trampolines.S:1.6 --- kaffe/config/powerpc/trampolines.S:1.5 Sun Jul 17 15:32:18 2005 +++ kaffe/config/powerpc/trampolines.S Wed Aug 3 15:01:54 2005 @@ -29,10 +29,11 @@ C_FUNC_NAME(powerpc_do_fixup_trampoline) : -# Function prologue: establish a minimum stack frame. We don't -# save lr - it was already saved at 8(r1) by the trampoline -# code. However, we must save r3 and r4, as we will use them -# to call soft_fixup_trampoline(). +/* Function prologue: establish a minimum stack frame. We don't + * save lr - it was already saved at 8(r1) by the trampoline + * code. However, we must save r3 and r4, as we will use them + * to call soft_fixup_trampoline(). + */ stw r3, -4(r1) stw r4, -8(r1) stw r5, -12(r1) ___ kaffe mailing list kaffe@kaffe.org http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
Re: [kaffe] Apache Jakarta Commons Net does not work on Linux
From: Ito Kazumitsu <[EMAIL PROTECTED]> Subject: [kaffe] Apache Jakarta Commons Net does not work on Linux Date: Tue, 02 Aug 2005 00:10:49 +0900 (JST) > I have found that apache Jakarta Commons Net does not work > with current Kaffe on Linux. I slightly changed the test program to find the following. (1) Telnet client including FTP client of Apache Commons Net performs its socket input operation in a different thread called reader thread. (2) When run on Kaffe on Linux, there seems to occur a deadlock between the reader thread and the current thread. The writing operation of the current thread cannot be finished until some state of the reader thread changes. But the reading thread is waiting for a response from the server, which will never come until the writing operation of the current thread is finished. (3) Such deadlock does not occur when run on Sun's JDK or on Kaffe on FreeBSD. (4) By setting some socket timeout value, the deadlock of (2) can be releasd. But such timeout means the death of the reading thread and this cannot be a solusion of the problem. And on Linux 2.6.7-co-0.6.2, setting a timeout causes another error like $ java TestCommonsNet somehost foo bar 5000 true 220 kaffe-bin: pthread_mutex_lock.c:78: __pthread_mutex_lock: Assertion `mutex->__data.__owner == 0' failed. Aborted (5) Telnet client including FTP client of Apache Commons Net has an option of disabling the use of reader thread. This helps to avoid the deadlock of (2). Application system users can be satisfied with (5), but the problem (2) seen only on Kaffe on Linux indicates some bugs in Kaffe. My test program follows. import org.apache.commons.net.ftp.*; public class TestCommonsNet { public static void main(String[] args) throws Exception { String hostName = args[0]; int port = 21; String userName = args[1]; String password = args[2]; int timeout = Integer.parseInt(args[3]); boolean readerThread = (args[4].equals("true")); FTPClient _ftpClient = new FTPClient(); _ftpClient.setDefaultTimeout(timeout); _ftpClient.setReaderThread(readerThread); _ftpClient.connect(hostName, port); System.err.println(_ftpClient.getReplyCode()); _ftpClient.login(userName, password); System.err.flush(); System.err.println(_ftpClient.getReplyCode()); _ftpClient.logout(); System.err.println(_ftpClient.getReplyCode()); } } ___ kaffe mailing list kaffe@kaffe.org http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
[kaffe] VxWorks / Transvirtual
Hi list I'm looking for a jvm for VxWorks. Somehow the kaffe configure script bombs, probably due VxWorks binaries not being runnable Yes I seen that thread on the list. I heard there is a commercial product from transvirtual, because I'm spoilt and like to be spoon fed, this seems a good option to me. The problem is that I was not able to find the homepage from transvirtual.. can someone give hint. Bye Andreas -- Andreas Fenkart, Nexus Telecom AG Software Engineer Muertschenstrasse 27, CH-8048 Zuerich Fon: +41 76 355 66 54 e-mail: [EMAIL PROTECTED] ___ kaffe mailing list kaffe@kaffe.org http://kaffe.org/cgi-bin/mailman/listinfo/kaffe