Date: Sat, 01 Apr 2000 08:31:25 +0900 From: Fuyuhiko Maruyama <fuyuhik8@is.titech.ac.jp> To: glewis@trc.adelaide.edu.au Cc: freebsd-java@freebsd.org Subject: Re: Pre-alpha JDK 1.2.2 patches -- update Message-ID: <20000401083125X.fuyuhik8@is.titech.ac.jp> In-Reply-To: <200003300951.TAA24823@ares.maths.adelaide.edu.au> References: <200003300951.TAA24823@ares.maths.adelaide.edu.au>
next in thread | previous in thread | raw e-mail | index | archive | help
----Next_Part(Sat_Apr__1_08:31:18_2000_886)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi, Greg and all people loving FreeBSD and Java. I'm very happy with pre-alpha JDK 1.2.2 patches and try to write here some problems and informations. I hope it help porting efforts. *PROBLEMS* First, freebsd-jdk122-patches-[34] version of JDK cannot be used to bootstrap another builds because it doesn't include com/sun/tools/javah/resources/FreeBSD_i386.properties into tools.jar. It means javah doesn't work. To fix this problem: 1) Touch `src/share/classes/com/sun/tools/javah/resources/FreeBSD_i386.properties' to make empty file named `FreeBSD_i386.properties'. 2) Modify (patch is attached at this mail) `freebsd/com/sun/javah/GNUmakefile' to handle `FreeBSD_i386.properties' instead of Solaris's one. Second problem, freebsd-jdk122-patches-4 makes garbage: build/freebsd/makefiles/Rules.gmk.rej build/freebsd/makefiles/Rules.gmk.rej.orig src/freebsd/native/java/io/UnixFileSystem_md.c.rej src/freebsd/native/java/io/UnixFileSystem_md.c.rej.orig I think these are included in patch-file's self. *QUESTION* Why does FreeBSD version treat file access in complex way? Solaris have special system calls for accessing 64bit-sized filesystem and not all version have those calls. I think this is the reason why original codes are complex. But, all FreeBSD can access 64bit-sized filesystem with normal system calls, so I think there isn't any reason to inherit those complexities in FreeBSD's native version. Very simple patch to clean-up those codes are attached at this mail. *INFORMATION* I have tried to use two third party JIT compilers with FreeBSD's JDK1.2.2 and found those work! Here is the two JIT compilers: OpenJIT-1.1.10: http://www.openjit.org/ shujit-0.4.2: http://www.shudo.net/jit/ shujit-0.4.2 needs some modifications to fit FreeBSD's JDK1.2.2 but it had already done (I reported to Shudoh-san). I beleive Shudoh-san make new release to support our FreeBSD JDK1.2.2! Thanks. -- Fuyuhiko Maruyama Department of Math. and Comp. Science, Tokyo Institute of Technology. mailto:fuyuhik8@is.titech.ac.jp http://matsu-www.is.titech.ac.jp/%7emaruyama/index-e.html ----Next_Part(Sat_Apr__1_08:31:18_2000_886)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Description: fix javah problem Content-Disposition: attachment; filename="javah.diffs" --- solaris/com/sun/javah/GNUmakefile Tue Jun 29 19:06:25 1999 +++ freebsd/com/sun/javah/GNUmakefile Sat Apr 1 04:34:05 2000 @@ -27,7 +27,8 @@ # Resources. # RESOURCE_FILES = l10n.properties l10n_ja.properties \ - SunOS_sparc.properties SunOS_x86.properties + FreeBSD_i386.properties +# SunOS_sparc.properties SunOS_x86.properties RESOURCE_DEST_DIR = $(CLASSBINDIR)/com/sun/tools/javah/resources RESOURCE_SRC_DIR = $(SHARE_SRC)/classes/com/sun/tools/javah/resources include $(BUILDDIR)/makefiles/Resources.gmk ----Next_Part(Sat_Apr__1_08:31:18_2000_886)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Description: clean-up file accesses Content-Disposition: attachment; filename="file-access.diffs" --- src/solaris/hpi/src/system_md.c Tue Jun 29 19:22:04 1999 +++ src/freebsd/hpi/src/system_md.c Sat Apr 1 06:32:45 2000 @@ -40,6 +40,7 @@ #include "largefile.h" +#ifndef __FreeBSD__ #if !defined(_LFS_LARGEFILE) || !_LFS_LARGEFILE #ifdef __GLIBC__ @@ -56,8 +57,8 @@ * sys/stat.h and sys/types.h. */ -typedef u_longlong_t ino64_t; /* expanded inode type */ -typedef longlong_t blkcnt64_t; /* count of file blocks */ +typedef unsigned long long ino64_t; /* expanded inode type */ +typedef long long blkcnt64_t; /* count of file blocks */ struct stat64 { dev_t st_dev; @@ -70,11 +71,12 @@ dev_t st_rdev; long st_pad2[2]; off64_t st_size; - timestruc_t st_atim; - timestruc_t st_mtim; - timestruc_t st_ctim; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; long st_blksize; blkcnt64_t st_blocks; +#define _ST_FSTYPSZ 16 char st_fstype[_ST_FSTYPSZ]; long st_pad4[8]; }; @@ -82,7 +84,7 @@ #define O_LARGEFILE 0x2000 /* Solaris 2.6 sys/fcntl.h */ #endif /* !_LFS_LARGEFILE */ - +#endif int sysThreadBootstrap(sys_thread_t **tidP, sys_mon_t **lockP, int nb) { @@ -166,7 +168,7 @@ */ /* 64 bit versions of low-level File I/O routines */ - +#ifndef __FreeBSD__ typedef int (*FSTAT64)(int fd, struct stat64 *); typedef jlong (*LSEEK64)(int, jlong, int); typedef int (*FTRUNCATE64)(int, jlong); @@ -198,20 +200,26 @@ #pragma init(init64IO) #endif +#endif /* !defined(__FreeBSD__) */ + int sysFileSizeFD(int fd, jlong *size) { int ret; +#ifndef __FreeBSD__ if (fstat64_ptr != 0) { struct stat64 buf64; ret = (*fstat64_ptr)(fd, &buf64); *size = buf64.st_size; } else { +#endif struct stat buf; ret = fstat(fd, &buf); *size = buf.st_size; +#ifndef __FreeBSD__ } +#endif return ret; } @@ -219,16 +227,20 @@ sysFfileMode(int fd, int *mode) { int ret; - + +#ifndef __FreeBSD__ if (fstat64_ptr != 0) { struct stat64 buf64; ret = (*fstat64_ptr)(fd, &buf64); (*mode) = buf64.st_mode; } else { +#endif struct stat buf; ret = fstat(fd, &buf); (*mode) = buf.st_mode; +#ifndef __FreeBSD__ } +#endif return ret; } @@ -255,27 +267,33 @@ off64_t lseek64_w(int fd, off64_t offset, int whence) { +#ifndef __FreeBSD__ if (lseek64_ptr != 0) { return (*lseek64_ptr)(fd, offset, whence); } else { if ((off_t) offset != offset) { - errno = EOVERFLOW; + errno = EFBIG; return -1; } +#endif return lseek(fd, offset, whence); +#ifndef __FreeBSD__ } +#endif } int ftruncate64_w(int fd, off64_t length) { +#ifndef __FreeBSD__ if (ftruncate64_ptr != 0) { return (*ftruncate64_ptr)(fd, length); } if ((off_t)length != length) { - errno = EOVERFLOW; + errno = EFBIG; return -1; } +#endif return ftruncate(fd, length); } @@ -284,6 +302,7 @@ { int result; +#ifndef __FreeBSD__ if (open64_ptr != 0) { /* * Using O_LARGEFILE with _open is the same as _open64. @@ -293,8 +312,11 @@ */ result = open(path, oflag | O_LARGEFILE, mode); } else { +#endif result = open(path, oflag, mode); +#ifndef __FreeBSD__ } +#endif if (result != -1) { /* If the open succeeded, the file might still be a directory */ struct stat stat_buf; --- src/solaris/native/java/io/UnixFileSystem_md.c Tue Jun 29 19:22:31 1999 +++ src/freebsd/native/java/io/UnixFileSystem_md.c Sat Apr 1 06:29:12 2000 @@ -121,10 +121,10 @@ /* Large-file support */ - +#ifndef __FreeBSD__ #if !defined(_LFS_LARGEFILE) || !_LFS_LARGEFILE -#ifdef __GLIBC__ +#if defined(__GLIBC__) /* Doesn't matter what these are, there is no 64 bit support. */ typedef int u_longlong_t; typedef int longlong_t; @@ -176,6 +176,8 @@ #pragma init(init64IO) #endif +#endif /* !defined(__FreeBSD__) */ + JNIEXPORT jlong JNICALL Java_java_io_UnixFileSystem_getLength(JNIEnv *env, jobject this, jobject file) @@ -183,17 +185,21 @@ jlong rv = 0; WITH_FIELD_PLATFORM_STRING(env, file, ids.path, path) { +#ifndef __FreeBSD__ if (stat64_ptr) { struct stat64 sb; if (((*stat64_ptr)(path, &sb)) == 0) { rv = sb.st_size; } } else { +#endif struct stat sb; if (stat(path, &sb) == 0) { rv = sb.st_size; } +#ifndef __FreeBSD__ } +#endif } END_PLATFORM_STRING(env, path); return rv; } @@ -333,8 +339,10 @@ return rv; } +#ifndef __FreeBSD__ /* Can't find prototype on Solaris. */ extern int utimes(const char *, const struct timeval *); +#endif JNIEXPORT jboolean JNICALL Java_java_io_UnixFileSystem_setLastModifiedTime(JNIEnv *env, jobject this, @@ -349,8 +357,13 @@ if (stat(path, &sb) == 0) { /* Preserve access time */ +#ifdef __FreeBSD__ + tv[0].tv_sec = sb.st_atime; + tv[0].tv_usec = sb.st_atimespec.tv_nsec / 1000; +#else tv[0].tv_sec = sb.st_atim.tv_sec; tv[0].tv_usec = sb.st_atim.tv_nsec / 1000; +#endif /* Change last-modified time */ tv[1].tv_sec = time / 1000; ----Next_Part(Sat_Apr__1_08:31:18_2000_886)---- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000401083125X.fuyuhik8>