diff -c -r build/solaris/GNUmakefile build/freebsd/GNUmakefile *** build/solaris/GNUmakefile Wed May 8 18:28:50 1996 --- build/freebsd/GNUmakefile Wed May 21 14:21:25 1997 *************** *** 6,12 **** TOPDIR = ../.. ! RELEASE = $(shell echo `/usr/ucb/whoami`:`date '+%m/%d/%d-%H:%M'`) PWD = $(shell echo `pwd`) DESTDIR = $(PWD)/$(TOPDIR)/javasrc --- 6,12 ---- TOPDIR = ../.. ! RELEASE = $(shell echo jdk1.0.2-`whoami`:`date '+%Y/%m/%d-%H:%M'`) PWD = $(shell echo `pwd`) DESTDIR = $(PWD)/$(TOPDIR)/javasrc *************** *** 14,24 **** SUBDIRS = java sun ! JDKDELETIONS=build/solaris/make_doc \ build/macos \ ! build/solaris/java/jio/ \ ! build/solaris/sun/hotjava/ \ ! build/solaris/sun/html/ \ build/win32/java/jio/ \ build/win32/sun/hotjava/ \ build/win32/sun/html/ \ --- 14,24 ---- SUBDIRS = java sun ! JDKDELETIONS=build/freebsd/make_doc \ build/macos \ ! build/freebsd/java/jio/ \ ! build/freebsd/sun/hotjava/ \ ! build/freebsd/sun/html/ \ build/win32/java/jio/ \ build/win32/sun/hotjava/ \ build/win32/sun/html/ \ *************** *** 45,53 **** src/share/sun/sun/tools/jsc/ \ src/share/test/ \ src/macos/ \ ! src/solaris/bin/hotjava.sh \ ! src/solaris/doc/ \ ! src/solaris/java/native_threads/ \ src/win32/bin/hotjava.c \ src/win32/bin/hotjava.ico \ src/win32/doc/ --- 45,53 ---- src/share/sun/sun/tools/jsc/ \ src/share/test/ \ src/macos/ \ ! src/freebsd/bin/hotjava.sh \ ! src/freebsd/doc/ \ ! src/freebsd/java/native_threads/ \ src/win32/bin/hotjava.c \ src/win32/bin/hotjava.ico \ src/win32/doc/ diff -c -r build/solaris/java/GNUmakefile build/freebsd/java/GNUmakefile *** build/solaris/java/GNUmakefile Wed May 8 18:28:48 1996 --- build/freebsd/java/GNUmakefile Wed May 21 14:20:31 1997 *************** *** 5,16 **** # TOPDIR = ../../.. ! PLATFORM = solaris PRODUCT = java SUBDIRS = javah java javap javac awt applet net ! RELEASE = $(shell echo `/usr/ucb/whoami`:`date '+%m/%d/%d-%H:%M'`) DESTDIR = installed --- 5,16 ---- # TOPDIR = ../../.. ! PLATFORM = freebsd PRODUCT = java SUBDIRS = javah java javap javac awt applet net ! RELEASE = $(shell echo jdk1.0.2-`whoami`:`date '+%Y/%m/%d-%H:%M'`) DESTDIR = installed diff -c -r build/solaris/java/applet/GNUmakefile build/freebsd/java/applet/GNUmakefile *** build/solaris/java/applet/GNUmakefile Wed May 8 18:28:50 1996 --- build/freebsd/java/applet/GNUmakefile Wed May 21 14:20:47 1997 *************** *** 2,8 **** TOPDIR = ../../../.. PACKAGE = java.applet ! PLATFORM = solaris PRODUCT = sun # --- 2,8 ---- TOPDIR = ../../../.. PACKAGE = java.applet ! PLATFORM = freebsd PRODUCT = sun # diff -c -r build/solaris/java/awt/GNUmakefile build/freebsd/java/awt/GNUmakefile *** build/solaris/java/awt/GNUmakefile Wed May 8 18:28:49 1996 --- build/freebsd/java/awt/GNUmakefile Wed May 21 14:20:44 1997 *************** *** 2,8 **** TOPDIR = ../../../.. PACKAGE = java.awt ! PLATFORM = solaris PRODUCT = sun # --- 2,8 ---- TOPDIR = ../../../.. PACKAGE = java.awt ! PLATFORM = freebsd PRODUCT = sun # diff -c -r build/solaris/java/java/Exportedfiles.gmk build/freebsd/java/java/Exportedfiles.gmk *** build/solaris/java/java/Exportedfiles.gmk Wed May 8 18:28:49 1996 --- build/freebsd/java/java/Exportedfiles.gmk Wed May 21 14:17:45 1997 *************** *** 25,30 **** --- 25,31 ---- java/lang/Runtime.java \ java/lang/SecurityManager.java \ java/util/Date.java \ + java/io/InputStream.java \ java/io/FileDescriptor.java \ java/io/FileInputStream.java \ java/io/FileOutputStream.java \ diff -c -r build/solaris/java/java/GNUmakefile build/freebsd/java/java/GNUmakefile *** build/solaris/java/java/GNUmakefile Wed May 8 18:28:49 1996 --- build/freebsd/java/java/GNUmakefile Wed May 21 14:20:38 1997 *************** *** 5,11 **** # PROGRAM = java ! PLATFORM = solaris PRODUCT = java # --- 5,11 ---- # PROGRAM = java ! PLATFORM = freebsd PRODUCT = java # *************** *** 69,76 **** system_md.c # We need ARCH *before* we do the include that gets us Defs-solaris.gmk ! ARCH = $(shell uname -p) ! ifeq ($(ARCH),sparc) FILES.s += machgc_sparc.s else FILES.c += machgc_nonsparc.c --- 69,76 ---- system_md.c # We need ARCH *before* we do the include that gets us Defs-solaris.gmk ! ARCH = $(shell arch) ! ifeq ($(ARCH),sun4) FILES.s += machgc_sparc.s else FILES.c += machgc_nonsparc.c *************** *** 112,125 **** --- 112,135 ---- ifeq ($(ARCH),sparc) EXTRAFILES-green = else + ifeq ($(ARCH),x86) EXTRAFILES-green = edi.s + else + endif endif EXTRAFILES-native = solaris_regs.s + FILES.s += $(EXTRAFILES-$(THREADS_FLAG)) THREADFILES= $(THREADFILES-$(THREADS_FLAG)) FILES.c += $(THREADFILES) + # we haven't gotten this yet.... + UNAME = $(shell uname) + ifeq ($(UNAME),Linux) + THREADFILES += malloc.c + endif + NATIVE_INCLUDE= $(PLATFORM_SRC)/java/$(THREADDIR)/include/ # *************** *** 132,137 **** --- 142,148 ---- # Tell Program.gmk to build a CClassHeaders directory # PROGRAM_HEADERS = .program.headers + #PROGRAM_HEADERS = INIT = opcodes.h opcodes.init opcodes.length opcodes.in_out .install.includes *************** *** 153,159 **** --- 164,183 ---- PKGPATH = $(PLATFORM_SRC)/java $(SHARE_SRC)/java + ifeq ($(UNAME),Solaris) LDLIBS += -lsocket -lnsl -lresolv + else + ifeq ($(UNAME),SunOS) + LDLIBS += -lnsl -lresolv + endif + ifeq ($(UNAME),Linux) + LDFLAGS += -rdynamic -export-dynamic + endif + # lovely hack for no motif =( + #LDLIBS += /usr/src/java/javasrc/build/freebsd/sun/awt/obj$(SUFFIX)/$(ARCH)/*.o -L/usr/X11/lib /usr/src/X/libraries/lesstif-current/libXm/libXm.a -lXt -lXext -lX11 -lSM -lICE -lXpm + #LDLIBS += /usr/src/java/javasrc/build/freebsd/sun/awt/obj$(SUFFIX)/$(ARCH)/*.o -L/usr/X11/lib /usr/X11/lib/libXm.a -lXt -lXext -lX11 -lSM -lICE -lXpm + #LDLIBS += -lg + endif clean :: FORCE rm -rf CClassHeaders *************** *** 188,190 **** --- 212,216 ---- # Rule for building BreakpointHandler.class $(CLASSBINDIR)/%.class: $(SHARE_SRC)/sun/%.java @echo $? >>.classes.list + + diff -c -r build/solaris/java/javac/GNUmakefile build/freebsd/java/javac/GNUmakefile *** build/solaris/java/javac/GNUmakefile Wed May 8 18:28:47 1996 --- build/freebsd/java/javac/GNUmakefile Wed May 21 14:17:45 1997 *************** *** 6,11 **** all optimized debug clean clobber classes :: echo ">>>Recursively making "$$i" "$@"..." ! cd ../../sun/javac ; gnumake $@ echo "<<>>Recursively making "$$i" "$@"..." ! cd ../../sun/javac ; $(MAKE) $@ echo "<</dev/null --- 24,34 ---- $(PROGRAM): optimized ! # Make a generic link to the ***$(ARCH)*** executable, for casual users $(BINDIR)/$(ARCH)/$(PROGRAM)_g $(BINDIR)/$(ARCH)/$(PROGRAM) \ : $(INIT) .program.dirs.$(ARCH) classes $(PROGRAM_HEADERS) $(FILES.o) $(CC) $(LDFLAGS) $(FILES.o) $(LDLIBS) -o $(@F)-$(ARCH) ! rm -f $(@F); ln -s $(@F)-$(ARCH) $(@F) -(cp $(@F)-$(ARCH) $(BINDIR)/$(ARCH)/$(@F) \ && echo "Copying" $(@F) "to" $(BINDIR)/$(ARCH)) 2>/dev/null diff -c -r build/solaris/sun/GNUmakefile build/freebsd/sun/GNUmakefile *** build/solaris/sun/GNUmakefile Wed May 8 18:28:51 1996 --- build/freebsd/sun/GNUmakefile Wed May 21 14:21:43 1997 *************** *** 4,13 **** # Makefile for building all of hotjava # TOPDIR = ../.. ! PLATFORM = solaris PRODUCT = sun ! RELEASE = $(shell echo `/usr/ucb/whoami`:`date '+%m/%d/%d-%H:%M'`) SUBDIRS = javac javadoc debug net mmedia awt tawt jpeg applet --- 4,13 ---- # Makefile for building all of hotjava # TOPDIR = ../.. ! PLATFORM = freebsd PRODUCT = sun ! RELEASE = $(shell echo jdk1.0.2-`whoami`:`date '+%Y/%m/%d-%H:%M'`) SUBDIRS = javac javadoc debug net mmedia awt tawt jpeg applet diff -c -r build/solaris/sun/applet/GNUmakefile build/freebsd/sun/applet/GNUmakefile *** build/solaris/sun/applet/GNUmakefile Wed May 8 18:28:50 1996 --- build/freebsd/sun/applet/GNUmakefile Wed May 21 14:21:29 1997 *************** *** 2,8 **** TOPDIR = ../../../.. PACKAGE = sun.applet ! PLATFORM = solaris PRODUCT = sun # --- 2,8 ---- TOPDIR = ../../../.. PACKAGE = sun.applet ! PLATFORM = freebsd PRODUCT = sun # diff -c -r build/solaris/sun/awt/GNUmakefile build/freebsd/sun/awt/GNUmakefile *** build/solaris/sun/awt/GNUmakefile Wed May 8 18:28:50 1996 --- build/freebsd/sun/awt/GNUmakefile Wed May 21 14:21:32 1997 *************** *** 3,17 **** TOPDIR = ../../../.. PACKAGE = sun.awt LIBRARY = awt ! PLATFORM = solaris PRODUCT = sun # # Rules # ! all: classes library ! clean: classes.clean motif.clean library.clean # # include rules --- 3,17 ---- TOPDIR = ../../../.. PACKAGE = sun.awt LIBRARY = awt ! PLATFORM = freebsd PRODUCT = sun # # Rules # ! all: classes other_headers library ! clean: classes.clean library.clean # # include rules *************** *** 56,62 **** img_cvdirDcmOpqScl.c \ canvas.c \ color.c \ ! libstubs.c FILES.java = \ sun/awt/HorizBagLayout.java\ --- 56,63 ---- img_cvdirDcmOpqScl.c \ canvas.c \ color.c \ ! libstubs.c \ ! TextExt16.c FILES.java = \ sun/awt/HorizBagLayout.java\ *************** *** 180,199 **** # Default Motif directory # Set MOTIF_DIR to ALT_MOTIF_DIR if set otherwise, set it to _MOTIF_DIR # ! _MOTIF_DIR=/usr/local/Motif MOTIF_DIR=$(_MOTIF_DIR$(ALT_MOTIF_DIR))$(ALT_MOTIF_DIR) ! $(DEBUG) $(OPTIMIZED): motif ! ! motif: .library.dirs.$(ARCH) .library.motif.$(ARCH) ! ! .library.motif.$(ARCH): $(MOTIF_DIR)/lib/libXm.so.3 ! cp $(MOTIF_DIR)/lib/libXm.so.3 $(LIBDIR)/$(ARCH) ! cd $(LIBDIR)/$(ARCH); rm -f libXm.so; ln -s libXm.so.3 libXm.so ! @-touch .library.motif.$(ARCH) ! ! motif.clean : ! rm -f $(LIBDIR)/$(ARCH)/libXm.* CPPFLAGS += -I/usr/openwin/include \ -I$(MOTIF_DIR)/include \ --- 181,190 ---- # Default Motif directory # Set MOTIF_DIR to ALT_MOTIF_DIR if set otherwise, set it to _MOTIF_DIR # ! _MOTIF_DIR=/usr/X11/ MOTIF_DIR=$(_MOTIF_DIR$(ALT_MOTIF_DIR))$(ALT_MOTIF_DIR) ! $(DEBUG) $(OPTIMIZED): CPPFLAGS += -I/usr/openwin/include \ -I$(MOTIF_DIR)/include \ *************** *** 201,206 **** $(EVENT_MODEL) \ -I$(JAVAHOME)/$(PLATFORM)/java/java/CClassHeaders ! LDFLAGS += -L$(LIBDIR)/$(ARCH) -L$(MOTIF_DIR)/lib -lXm - CLASSES.export += java.lang.String java.io.InputStream --- 192,207 ---- $(EVENT_MODEL) \ -I$(JAVAHOME)/$(PLATFORM)/java/java/CClassHeaders ! LDFLAGS += -L$(LIBDIR)/$(ARCH) -L$(MOTIF_DIR)/lib -lXm -lX11 -lXt -lXpm -lXext ! ! #CLASSES.export += java.lang.String java.io.InputStream java.lang.Thread java.lang.ThreadGroup ! other_headers: .other_headers ! mkdir -p CClassHeaders ! cp ../../java/java/CClassHeaders/java_lang_String.h CClassHeaders/ ! cp ../../java/java/CClassHeaders/java_io_InputStream.h CClassHeaders/ ! cp ../../java/java/CClassHeaders/java_lang_Thread.h CClassHeaders/ ! cp ../../java/java/CClassHeaders/java_lang_ThreadGroup.h CClassHeaders/ ! touch .other_headers ! ! .PHONY : .other_headers diff -c -r build/solaris/sun/debug/GNUmakefile build/freebsd/sun/debug/GNUmakefile *** build/solaris/sun/debug/GNUmakefile Wed May 8 18:28:54 1996 --- build/freebsd/sun/debug/GNUmakefile Wed May 21 14:21:56 1997 *************** *** 6,12 **** LIBRARY = agent PACKAGE = sun.tools ! PLATFORM = solaris PRODUCT = sun # --- 6,12 ---- LIBRARY = agent PACKAGE = sun.tools ! PLATFORM = freebsd PRODUCT = sun # diff -c -r build/solaris/sun/javac/GNUmakefile build/freebsd/sun/javac/GNUmakefile *** build/solaris/sun/javac/GNUmakefile Wed May 8 18:28:52 1996 --- build/freebsd/sun/javac/GNUmakefile Wed May 21 14:21:52 1997 *************** *** 6,12 **** PROGRAM = javac PACKAGE = sun.tools ! PLATFORM = solaris PRODUCT = sun TOPDIR = ../../../.. --- 6,12 ---- PROGRAM = javac PACKAGE = sun.tools ! PLATFORM = freebsd PRODUCT = sun TOPDIR = ../../../.. diff -c -r build/solaris/sun/javadoc/GNUmakefile build/freebsd/sun/javadoc/GNUmakefile *** build/solaris/sun/javadoc/GNUmakefile Wed May 8 18:28:55 1996 --- build/freebsd/sun/javadoc/GNUmakefile Wed May 21 14:21:59 1997 *************** *** 6,12 **** PROGRAM = javadoc PACKAGE = sun.tools ! PLATFORM = solaris PRODUCT = sun default: all --- 6,12 ---- PROGRAM = javadoc PACKAGE = sun.tools ! PLATFORM = freebsd PRODUCT = sun default: all diff -c -r build/solaris/sun/jpeg/GNUmakefile build/freebsd/sun/jpeg/GNUmakefile *** build/solaris/sun/jpeg/GNUmakefile Wed May 8 18:28:52 1996 --- build/freebsd/sun/jpeg/GNUmakefile Wed May 21 14:21:49 1997 *************** *** 3,9 **** TOPDIR = ../../../.. PACKAGE = sun.awt LIBRARY = jpeg ! PLATFORM = solaris PRODUCT = sun # --- 3,9 ---- TOPDIR = ../../../.. PACKAGE = sun.awt LIBRARY = jpeg ! PLATFORM = freebsd PRODUCT = sun # diff -c -r build/solaris/sun/misc/GNUmakefile build/freebsd/sun/misc/GNUmakefile *** build/solaris/sun/misc/GNUmakefile Wed May 8 18:28:52 1996 --- build/freebsd/sun/misc/GNUmakefile Wed May 21 14:21:46 1997 *************** *** 2,8 **** TOPDIR = ../../../.. PACKAGE = sun.misc ! PLATFORM = solaris PRODUCT = sun # --- 2,8 ---- TOPDIR = ../../../.. PACKAGE = sun.misc ! PLATFORM = freebsd PRODUCT = sun # diff -c -r build/solaris/sun/mmedia/GNUmakefile build/freebsd/sun/mmedia/GNUmakefile *** build/solaris/sun/mmedia/GNUmakefile Wed May 8 18:28:51 1996 --- build/freebsd/sun/mmedia/GNUmakefile Wed May 21 14:21:36 1997 *************** *** 3,9 **** TOPDIR = ../../../.. PACKAGE = sun.audio LIBRARY = mmedia ! PLATFORM = solaris PRODUCT = sun # --- 3,9 ---- TOPDIR = ../../../.. PACKAGE = sun.audio LIBRARY = mmedia ! PLATFORM = freebsd PRODUCT = sun # diff -c -r build/solaris/sun/net/GNUmakefile build/freebsd/sun/net/GNUmakefile *** build/solaris/sun/net/GNUmakefile Wed May 8 18:28:51 1996 --- build/freebsd/sun/net/GNUmakefile Wed May 21 14:21:39 1997 *************** *** 1,8 **** ! # @(#)GNUmakefile 1.26 96/04/18 TOPDIR = ../../../.. PACKAGE = sun.net ! PLATFORM = solaris PRODUCT = sun # --- 1,8 ---- ! # @(#)GNUmakefile 1.13 95/11/01 TOPDIR = ../../../.. PACKAGE = sun.net ! PLATFORM = freebsd PRODUCT = sun # diff -c -r build/solaris/sun/tawt/GNUmakefile build/freebsd/sun/tawt/GNUmakefile *** build/solaris/sun/tawt/GNUmakefile Wed May 8 18:28:55 1996 --- build/freebsd/sun/tawt/GNUmakefile Wed May 21 14:22:03 1997 *************** *** 3,9 **** TOPDIR = ../../../.. PACKAGE = sun.awt LIBRARY = tawt ! PLATFORM = solaris PRODUCT = sun # --- 3,9 ---- TOPDIR = ../../../.. PACKAGE = sun.awt LIBRARY = tawt ! PLATFORM = freebsd PRODUCT = sun # *************** *** 38,44 **** img_cvdirDcmTrnUns.c \ img_cvdirDcmOpqScl.c \ gifdecoder.c \ ! libstubs.c FILES.java = \ sun/awt/tiny/TinyToolkit.java \ --- 38,46 ---- img_cvdirDcmTrnUns.c \ img_cvdirDcmOpqScl.c \ gifdecoder.c \ ! libstubs.c \ ! Text16.c \ ! TextExt16.c FILES.java = \ sun/awt/tiny/TinyToolkit.java \ *************** *** 119,128 **** vpath %.c $(SHARE_SRC)/sun/gif vpath %.c $(SHARE_SRC)/sun/images ! CPPFLAGS += -I/usr/openwin/include \ -I$(SHARE_SRC)/sun/images \ -I$(JAVAHOME)/$(PLATFORM)/java/java/CClassHeaders ! LDFLAGS += -L$(LIBDIR)/$(ARCH) -lX ! CLASSES.export += java.lang.String java.io.InputStream --- 121,130 ---- vpath %.c $(SHARE_SRC)/sun/gif vpath %.c $(SHARE_SRC)/sun/images ! CPPFLAGS += -I/usr/X11R6/include \ -I$(SHARE_SRC)/sun/images \ -I$(JAVAHOME)/$(PLATFORM)/java/java/CClassHeaders ! LDFLAGS += -L$(LIBDIR)/$(ARCH) -L/usr/X11R6/lib -lX11 ! CLASSES.export += java.lang.String java.io.InputStream java.lang.Thread java.lang.ThreadGroup *** /dev/null Wed May 21 15:25:25 1997 --- build/freebsd/makefiles/Defs-freebsd.gmk Wed May 21 15:21:11 1997 *************** *** 0 **** --- 1,82 ---- + # + # @(#)Defs-solaris.gmk 1.15 95/10/04 + # + # Makefile to specify compiler flags for programs and libraries + # targeted to Solaris. Should not contain any rules. + # + + ARCH = $(shell uname -m) + UNAME = $(shell uname) + + # This default is redefined during a release build. + RELEASE = $(shell echo jdk1.0.2-`whoami`:`date '+%Y/%m/%d-%H:%M'`) + + # If -Xa is in CFLAGS_COMMON it will end up ahead of $(POPT) for the + # optimized build, and that ordering of the flags completely freaks + # out cc. Hence, -Xa is instead in each CFLAGS variant. + CFLAGS_COMMON = + CFLAGS_OPT = $(POPT) + CFLAGS_DBG = -g + + # By default use green threads + THREADS_FLAG = green + + ifeq ($(THREADS_FLAG),native) + CFLAGS_COMMON += -D_REENTRANT -DNATIVE + endif + + # Java memory management is based on memory mapping by default, but a + # system only assuming malloc/free can be built by adding -DUSE_MALLOC + + CPPFLAGS_COMMON = -D$(ARCH) -DRELEASE='"$(RELEASE)"' -DBREAKPTS + CPPFLAGS_OPT = -DTRIMMED + CPPFLAGS_DBG = -DDEBUG -DTRACING + + ASFLAGS_COMMON = -P + ASFLAGS_OPT = + ASFLAGS_DBG = + + LDFLAGS_COMMON = -L$(OPENWINHOME)/lib + LDFLAGS_OPT = + LDFLAGS_DBG = + + LDLIBS_COMMON = + LDLIBS_OPT = + LDLIBS_DBG = + + ifeq ($(THREADS_FLAG),native) + LDLIBS_COMMON += -lthread + endif + + # + # Java variations + # + ifeq ($(PRODUCT), java) + # Java default optimization -x04 + _OPT = -O6 + CPPFLAGS_DBG += -DLOGGING -DDBINFO + ASFLAGS_COMMON += -D_ASM + # LDLIBS_COMMON += -lm + LDLIBS_COMMON += -lm + endif + + # + # Hotjava variations + # + ifneq ($(PRODUCT), java) + # Hotjava default optimization -x02 + _OPT = -O6 + endif + + # + # Tools + # + CC = gcc + AS = as + CPP = cc -E + LD = ld + + OPENWINHOME = /usr/openwin + + LIBRARY_SUFFIX = so + diff -c -r src/solaris/bin/java_wrapper.sh src/freebsd/bin/java_wrapper.sh *** src/solaris/bin/java_wrapper.sh Wed May 8 18:31:15 1996 --- src/freebsd/bin/java_wrapper.sh Wed May 21 14:17:48 1997 *************** *** 1,4 **** ! #! /bin/ksh # # @(#)java_wrapper.sh 1.18 95/11/14 # --- 1,4 ---- ! #!/usr/local/bin/ksh # # @(#)java_wrapper.sh 1.18 95/11/14 # *************** *** 34,43 **** export CLASSPATH export LD_LIBRARY_PATH ! LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$J_HOME/lib/`uname -p`" progname=`basename $0` ! prog=$J_HOME/bin/`uname -p`/${progname} if [ -f $prog ] then --- 34,43 ---- export CLASSPATH export LD_LIBRARY_PATH ! LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$J_HOME/lib/`uname -m`" progname=`basename $0` ! prog=$J_HOME/bin/`uname -m`/${progname} if [ -f $prog ] then diff -c -r src/solaris/bin/javac.sh src/freebsd/bin/javac.sh *** src/solaris/bin/javac.sh Wed May 8 18:31:15 1996 --- src/freebsd/bin/javac.sh Wed May 21 14:17:48 1997 *************** *** 1,3 **** #!/bin/sh # @(#)javac.sh 1.4 95/09/14 ! `dirname $0`/java -ms8m -verbosegc sun.tools.javac.Main $* --- 1,3 ---- #!/bin/sh # @(#)javac.sh 1.4 95/09/14 ! `dirname $0`/java -verbosegc sun.tools.javac.Main $* diff -c -r src/solaris/java/green_threads/include/context_md.h src/freebsd/java/green_threads/include/context_md.h *** src/solaris/java/green_threads/include/context_md.h Wed May 8 18:49:14 1996 --- src/freebsd/java/green_threads/include/context_md.h Wed May 21 14:17:48 1997 *************** *** 26,43 **** */ /* ! * Solaris-dependent API */ ! #ifndef _SOLARIS_CONTEXT_MD_H_ ! #define _SOLARIS_CONTEXT_MD_H_ #include - #include - #include - #ifdef i386 #include #endif /* * Routines that call getcontext have strange control flow graphs, --- 26,49 ---- */ /* ! * Linux-dependent API */ ! #ifndef _LINUX_CONTEXT_MD_H_ ! #define _LINUX_CONTEXT_MD_H_ #include #include + #include + #include + #include + + typedef struct lj_ucontext { + sigjmp_buf jmpbuf; + #if (defined(__linux__) && defined(__i386__)) || defined(__FreeBSD__) + char floatbuf[108]; #endif + } lj_ucontext_t; /* * Routines that call getcontext have strange control flow graphs, *************** *** 47,121 **** */ #pragma unknown_control_flow(getcontext) - #ifdef i386 - #include - #endif - /* * A solaris2 context. Everything else is on the stack. */ typedef struct { - #ifdef i386 - /* hack to fix the problem in get/set context system call - * we save the value in edi reg here before getting - * getcontext(), and restore this value during setcontext() - */ - unsigned int edi; - sigset_t oldMask, blockMask; - #endif unsigned int unix_errno; ! ucontext_t ucontext; } context_t; /* Save state of the current content and call rescheduler */ void reschedule(void); ! #if i386 ! ! int getedi(void); ! void setedi(int); ! #define yieldContext(contextp) \ ! sigfillset(&((contextp)->blockMask)); \ ! sigprocmask(SIG_BLOCK, (const sigset_t *)&((contextp)->blockMask), \ ! &((contextp)->oldMask)); \ ! (contextp)->edi = getedi(); \ ! if (! getcontext(&((contextp)->ucontext))) { \ ! sigprocmask(SIG_SETMASK, \ ! (const sigset_t *)&((contextp)->oldMask), NULL); \ ! ((contextp)->ucontext).uc_mcontext.gregs[EDI] = (contextp)->edi; \ ! (contextp)->unix_errno = errno; \ ! reschedule(); \ ! } else { \ ! sigprocmask(SIG_SETMASK, &((contextp)->oldMask), NULL); \ ! setedi((contextp)->edi); \ ! } ! #else - #define yieldContext(contextp) \ ! if (! getcontext(&((contextp)->ucontext))) { \ ! (contextp)->unix_errno = errno; \ ! reschedule(); \ ! } ! ! #endif /* i386 */ /* switch to the new context */ - #ifdef i386 - #define switchContext(contextp) { \ - errno = (contextp)->unix_errno; \ - ((contextp)->ucontext).uc_mcontext.gregs[EAX] = 1; \ - setcontext(&((contextp)->ucontext)); \ - } - #else #define switchContext(contextp) { \ errno = (contextp)->unix_errno; \ ! ((contextp)->ucontext).uc_mcontext.gregs[11] = 1; \ ! setcontext(&((contextp)->ucontext)); \ } - #endif /* i386 */ ! #endif /* !_SOLARIS_CONTEXT_MD_H_ */ --- 53,96 ---- */ #pragma unknown_control_flow(getcontext) /* * A solaris2 context. Everything else is on the stack. */ typedef struct { unsigned int unix_errno; ! lj_ucontext_t lj_ucontext; } context_t; /* Save state of the current content and call rescheduler */ void reschedule(void); ! #if (defined(__linux__) && defined(__i386__)) || defined(__FreeBSD__) #define yieldContext(contextp) \ ! { \ ! char * fdata = (char *)contextp->lj_ucontext.floatbuf; \ ! __asm__ ("fsave %0"::"m" (*fdata)); \ ! __asm__ ("fwait"); \ ! if (!sigsetjmp(contextp->lj_ucontext.jmpbuf,-1)) { \ ! (contextp)->unix_errno = errno; \ ! reschedule(); \ ! } \ ! } #else #define yieldContext(contextp) \ ! { \ ! if (!sigsetjmp(contextp->lj_ucontext.jmpbuf,-1)) { \ ! (contextp)->unix_errno = errno; \ ! reschedule(); \ ! } \ ! } ! #endif /* switch to the new context */ #define switchContext(contextp) { \ errno = (contextp)->unix_errno; \ ! lj_setcontext(&((contextp)->lj_ucontext)); \ } ! #endif /* !_LINUX_CONTEXT_MD_H_ */ diff -c -r src/solaris/java/green_threads/include/internal_md.h src/freebsd/java/green_threads/include/internal_md.h *** src/solaris/java/green_threads/include/internal_md.h Wed May 8 18:49:16 1996 --- src/freebsd/java/green_threads/include/internal_md.h Wed May 21 14:17:48 1997 *************** *** 33,38 **** --- 33,39 ---- #define _SOLARIS_INTERNAL_MD_H_ #include + #include /* * Machine dependent info diff -c -r src/solaris/java/green_threads/include/iomgr.h src/freebsd/java/green_threads/include/iomgr.h *** src/solaris/java/green_threads/include/iomgr.h Wed May 8 18:49:17 1996 --- src/freebsd/java/green_threads/include/iomgr.h Wed May 21 14:17:48 1997 *************** *** 33,38 **** --- 33,42 ---- #ifndef _GREEN_IOMGR_H_ #define _GREEN_IOMGR_H_ + #ifndef SOLARIS + #define FCNTL_HACK 1 + #endif /* not SOLARIS */ + #include "monitor.h" int nonblock_io(int,int); *************** *** 58,65 **** --- 62,74 ---- #define FD_NBINIT 0x1 #define FD_CLOSED 0x2 + #ifdef __linux__ + #define READ_TIMEOUT 20 + #define WRITE_TIMEOUT 20 + #else #define READ_TIMEOUT TIMEOUT_INFINITY #define WRITE_TIMEOUT TIMEOUT_INFINITY + #endif #define check_single_fd(fd) \ if ((fd_flags[fd] & FD_NBINIT) == 0) { \ *************** *** 92,96 **** --- 101,107 ---- #define SYS_FCNTL 10 #define SYS_DUP 11 #define SYS_CREAT 12 + #define SYS_ACCEPT 13 + #define SYS_SELECT 14 #endif /* !_GREEN_IOMGR_H_ */ diff -c -r src/solaris/java/green_threads/include/threads_md.h src/freebsd/java/green_threads/include/threads_md.h *** src/solaris/java/green_threads/include/threads_md.h Wed May 8 18:49:10 1996 --- src/freebsd/java/green_threads/include/threads_md.h Wed May 21 14:17:49 1997 *************** *** 119,122 **** --- 119,124 ---- extern void setCurrentThread(sys_thread_t *); #define currentThread() (_CurrentThread) + #include + #endif /* !_GREEN_THREADS_MD_H_ */ diff -c -r src/solaris/java/green_threads/src/context.c src/freebsd/java/green_threads/src/context.c *** src/solaris/java/green_threads/src/context.c Wed May 8 18:49:23 1996 --- src/freebsd/java/green_threads/src/context.c Wed May 21 14:17:49 1997 *************** *** 31,36 **** --- 31,39 ---- #include #include + #ifndef PROT_NONE + #define PROT_NONE 0 + #endif #include #include #include *************** *** 41,51 **** #include "itimer_md.h" #include "sparc_md.h" #include "context.h" #include "log.h" #include "schedule.h" ! #include "sys_api.h" ! /* * The list on which we put freed thread stacks pending reclamation. */ --- 44,57 ---- #include "itimer_md.h" #include "sparc_md.h" #include "context.h" + #include "debug.h" #include "log.h" #include "schedule.h" ! #ifdef SUNOS4 ! #include ! #endif ! /* * The list on which we put freed thread stacks pending reclamation. */ *************** *** 105,112 **** stack->stack_size, stackFreeCount); /* Don't forget the redzone... */ size = stack->stack_size + redZoneSize; /* REMIND: Ignoring return value here... */ ! sysUnmapMem((char *)stack - redZoneSize, size, &junk); stack = next; } } --- 111,120 ---- stack->stack_size, stackFreeCount); /* Don't forget the redzone... */ size = stack->stack_size + redZoneSize; + /*stack -= redZoneSize;*/ /*!!! NO!! redZoneSize is in BYTES */ + /*!!! stack is not... bad pointer arith */ /* REMIND: Ignoring return value here... */ ! sysUnmapMem(((char *)stack)-redZoneSize, size, &junk); stack = next; } } *************** *** 159,165 **** } else { /* Didn't get one */ SCHED_UNLOCK(); /* Can't allocate with SCHED_LOCKED() */ if (redZoneSize == 0) { ! redZoneSize = sysconf(_SC_PAGESIZE); /* one page */ } size += redZoneSize; /* For redzone */ stack->base = (stackp_t) sysMapMem(size, &size); --- 167,179 ---- } else { /* Didn't get one */ SCHED_UNLOCK(); /* Can't allocate with SCHED_LOCKED() */ if (redZoneSize == 0) { ! #ifdef _SC_PAGESIZE ! redZoneSize = sysconf(_SC_PAGESIZE); ! #elif defined(PAGESIZE) ! redZoneSize = PAGESIZE; ! #else ! redZoneSize = 8192; /* should be enough */ ! #endif } size += redZoneSize; /* For redzone */ stack->base = (stackp_t) sysMapMem(size, &size); *************** *** 190,207 **** currentStackPointer(sys_thread_t *tp) { context_t *context = &tp->mdcontext; ! ucontext_t *uc = &(context->ucontext); ! #ifdef i386 ! return (void *) (uc->uc_mcontext.gregs[USP]); ! #else /* Presumed to be SPARC */ ! return (void *) (uc->uc_mcontext.gregs[REG_O6]); ! #endif /* i386 */ ! } ! #ifdef i386 ! ! /* Solaris/x86 version */ /* * This is the stack layout, as defined by the Intel ABI --- 204,220 ---- currentStackPointer(sys_thread_t *tp) { context_t *context = &tp->mdcontext; ! lj_ucontext_t *uc = &(context->lj_ucontext); ! #if defined(__sun__) && defined(__mc68000__) ! return (void *)(uc->jmpbuf[2]); /* ouch... thats sunos for you */ ! #elif defined(__FreeBSD__) ! return (void *)(uc->jmpbuf->_sjb[2]); ! #else ! return (void *)(uc->jmpbuf->__jmpbuf->__sp); ! #endif } ! /* Linux/x86 version */ /* * This is the stack layout, as defined by the Intel ABI *************** *** 225,319 **** void (*death_func)(), unsigned int arg) { context_t *mdcontext = CONTEXT(tid); ! ucontext_t *uc = &(mdcontext->ucontext); unsigned char *sp; int *p; - getcontext(uc); sp = (unsigned char *) tid->stack_base; /* Note: WINDOWSIZE stuff is for SPARC, not really needed for x86 */ sp -= (sizeof(sys_thread_t) + WINDOWSIZE + SA(MINFRAME)); /* Force sp to be double aligned! */ sp = (unsigned char *)((unsigned long)(sp) & 0xfffffff8); /* for x86 the args to death_func are passed on the stack */ p = (int *)sp; *p-- = (int ) pc; *p-- = (int ) arg; *p-- = (int ) 1; /* dummy arg - for compatibility with SPARC version */ ! ! uc->uc_mcontext.gregs[USP] = (unsigned int) p; ! uc->uc_mcontext.gregs[PC] = (unsigned int) death_func; ! } ! #else ! ! /* Solaris/SPARC version */ ! ! /* ! * This is the stack layout, as defined by the SPARC ABI: ! * ! * HIGH ADDRESSES ! * |-----------------------| ! * | ThreadPrivate data | ! * |-----------------------| ! * | 16 words for in and | death_func() stack frame ! * | local save area | ! * |-----------------------| -------- ! * | arguments past the 6th| ! * |-----------------------| startup func stack frame ! * | 6 words for locals | ! * |-----------------------| ! * | 1 word for aggregate | ! * | return value | ! * |-----------------------| ! * | %i7 = startaddr | ! * | %i6 = sp | ! * | %i0-%i1 --> args 1-5 | ! * |-----------------------| ! * | 8 words for saved %l's| ! * |-----------------------| <--- sp(double aligned) ! * LOW ADDRESSES ! */ ! void ! initContext(sys_thread_t *tid, unsigned int pc, ! void (*death_func)(), unsigned int arg) ! { ! unsigned char *sp; ! ucontext_t *uc; ! context_t *mdcontext = CONTEXT(tid); ! machdep_t *machdepP = MACHDEP(tid); ! ! uc = &(mdcontext->ucontext); ! sp = (unsigned char *) tid->stack_base; ! sysAssert(sp == ((unsigned char *)tid+sizeof(sys_thread_t))); ! ! sp -= (sizeof(sys_thread_t) + WINDOWSIZE + SA(MINFRAME)); ! ! /* Force sp to be double aligned! */ ! sp = (unsigned char *)((unsigned long)(sp) & 0xfffffff8); /* clear the context structure */ ! memset(uc, 0, sizeof(ucontext_t)); ! uc->uc_stack.ss_sp = (char *) sp; ! uc->uc_stack.ss_size = tid->stack_size; ! uc->uc_stack.ss_flags = 0; /* ? */ ! ! /* initialially all signals are enabled */ ! /* FIXME change to be initially disabled? */ ! memset((char *)&(uc->uc_sigmask), 0, sizeof(sigset_t)); ! machdepP->intrLockCount = 0; ! ! uc->uc_mcontext.gregs[REG_SP] = (unsigned int) sp; ! uc->uc_mcontext.gregs[REG_PC] = (unsigned int) death_func; ! uc->uc_mcontext.gregs[REG_nPC] = (unsigned int) death_func+4; ! uc->uc_mcontext.gregs[REG_O1] = arg; ! uc->uc_mcontext.gregs[REG_O2] = (int) pc; ! ! uc->uc_flags = UC_ALL; ! return; } - #endif /* i386 */ /* * This routine allocates enought memory for the thread context --- 238,298 ---- void (*death_func)(), unsigned int arg) { context_t *mdcontext = CONTEXT(tid); ! lj_ucontext_t *uc = &(mdcontext->lj_ucontext); unsigned char *sp; int *p; + char *fdata; sp = (unsigned char *) tid->stack_base; /* Note: WINDOWSIZE stuff is for SPARC, not really needed for x86 */ sp -= (sizeof(sys_thread_t) + WINDOWSIZE + SA(MINFRAME)); /* Force sp to be double aligned! */ sp = (unsigned char *)((unsigned long)(sp) & 0xfffffff8); + #if defined(__i386__) /* for x86 the args to death_func are passed on the stack */ p = (int *)sp; *p-- = (int ) pc; *p-- = (int ) arg; *p-- = (int ) 1; /* dummy arg - for compatibility with SPARC version */ ! #if defined(__FreeBSD__) ! *p-- = (int ) 0; ! #endif ! #elif defined(__mc68000__) ! /* for m68k the args to death_func are passed on the stack */ ! p = (int *)sp; ! *p-- = (int ) pc; ! *p-- = (int ) arg; ! *p-- = (int ) 1; /* dummy arg - for compatibility with SPARC version */ ! *p-- = (int ) 0; /* i have no idea what this is... */ #else ! #error WHAT KIND OF MACHINE IS THIS? ! #endif /* clear the context structure */ ! memset(uc, 0, sizeof(lj_ucontext_t)); ! #if (defined(__linux__) && defined(__i386__)) || defined(__FreeBSD__) ! fdata = (char *)uc->floatbuf; ! __asm__ ("fsave %0"::"m" (*fdata)); ! __asm__ ("fwait"); ! #endif ! ! #if defined(__linux__) && defined(__i386__) ! uc->jmpbuf->__jmpbuf->__bp = (char *) p; ! uc->jmpbuf->__jmpbuf->__sp = (char *) p; ! uc->jmpbuf->__jmpbuf->__pc = death_func; ! #elif defined(__sun__) && defined(__mc68000__) ! uc->jmpbuf[2] = (int)(char *)p; ! uc->jmpbuf[3] = (int)death_func; ! #elif defined(__FreeBSD__) ! uc->jmpbuf->_sjb[3] = (int)(char *)p; ! uc->jmpbuf->_sjb[2] = (int)(char *)p; ! uc->jmpbuf->_sjb[0] = (int)death_func; ! uc->jmpbuf->_sjb[7] = 0x127f; /* FPU mask */ ! #else ! #error DONT KNOW HOW TO initContext() !! ! #endif } /* * This routine allocates enought memory for the thread context *************** *** 365,371 **** * The normal case: queue the stack and the thread private data * to be freed when safe. */ ! sysAssert(0 <= tid->stack_size); /* Note that free stacks are pointed to *above* the redzone */ tmp = (free_stack_t *)((char *) tid->stack_base - tid->stack_size); tmp->stack_size = tid->stack_size; --- 344,350 ---- * The normal case: queue the stack and the thread private data * to be freed when safe. */ ! assert(0 <= tid->stack_size); /* Note that free stacks are pointed to *above* the redzone */ tmp = (free_stack_t *)((char *) tid->stack_base - tid->stack_size); tmp->stack_size = tid->stack_size; *************** *** 377,379 **** --- 356,392 ---- } return; } + + + #if 0 + #error THIS CANT BE IN A FUNCTION!!!! + int lj_getcontext(lj_ucontext_t *context) { + char * fdata = (char *)context->floatbuf; + __asm__ ("fsave %0"::"m" (*fdata)); + return sigsetjmp(context->jmpbuf,-1); + } + #endif + + int contextsaves=0; + int lj_setcontext(lj_ucontext_t *context) { + #if (defined(__linux__) && defined(__i386__)) + char * fdata; + contextsaves++; + fdata = (char *)context->floatbuf; + __asm__ ("frstor %0"::"m" (*fdata)); + siglongjmp(context->jmpbuf,1); + #elif defined(__FreeBSD__) + char * fdata; + contextsaves++; + fdata = (char *)context->floatbuf; + __asm__ ("frstor %0"::"m" (*fdata)); + __asm__ ("fwait"); + siglongjmp(context->jmpbuf,1); + #else + longjmp(context->jmpbuf,1); + #endif + return 0; + } + + + diff -c -r src/solaris/java/green_threads/src/interrupt_md.c src/freebsd/java/green_threads/src/interrupt_md.c *** src/solaris/java/green_threads/src/interrupt_md.c Wed May 8 18:49:20 1996 --- src/freebsd/java/green_threads/src/interrupt_md.c Wed May 21 14:17:49 1997 *************** *** 26,32 **** */ /* ! * Solaris 2.X dependant interrupt handling code. */ --- 26,32 ---- */ /* ! * Linux dependant interrupt handling code. */ *************** *** 35,47 **** */ #include #include - #include - #include #include #include "sys_api.h" #include "oobj.h" #include "interpreter.h" #include "interrupt.h" #include "itimer_md.h" #include "log.h" --- 35,46 ---- */ #include #include #include #include "sys_api.h" #include "oobj.h" #include "interpreter.h" + #include "debug.h" #include "interrupt.h" #include "itimer_md.h" #include "log.h" *************** *** 97,104 **** /* * Local routine prototypes. */ ! static void signalHandlerPanic(int, siginfo_t *, void *); ! static void signalHandlerDispatch(int, siginfo_t *, void *); /* * Exported routines. --- 96,103 ---- /* * Local routine prototypes. */ ! static void signalHandlerPanic(int); ! static void signalHandlerDispatch(int); /* * Exported routines. *************** *** 174,204 **** intrInitMD() { struct sigaction sigAct; /* * Install the panic handler for the signals that should cause us * to panic. */ ! sigAct.sa_handler = NULL; ! sigAct.sa_sigaction = signalHandlerPanic; sigemptyset(&(sigAct.sa_mask)); sigaddset(&sigAct.sa_mask, SIGPIPE); ! sigAct.sa_flags = SA_SIGINFO | SA_RESTART; ! sigaction(SIGABRT, &sigAct, (struct sigaction *)0); sigaction(SIGBUS, &sigAct, (struct sigaction *)0); sigaction(SIGILL, &sigAct, (struct sigaction *)0); sigaction(SIGIOT, &sigAct, (struct sigaction *)0); ! sigaction(SIGEMT, &sigAct, (struct sigaction *)0); sigaction(SIGFPE, &sigAct, (struct sigaction *)0); sigaction(SIGQUIT, &sigAct, (struct sigaction *)0); sigaction(SIGSEGV, &sigAct, (struct sigaction *)0); ! sigaction(SIGSYS, &sigAct, (struct sigaction *)0); sigaction(SIGTRAP, &sigAct, (struct sigaction *)0); sigaction(SIGXCPU, &sigAct, (struct sigaction *)0); sigaction(SIGXFSZ, &sigAct, (struct sigaction *)0); ! sigignore(SIGPIPE); if (sigprocmask(SIG_SETMASK, &(sigAct.sa_mask), NULL)) perror("intrinitMD - 2"); --- 173,218 ---- intrInitMD() { struct sigaction sigAct; + struct sigaction sigActOld; /* * Install the panic handler for the signals that should cause us * to panic. */ ! sigAct.sa_handler = signalHandlerPanic; sigemptyset(&(sigAct.sa_mask)); sigaddset(&sigAct.sa_mask, SIGPIPE); ! #ifdef SA_RESTART ! sigAct.sa_flags = SA_RESTART; ! #endif ! /* sigaction(SIGABRT, &sigAct, (struct sigaction *)0);*/ ! /* handling abort results in an endless loop =( */ sigaction(SIGBUS, &sigAct, (struct sigaction *)0); sigaction(SIGILL, &sigAct, (struct sigaction *)0); sigaction(SIGIOT, &sigAct, (struct sigaction *)0); ! /* sigaction(SIGEMT, &sigAct, (struct sigaction *)0);*/ sigaction(SIGFPE, &sigAct, (struct sigaction *)0); sigaction(SIGQUIT, &sigAct, (struct sigaction *)0); sigaction(SIGSEGV, &sigAct, (struct sigaction *)0); ! /* sigaction(SIGSYS, &sigAct, (struct sigaction *)0);*/ sigaction(SIGTRAP, &sigAct, (struct sigaction *)0); sigaction(SIGXCPU, &sigAct, (struct sigaction *)0); sigaction(SIGXFSZ, &sigAct, (struct sigaction *)0); ! /* now we get the SIGLARM, and change it to block SIGIO */ ! /* this might not be needed on systems other than linux, ! but lets be safe here --RC */ ! #ifdef __linux__ ! sigaction(SIGALRM, &sigAct, &sigActOld); ! /* sigaddset(sigActOld.sa_mask, SIGIO); */ ! sigaction(SIGALRM, &sigActOld, (struct sigaction *)0); ! #else ! sigaction(SIGALRM, &sigAct, (struct sigaction *)0); ! #endif ! ! ! signal(SIGPIPE, SIG_IGN); if (sigprocmask(SIG_SETMASK, &(sigAct.sa_mask), NULL)) perror("intrinitMD - 2"); *************** *** 232,240 **** */ sigfillset(&(sigAct.sa_mask)); ! sigAct.sa_handler = 0; ! sigAct.sa_sigaction = signalHandlerDispatch; ! sigAct.sa_flags = SA_SIGINFO | SA_RESTART; sigaction(interrupt, &sigAct, (struct sigaction *)0); } --- 246,255 ---- */ sigfillset(&(sigAct.sa_mask)); ! sigAct.sa_handler = signalHandlerDispatch; ! #ifdef SA_RESTART ! sigAct.sa_flags = SA_RESTART; ! #endif sigaction(interrupt, &sigAct, (struct sigaction *)0); } *************** *** 252,260 **** * Set to the panic handler in case we get one when we shouldn't */ sigfillset(&(sigAct.sa_mask)); ! sigAct.sa_handler = NULL; ! sigAct.sa_sigaction = signalHandlerPanic; ! sigAct.sa_flags = SA_SIGINFO; sigaction(interrupt, &sigAct, (struct sigaction *)0); } --- 267,274 ---- * Set to the panic handler in case we get one when we shouldn't */ sigfillset(&(sigAct.sa_mask)); ! sigAct.sa_handler = signalHandlerPanic; ! sigAct.sa_flags = 0; sigaction(interrupt, &sigAct, (struct sigaction *)0); } *************** *** 262,267 **** --- 276,282 ---- * Local routines. */ + #if 0 /* * Decode a siginfo_t structure, and print out something interesting * about it. Truncate and succeed if the buffer write overflows. It's *************** *** 378,383 **** --- 393,399 ---- return msg; } } + #endif /*- * signalHandlerPanic() -- Deal with unexpected signals by dumping *************** *** 385,434 **** * panicing. */ static void ! signalHandlerPanic(int sig, siginfo_t *info, void *uc) { - extern void CompiledCodeSignalHandler(int sig, siginfo_t *info, void *uc); extern void DumpMonitors(); extern void DumpAlarmQ(); static int count = 0; if (sig != SIGQUIT && ++count > 1) { ! signal(SIGABRT, SIG_DFL); ! sysAbort(); } ! CompiledCodeSignalHandler(sig, info, uc); ! ! if (sig > MAXSIG) { fprintf(stderr, "Unknown signal: %d\n", sig); } else { fprintf(stderr, "%s\n", signalNames[sig]); } - if (info) { - /* print out signal info */ - if (info->si_code != SI_NOINFO) { - fprintf(stderr, " si_signo [%d]: %s\n", - info->si_signo, signalNames[info->si_signo]); - fprintf(stderr, " si_errno [%d]: %s\n", - info->si_errno, strerror(info->si_errno)); - fprintf(stderr, " si_code [%d]: %s\n", - info->si_code, decode_si_code(sig, info)); - } - - if (sysThreadSelf()) { - fprintf(stderr, "\tstackbase=%X, stackpointer=%X\n", - sysThreadStackBase(sysThreadSelf()), - sysThreadStackPointer(sysThreadSelf())); - } - } - DumpThreads(); DumpMonitors(); DumpAlarmQ(); if (sig != SIGQUIT) { ! signal(SIGABRT, SIG_DFL); ! sysAbort(); } } --- 401,428 ---- * panicing. */ static void ! signalHandlerPanic(int sig) { extern void DumpMonitors(); extern void DumpAlarmQ(); static int count = 0; if (sig != SIGQUIT && ++count > 1) { ! /*abort();*/ ! kill(getpid(),SIGKILL); } ! if (sig > NSIG) { fprintf(stderr, "Unknown signal: %d\n", sig); } else { fprintf(stderr, "%s\n", signalNames[sig]); } DumpThreads(); DumpMonitors(); DumpAlarmQ(); if (sig != SIGQUIT) { ! abort(); } } *************** *** 436,452 **** * signalHandlerDispatch() -- Turn our signal into an intrDispatch(). */ static void ! signalHandlerDispatch(int sig, siginfo_t *info, void *uc) { int old_errno; if (sig == SIGSEGV) ! sysExit(1); Log1(1, "signalHandlerDispatch(sig=%d)\n", sig); old_errno = errno; ! intrDispatch(sig, (void *) info); errno = old_errno; --- 430,446 ---- * signalHandlerDispatch() -- Turn our signal into an intrDispatch(). */ static void ! signalHandlerDispatch(int sig) { int old_errno; if (sig == SIGSEGV) ! exit(1); Log1(1, "signalHandlerDispatch(sig=%d)\n", sig); old_errno = errno; ! intrDispatch(sig, (void *) NULL); errno = old_errno; diff -c -r src/solaris/java/green_threads/src/io_md.c src/freebsd/java/green_threads/src/io_md.c *** src/solaris/java/green_threads/src/io_md.c Wed May 8 18:49:22 1996 --- src/freebsd/java/green_threads/src/io_md.c Wed May 21 14:17:49 1997 *************** *** 70,78 **** #include #include #include - #include #include ! #include #include "threads.h" #include "threads_md.h" --- 70,81 ---- #include #include #include #include ! #ifdef __linux__ ! #include ! #else ! #include ! #endif #include "threads.h" #include "threads_md.h" *************** *** 82,87 **** --- 85,96 ---- #include "log.h" #include "fd_md.h" + #ifndef __solaris__ + typedef unsigned boolean_t; + #define B_TRUE ((boolean_t)1) + #define B_FALSE ((boolean_t)0) + #endif + extern int pendingException(); extern boolean_t initialize_monitors(int); extern int system_close(int); *************** *** 329,335 **** /******************** Socket related calls ************************/ void sysSocketInitializeFD(Classjava_io_FileDescriptor *fdptr, int infd) { ! sys_mon_t *mon = fdmon[infd]; sysAssert(mon!=NULL); sysMonitorEnter(mon); --- 338,349 ---- /******************** Socket related calls ************************/ void sysSocketInitializeFD(Classjava_io_FileDescriptor *fdptr, int infd) { ! sys_mon_t *mon; ! int ret; ! ! ret = initialize_monitors(infd); ! mon = fdmon[infd]; ! sysAssert(mon!=NULL); sysMonitorEnter(mon); *************** *** 372,377 **** --- 386,392 ---- int *len) { int fd = fdobj->fd - 1; + int newfd; int ret = -1; sys_mon_t *mon; *************** *** 385,394 **** sysMonitorEnter(mon); fd = fdobj->fd - 1; ! if (fd>=0) ret = accept(fd, him, len); sysMonitorExit(mon); ! return ret; } int --- 400,436 ---- sysMonitorEnter(mon); fd = fdobj->fd - 1; ! if (fd>=0) { ! fd_ref[fd]++; ! ! while(!pendingException() && !closed_fd(fd)) { ! ret = accept(fd, him, len); ! ! if ((ret != -1) || pendingException() || ! ((errno != EAGAIN) && (errno != EINTR))) ! break; ! if (errno == EAGAIN) ! sysMonitorWait(mon, READ_TIMEOUT); ! } ! ! fd_ref[fd]--; ! /* If I am the last person to leave and fd has been closed ! call system close on the fd */ ! if (fd_ref[fd]==0 && closed_fd(fd)) system_close(fd); ! ! } sysMonitorExit(mon); ! newfd = ret; ! if (newfd != -1) { ! Log1(1, "Accepted fd: %d\n", newfd); ! ret = initialize_monitors(newfd); ! /* fdobj->fd = newfd+1;*/ ! } else { ! Log1(1, "accept error: %d\n", errno); ! } ! ! return newfd; } int *************** *** 420,430 **** result = connect(s, him, len); while (result < 0 && !pendingException()) { ! if (errno == EINPROGRESS) { ! int cnt = _select(s+1, 0, &write_fds, 0, &poll); FD_SET(s, &write_fds); if (cnt == 1) { int bytes; if (ioctl(s, FIONREAD, &bytes) == -1) { --- 462,492 ---- result = connect(s, him, len); while (result < 0 && !pendingException()) { ! if (errno == EINPROGRESS || errno == EAGAIN || errno == EINTR) { ! #ifdef __linux__ ! int cnt = /*_*/select(s+1, 0, &write_fds, 0, &poll); ! #else ! int cnt = (*systable[SYS_SELECT].addr)(s+1,0,&write_fds,0,&poll); ! #endif FD_SET(s, &write_fds); if (cnt == 1) { + #ifdef __linux__ + if (connect(s,him,len) == -1) { + if (errno == ENOTCONN) { + errno = ECONNREFUSED; + } + /* see comment below */ + break; + } + #elif defined(__FreeBSD__) + struct sockaddr rconn; + int rconnlen = sizeof(struct sockaddr); + + if(!(getpeername(s, &rconn, &rconnlen))) { + errno = ECONNREFUSED; /* not necessarily, but likely */ + } + #else int bytes; if (ioctl(s, FIONREAD, &bytes) == -1) { *************** *** 437,442 **** --- 499,505 ---- sysAssert(result < 0); break; } + #endif result = 0; break; } *************** *** 542,552 **** sysRecvfromFD(Classjava_io_FileDescriptor * fdobj, char *buf, int nbytes, int flags, struct sockaddr *from, int *fromlen) { sys_mon_t *mon; register int nread = -1; struct pollfd polltbl[1]; - int fd = fdobj->fd-1; int status; if (fd < 0) { --- 605,642 ---- sysRecvfromFD(Classjava_io_FileDescriptor * fdobj, char *buf, int nbytes, int flags, struct sockaddr *from, int *fromlen) { + int fd = fdobj->fd-1; + + #if defined(__linux__) || defined(__FreeBSD__) + register int nread = -1; + fd_set readset, writeset, exceptset; + int status; + + check_single_fd(fd); + + /* Since the recvfrom is not working in nonblocking manner, + we select on the fd until there is data. Poll succeeds + when client sends data. So then do a blocking recvfrom */ + + FD_ZERO(&readset); + FD_ZERO(&writeset); + FD_ZERO(&exceptset); + FD_SET(fd,&readset); + + Log1(1, "Going into recvfrom on fd %d\n", fd); + if ((status = select(fd+1, &readset, &writeset, &exceptset, NULL)) <=0) { + Log2(1, "polling before recvfrom failed with status %d, errno %d\n", + status, errno); /* this isnt what this does.... */ + } else { + nread = recvfrom(fd, buf, nbytes, flags, from, fromlen); + Log2(1, "Recvfrom for %d bytes finished on fd: %d\n", nread, fd); + } + return nread; + #else sys_mon_t *mon; register int nread = -1; struct pollfd polltbl[1]; int status; if (fd < 0) { *************** *** 571,577 **** --- 661,669 ---- Log2(1, "Recvfrom for %d bytes finished on fd: %d\n", nread, fd); } return nread; + #endif } + diff -c -r src/solaris/java/green_threads/src/iomgr.c src/freebsd/java/green_threads/src/iomgr.c *** src/solaris/java/green_threads/src/iomgr.c Wed May 8 18:49:26 1996 --- src/freebsd/java/green_threads/src/iomgr.c Wed May 21 14:17:50 1997 *************** *** 42,48 **** #include #include #include - #include #include #include #include --- 42,47 ---- *************** *** 51,59 **** #include #include #include #include ! #include #include "threads.h" #include "threads_md.h" --- 50,59 ---- #include #include + #if !(defined(__linux__) || defined(__FreeBSD__)) #include #include ! #endif #include "threads.h" #include "threads_md.h" *************** *** 66,71 **** --- 66,75 ---- #include "log.h" #include "sys_api.h" + typedef unsigned boolean_t; + #define B_TRUE ((boolean_t)1) + #define B_FALSE ((boolean_t)0) + /* Pavani's Async IO notes: *************** *** 145,163 **** #define IO_OPTIMIZE syscall_t systable[] = { ! { "write", 0 }, ! { "writev", 0 }, ! { "read", 0 }, ! { "readv", 0 }, ! { "getmsg", 0 }, ! { "putmsg", 0 }, ! { "poll", 0 }, ! { "open", 0 }, ! { "close", 0 }, ! { "pipe", 0 }, ! { "fcntl", 0}, ! { "dup", 0 }, ! { "creat", 0 }, { (char *) 0, 0 } }; --- 149,169 ---- #define IO_OPTIMIZE syscall_t systable[] = { ! { "_write", 0 }, ! { "_writev", 0 }, ! { "_read", 0 }, ! { "_readv", 0 }, ! { "_getmsg", 0 }, ! { "_putmsg", 0 }, ! { "_poll", 0 }, ! { "_open", 0 }, ! { "_close", 0 }, ! { "_pipe", 0 }, ! { "_fcntl", 0}, ! { "_dup", 0 }, ! { "_creat", 0 }, ! { "_accept", 0 }, ! { "_select", 0 }, { (char *) 0, 0 } }; *************** *** 179,187 **** --- 185,223 ---- initSyscalls() { syscall_t *tp = systable; + #if defined(__FreeBSD__) + #define LIBRARY "/usr/lib/libc.so.2.2" + #endif + #ifndef RTLD_NEXT + void *dlMain; + #endif + + #ifndef RTLD_NEXT + #if defined(SUNOS4) + dlMain = dlopen("/lib/libc.so.0.15",1); + #else + dlMain = dlopen(LIBRARY, 1); + #endif + #endif while (tp->sym != (char *) 0) { + char buf[128]; + #ifdef RTLD_NEXT tp->addr = (sysfunc_t) dlsym(RTLD_NEXT, tp->sym); + #else + tp->addr = (sysfunc_t) dlsym(dlMain, tp->sym); + #endif + #if 0 + if( !tp->addr ) { + buf[0] = '_'; + strcpy(buf+1, tp->sym); + } + #ifdef RTLD_NEXT + tp->addr = (sysfunc_t) dlsym(RTLD_NEXT, buf); + #else + tp->addr = (sysfunc_t) dlsym(0, buf); + #endif + #endif tp++; } } *************** *** 287,292 **** --- 323,329 ---- nonblock_io(int desc, int onoff) { long flgs; + pid_t pid; sysAssert(desc < max_files); sysAssert(fdmon[desc] != NULL); *************** *** 300,309 **** /* if it's already non-blocking, do nothing... */ if ((flgs = fcntl(desc, F_GETFL, 0)) == -1) { IO_UNLOCK(); sysMonitorExit(fdmon[desc]); return -1;} ! fcntl(desc, F_SETFL, flgs | O_NONBLOCK); ioctl(desc, I_SETSIG, S_INPUT | S_OUTPUT); ! asyncIOActivateFD(desc); fd_flags[desc] |= FD_NBINIT; --- 337,360 ---- /* if it's already non-blocking, do nothing... */ if ((flgs = fcntl(desc, F_GETFL, 0)) == -1) { IO_UNLOCK(); sysMonitorExit(fdmon[desc]); return -1;} ! #ifdef SOLARIS fcntl(desc, F_SETFL, flgs | O_NONBLOCK); ioctl(desc, I_SETSIG, S_INPUT | S_OUTPUT); ! #else /* not SOLARIS */ ! #if defined(FNONBLOCK) ! flgs |= FNONBLOCK|FASYNC; ! #else ! flgs |= O_NONBLOCK|FASYNC; ! #endif ! fcntl(desc, F_SETFL, flgs); ! pid = getpid (); ! #if defined(F_SETOWN) ! fcntl(desc, F_SETOWN, pid); ! #endif ! #if defined(FIOSETOWN) ! ioctl(desc, FIOSETOWN, &pid); ! #endif ! #endif /* not SOLARIS */ asyncIOActivateFD(desc); fd_flags[desc] |= FD_NBINIT; *************** *** 318,324 **** { IO_UNLOCK(); sysMonitorExit(fdmon[desc]); return -1; } fcntl(desc, F_SETFL, flgs & ~O_NONBLOCK); ! ioctl(desc, I_SETSIG, 0); fd_flags[desc] &= ~FD_NBINIT; --- 369,376 ---- { IO_UNLOCK(); sysMonitorExit(fdmon[desc]); return -1; } fcntl(desc, F_SETFL, flgs & ~O_NONBLOCK); ! /*this is a major loss and takes changing blocking code elsewhere */ ! /*ioctl(desc, I_SETSIG, 1);*/ fd_flags[desc] &= ~FD_NBINIT; *************** *** 404,417 **** } ssize_t ! recv(int fd, char *buf, int nbytes, int flags) { return read(fd, (void *) buf, (uint) nbytes); } - ssize_t ! send(int fd, const char *buf, int nbytes, int flags) { return write(fd, buf, (uint) nbytes); } --- 456,468 ---- } ssize_t ! recv(int fd, void *buf, size_t nbytes, int flags) { return read(fd, (void *) buf, (uint) nbytes); } ssize_t ! send(int fd, __const void *buf, size_t nbytes, int flags) { return write(fd, buf, (uint) nbytes); } *************** *** 434,440 **** ((errno != EAGAIN) && (errno != EINTR))) break; if (errno == EAGAIN) ! sysMonitorWait(mon, SYS_TIMEOUT_INFINITY); } Log2(1, "sendto done on fd: %d, retval %d\n", fd, retval); --- 485,491 ---- ((errno != EAGAIN) && (errno != EINTR))) break; if (errno == EAGAIN) ! sysMonitorWait(mon, 20/*!*/); } Log2(1, "sendto done on fd: %d, retval %d\n", fd, retval); *************** *** 446,451 **** --- 497,528 ---- ssize_t sysrecvfrom(int fd, char *buf, int nbytes, int flags, struct sockaddr *from, int *fromlen) { + #if defined(__linux__) || defined(__FreeBSD__) + register int nread = -1; + fd_set readset, writeset, exceptset; + int status; + + check_single_fd(fd); + + /* Since the recvfrom is not working in nonblocking manner, + we select on the fd until there is data. Poll succeeds + when client sends data. So then do a blocking recvfrom */ + + FD_ZERO(&readset); + FD_ZERO(&writeset); + FD_ZERO(&exceptset); + FD_SET(fd,&readset); + + Log1(1, "Going into recvfrom on fd %d\n", fd); + if ((status = select(fd+1, &readset, &writeset, &exceptset, NULL)) <=0) { + Log2(1, "polling before recvfrom failed with status %d, errno %d\n", + status, errno); /* this isnt what this does.... */ + } else { + nread = recvfrom(fd, buf, nbytes, flags, from, fromlen); + Log2(1, "Recvfrom for %d bytes finished on fd: %d\n", nread, fd); + } + return nread; + #else register int nread = -1; struct pollfd polltbl[1]; int status; *************** *** 467,472 **** --- 544,550 ---- Log2(1, "Recvfrom for %d bytes finished on fd: %d\n", nread, fd); } return nread; + #endif } *************** *** 561,567 **** if (nwrote==-1) { /* with errno== EAGAIN or EINTR */ /* TBD: WRITE_TIMEOUT should be replaced by SYS_TIMEOUT_INIFINITY */ ! if (errno == EAGAIN) sysMonitorWait(mon, WRITE_TIMEOUT); continue; } --- 639,645 ---- if (nwrote==-1) { /* with errno== EAGAIN or EINTR */ /* TBD: WRITE_TIMEOUT should be replaced by SYS_TIMEOUT_INIFINITY */ ! if (0 && errno == EAGAIN) sysMonitorWait(mon, WRITE_TIMEOUT); continue; } *************** *** 582,587 **** --- 660,666 ---- + #if 0 /* AVH -- added the writev system call, it is used * by some libraries like X11. */ *************** *** 607,613 **** nwrote = (*systable[SYS_WRITEV].addr)(fd, iov, iovcnt); while (nwrote == -1) { ! if (errno == EAGAIN) { /* TBD: WRITE_TIMEOUT should be replaced by SYS_TIMEOUT_INIFINITY */ sysMonitorWait(mon, WRITE_TIMEOUT); --- 686,692 ---- nwrote = (*systable[SYS_WRITEV].addr)(fd, iov, iovcnt); while (nwrote == -1) { ! if (0 && errno == EAGAIN) { /* TBD: WRITE_TIMEOUT should be replaced by SYS_TIMEOUT_INIFINITY */ sysMonitorWait(mon, WRITE_TIMEOUT); *************** *** 744,749 **** --- 823,829 ---- sysMonitorExit(mon); return retval; } + #endif /* *************** *** 768,774 **** int delay = 50; /* sleep 50 ms and try again */ fd_set write_fds; struct timeval poll; - extern int _select (int width, fd_set *, fd_set *, fd_set *, struct timeval *); FD_ZERO(&write_fds); FD_SET(s, &write_fds); --- 848,853 ---- *************** *** 776,799 **** sysMonitorEnter(asyncMon(SYS_ASYNC_MON_IO)); result = connect(s, him, len); while (result < 0 && !pendingException()) { if (errno == EINPROGRESS) { ! int cnt = _select(s+1, 0, &write_fds, 0, &poll); FD_SET(s, &write_fds); if (cnt == 1) { ! int bytes; ! if (ioctl(s, FIONREAD, &bytes) == -1) { ! if (errno == EPIPE) { ! errno = ECONNREFUSED; ! } ! /* If this fails with EPIPE, then we assume ! connection is refused - who knows what's ! right? Not I. */ ! sysAssert(result < 0); ! break; ! } result = 0; break; } --- 855,889 ---- sysMonitorEnter(asyncMon(SYS_ASYNC_MON_IO)); result = connect(s, him, len); + /*printf("socket connect(): result is %d, errno: %d\n", result, errno);*/ while (result < 0 && !pendingException()) { if (errno == EINPROGRESS) { ! int cnt = (*systable[SYS_SELECT].addr)(s+1, 0, &write_fds, 0, &poll); FD_SET(s, &write_fds); if (cnt == 1) { ! #if 0 ! int bytes; ! if (ioctl(s, FIONREAD, &bytes) == -1) { ! if (errno == EPIPE) { ! errno = ECONNREFUSED; ! } ! /* If this fails with EPIPE, then we assume ! connection is refused - who knows what's ! right? Not I. */ ! sysAssert(result < 0); ! break; ! } ! #else ! if (connect(s,him,len) == -1) { ! if (errno == ENOTCONN) { ! errno = ECONNREFUSED; ! } ! /* see comment above */ ! break; ! } ! #endif result = 0; break; } *************** *** 807,812 **** --- 897,903 ---- } + #if 0 /* Poll system call */ int *************** *** 858,867 **** sysMonitorExit(asyncMon(SYS_ASYNC_MON_IO)); return retval; } /* Select system call in a multi-threaded environment. ! This works by affecting a poll. If _select returns non-negative, then we return that value. Otherwise, we block until *any* IO is ready, and then try again. If we still come up empty then we block for a smaller amount of time this time. --- 949,959 ---- sysMonitorExit(asyncMon(SYS_ASYNC_MON_IO)); return retval; } + #endif /* Select system call in a multi-threaded environment. ! This works by affecting a poll. If select returns non-negative, then we return that value. Otherwise, we block until *any* IO is ready, and then try again. If we still come up empty then we block for a smaller amount of time this time. *************** *** 907,913 **** timeval_t delay; int timeout = SYS_TIMEOUT_INFINITY; ! nfds = _select(width, readfds, writefds, exceptfds, &poll); if (nfds != 0) { break; --- 999,1005 ---- timeval_t delay; int timeout = SYS_TIMEOUT_INFINITY; ! nfds = (*systable[SYS_SELECT].addr)(width, readfds, writefds, exceptfds, &poll); if (nfds != 0) { break; *************** *** 923,929 **** timerSub(&delay, &now); timeout = (delay.tv_sec * 1000) + (delay.tv_usec / 1000); } ! sysMonitorWait(asyncMon(SYS_ASYNC_MON_IO), timeout); if (readfds != 0) COPY_SET(readfds, &reads, width); if (writefds != 0) --- 1015,1021 ---- timerSub(&delay, &now); timeout = (delay.tv_sec * 1000) + (delay.tv_usec / 1000); } ! sysMonitorWait(asyncMon(SYS_ASYNC_MON_IO), 20); /*! remember the no signal thingie? */ if (readfds != 0) COPY_SET(readfds, &reads, width); if (writefds != 0) *************** *** 960,977 **** IO_LOCK(); va_start(ap, flags); if (flags & O_CREAT) { ! mode = va_arg(ap, unsigned int); } else { ! mode = 0; } va_end(ap); while(1) { ! fd = (*systable[SYS_OPEN].addr)(fname, flags, mode); ! if ((fd != -1) || pendingException() || ! ((errno != EAGAIN) && (errno != EINTR))) ! break; } ! if (fd != -1) { Log1(1, "Opened fd: %d\n", fd); ret = initialize_monitors(fd); --- 1052,1069 ---- IO_LOCK(); va_start(ap, flags); if (flags & O_CREAT) { ! mode = va_arg(ap, unsigned int); } else { ! mode = 0; } va_end(ap); while(1) { ! fd = (*systable[SYS_OPEN].addr)(fname, flags, mode); ! if ((fd != -1) || pendingException() || ! ((errno != EAGAIN) && (errno != EINTR))) ! break; } ! if (fd != -1) { Log1(1, "Opened fd: %d\n", fd); ret = initialize_monitors(fd); *************** *** 1040,1049 **** register int fd; va_list ap; int ret; ! int arg; /* optional third argument */ va_start(ap, cmd); arg = va_arg(ap, int); IO_LOCK(); while (1) { fd = (*systable[SYS_FCNTL].addr)(fildes, cmd, arg); --- 1132,1153 ---- register int fd; va_list ap; int ret; ! int arg; va_start(ap, cmd); arg = va_arg(ap, int); + + #ifdef FCNTL_HACK + #if defined(FNONBLOCK) + if (cmd == F_SETFL && arg == FNONBLOCK) { + arg = FNONBLOCK|FASYNC; + } + #else + if (cmd == F_SETFL && arg == FIONBIO) { + arg = O_NONBLOCK|FIONBIO|FASYNC; + } + #endif + #endif /* FCNTL_HACK */ IO_LOCK(); while (1) { fd = (*systable[SYS_FCNTL].addr)(fildes, cmd, arg); diff -c -r src/solaris/java/green_threads/src/itimer.c src/freebsd/java/green_threads/src/itimer.c *** src/solaris/java/green_threads/src/itimer.c Wed May 8 18:49:25 1996 --- src/freebsd/java/green_threads/src/itimer.c Wed May 21 14:17:50 1997 *************** *** 37,43 **** --- 37,45 ---- #include "monitor_md.h" #include "itimer_md.h" + #ifdef __solaris__ extern int gettimeofday(struct timeval *, void *); + #endif /* * The minimum clock resolution in uSeconds. diff -c -r src/solaris/java/green_threads/src/monitor_md.c src/freebsd/java/green_threads/src/monitor_md.c *** src/solaris/java/green_threads/src/monitor_md.c Wed May 8 18:49:19 1996 --- src/freebsd/java/green_threads/src/monitor_md.c Wed May 21 14:17:50 1997 *************** *** 467,472 **** --- 467,490 ---- !mid->suspend_waitq) { /* Nobody on queues, owner exiting, destroy if in cache */ mid->monitor_owner = SYS_THREAD_NULL; + /* if the pendingq is set, remove us from it */ + sysAssert(!((mid->flags & SYS_MON_PENDING_NOTIFICATION) && mid->pendingq == SYS_MID_NULL)); + /* ugly. We will need to walk the pendingq and adjust whoever + points to us! */ + if (mid->pendingq) { + sys_mon_t **midq = &PendingNotifyQ; + while (*midq) { + if (*midq == mid) { + #ifdef DEBUG + fprintf(stderr, "removed us from someone's pendingq\n"); + #endif + *midq = mid->pendingq; + break; + } + midq = &((*midq)->pendingq); + } + mid->pendingq = SYS_MID_NULL; + } /* Clear all flags except SYS_MON_{IN_CACHE,HAS_HANDLER} */ mid->flags &= (SYS_MON_IN_CACHE | SYS_MON_HAS_HANDLER); ret = SYS_DESTROY; diff -c -r src/solaris/java/green_threads/src/process_md.c src/freebsd/java/green_threads/src/process_md.c *** src/solaris/java/green_threads/src/process_md.c Wed May 8 18:49:29 1996 --- src/freebsd/java/green_threads/src/process_md.c Wed May 21 14:17:50 1997 *************** *** 29,35 **** #include #include #include ! #include #include #include --- 29,35 ---- #include #include #include ! #include #include #include *************** *** 59,68 **** void java_lang_ProcessReaper_waitForDeath(Hjava_lang_ProcessReaper *this) { - siginfo_t info; sys_mon_t *mon = asyncMon(SYS_ASYNC_MON_CHILD); char *classname = JAVAPKG "UNIXProcess"; ClassClass *cb = FindClass(0, classname, TRUE); if (cb == NULL) { SignalError(0, JAVAPKG "NoClassDefFoundError", classname); --- 59,69 ---- void java_lang_ProcessReaper_waitForDeath(Hjava_lang_ProcessReaper *this) { sys_mon_t *mon = asyncMon(SYS_ASYNC_MON_CHILD); char *classname = JAVAPKG "UNIXProcess"; ClassClass *cb = FindClass(0, classname, TRUE); + pid_t pid; + int status; if (cb == NULL) { SignalError(0, JAVAPKG "NoClassDefFoundError", classname); *************** *** 71,84 **** while (1) { sysMonitorEnter(mon); ! while (waitid(P_ALL, 0, &info, WEXITED|WNOHANG) != 0 || info.si_pid == 0) { sysMonitorWait(mon, TIMEOUT_INFINITY); } /* ! * fprintf(stderr, "pid %d status %d\n", info.si_pid, info.si_status); */ execute_java_static_method(EE(), cb, "deadChild", "(II)V", ! info.si_pid, info.si_status); sysMonitorExit(mon); } } --- 72,89 ---- while (1) { sysMonitorEnter(mon); ! while (1) { ! pid = waitpid(0, &status, WNOHANG); ! if (pid != 0 && pid != -1) { ! break; ! } sysMonitorWait(mon, TIMEOUT_INFINITY); } /* ! * fprintf(stderr, "pid %d status %d\n", pid, status); */ execute_java_static_method(EE(), cb, "deadChild", "(II)V", ! pid, status); sysMonitorExit(mon); } } *************** *** 87,95 **** long java_lang_UNIXProcess_waitForUNIXProcess(Hjava_lang_UNIXProcess *this) { ! siginfo_t info; ! waitid(P_PID, unhand(this)->pid, &info, WEXITED); return 1; } --- 92,100 ---- long java_lang_UNIXProcess_waitForUNIXProcess(Hjava_lang_UNIXProcess *this) { ! int status; ! waitpid(unhand(this)->pid, &status, 0); return 1; } *************** *** 113,119 **** /* sysThreadSingle(); */ if ((pid = fork()) == 0) { /* Child process */ ! dup2(fdin[1], 0); dup2(fdout[1], 1); dup2(fderr[1], 2); --- 118,124 ---- /* sysThreadSingle(); */ if ((pid = fork()) == 0) { /* Child process */ ! dup2(fdin[0], 0); dup2(fdout[1], 1); dup2(fderr[1], 2); *************** *** 125,145 **** close(fderr[1]); { int err; char c; ! err = (*systable[SYS_READ].addr)(fdsync[1], &c, 1); fprintf(stderr, "err = %d!\n", err); } } else { /* parent process */ /* sysThreadMulti(); */ ! infdptr->fd = fdin[0]+1; outfdptr->fd = fdout[0]+1; errfdptr->fd = fderr[0]+1; ! syncfdptr->fd = fdsync[0]+1; ! close(fdin[1]); close(fdout[1]); close(fderr[1]); ! close(fdsync[1]); } return pid; } --- 130,152 ---- close(fderr[1]); { int err; char c; ! err = (*systable[SYS_READ].addr)(fdsync[0], &c, 1); fprintf(stderr, "err = %d!\n", err); } + close(fdsync[0]); + close(fdsync[1]); } else { /* parent process */ /* sysThreadMulti(); */ ! infdptr->fd = fdin[1]+1; outfdptr->fd = fdout[0]+1; errfdptr->fd = fderr[0]+1; ! syncfdptr->fd = fdsync[1]+1; ! close(fdin[0]); close(fdout[1]); close(fderr[1]); ! close(fdsync[0]); } return pid; } diff -c -r src/solaris/java/green_threads/src/signals.c src/freebsd/java/green_threads/src/signals.c *** src/solaris/java/green_threads/src/signals.c Wed May 8 18:49:28 1996 --- src/freebsd/java/green_threads/src/signals.c Wed May 21 14:17:50 1997 *************** *** 1,3 **** --- 1,6 ---- + #if defined(__linux__) || defined(__FreeBSD__) + #define NOPOLL + #endif /* * Copyright (c) 1993-1996 Sun Microsystems, Inc. All Rights Reserved. * *************** *** 32,38 **** /* * Header files. */ - #include #include #include #include --- 35,40 ---- *************** *** 42,53 **** #include "threads_md.h" #include "monitor_md.h" #include "interrupt.h" ! #include "ucontext.h" #include "log.h" #include "itimer_md.h" #include "schedule.h" #include "monitor.h" /* For monitorRegister() */ #include "iomgr.h" /* For io lock */ void out_of_memory(void); --- 44,62 ---- #include "threads_md.h" #include "monitor_md.h" #include "interrupt.h" ! #include "debug.h" #include "log.h" #include "itimer_md.h" #include "schedule.h" #include "monitor.h" /* For monitorRegister() */ #include "iomgr.h" /* For io lock */ + #ifndef NOPOLL + #include + #endif + + #if defined(SOLARIS) && !defined(SIGHOLD) + #define SIGHOLD + #endif void out_of_memory(void); *************** *** 70,76 **** #include - #include /* The polling fd table. This table is contains all the file descriptors which are currently attempting i/o but have gotten --- 79,84 ---- *************** *** 86,97 **** This array is always packed. That is, there are no holes in it. The goal is to pass the minimum amount of fd's to the kernel for examination, and to only pass valid fds. Hopefully this isn't more ! work than it's worth. */ static struct pollfd *pollTable; /* This is the number of fds to examine in fdsToPoll */ - static int fdCount = -1; /* FdMap is indexed by file descriptor. It maps from a file descriptor to a position in the pollTable. A pollOffset of -1 --- 94,117 ---- This array is always packed. That is, there are no holes in it. The goal is to pass the minimum amount of fd's to the kernel for examination, and to only pass valid fds. Hopefully this isn't more ! work than it's worth. ! ! -- rc ! Note that on systems with NOPOLL, the select tables are NOT packed. ! -- rc ! */ ! ! static int fdCount = -1; ! ! #if defined(NOPOLL) ! static fd_set selectInTable; ! static fd_set selectOutTable; ! #else ! /* None of this is needed for select() based systems --rc */ static struct pollfd *pollTable; /* This is the number of fds to examine in fdsToPoll */ /* FdMap is indexed by file descriptor. It maps from a file descriptor to a position in the pollTable. A pollOffset of -1 *************** *** 101,106 **** --- 121,127 ---- short pollOffset; /* offset into the pollTable */ short flags; /* bits POLLIN and POLLOUT */ } *fdMap; + #endif /* * External routines. *************** *** 141,147 **** asyncIORegister(); ! if (fdCount == -1) { struct FdEntry *entry; int slot; --- 162,173 ---- asyncIORegister(); ! if (fdCount == -1) { ! #if defined(NOPOLL) ! FD_ZERO(&selectInTable); ! FD_ZERO(&selectOutTable); ! fdCount = 0; ! #else struct FdEntry *entry; int slot; *************** *** 160,165 **** --- 186,192 ---- if (pollTable == 0) { out_of_memory(); } + #endif } } *************** *** 180,186 **** * them. The notification is completely normal, except for the locking. * If a yield is necessary, it is done by the caller. */ ! sysAssert(PendingNotifyQ); midq = PendingNotifyQ; while (midq) { mid = midq; --- 207,213 ---- * them. The notification is completely normal, except for the locking. * If a yield is necessary, it is done by the caller. */ ! assert(PendingNotifyQ); midq = PendingNotifyQ; while (midq) { mid = midq; *************** *** 292,300 **** memset((void *)mid, 0, sizeof (*mid)); if (action == ASYNC_REGISTER) { ! mid->flags |= SYS_MON_HAS_HANDLER; ! /* Mustn't be a cache monitor: see monitor_md.h */ ! sysAssert((mid->flags & SYS_MON_IN_CACHE) == 0); /* Register our interrrupt handler */ intrRegister(sig, intrNotifyHandler, handlerMonitors[key]); --- 319,327 ---- memset((void *)mid, 0, sizeof (*mid)); if (action == ASYNC_REGISTER) { ! mid->flags |= SYS_MON_HAS_HANDLER; ! /* Mustn't be a cache monitor: see monitor_md.h */ ! sysAssert((mid->flags & SYS_MON_IN_CACHE) == 0); /* Register our interrrupt handler */ intrRegister(sig, intrNotifyHandler, handlerMonitors[key]); *************** *** 308,329 **** void asyncIOActivateFD(int fd) { struct FdEntry *entry; struct pollfd *pollfd; int slot; ! /* Here we need to mask SIGIO signal so that the signal handler does not run & use the poll table while we are constructing it. This is necessary as poll table is shared data structure and we cannot use the locks in the signal handler. NOTE: The assumption here is sighold and sigrelse apply process wide - TBD: Confirm this is true! If NOT then we need to grab the SCHED_LOCK so that thread cannot context switch here - ! Well just to be on safe side we grab SCHED_LOCK as well - pavani*/ SCHED_LOCK(); sighold(SIGIO); entry = &fdMap[fd]; if ((slot = entry->pollOffset) == -1) { entry->pollOffset = fdCount++; --- 335,367 ---- void asyncIOActivateFD(int fd) { + #if !defined(NOPOLL) struct FdEntry *entry; struct pollfd *pollfd; int slot; + #endif ! /* Here we need to mask SIGIO signal so that the signal handler does not run & use the poll table while we are constructing it. This is necessary as poll table is shared data structure and we cannot use the locks in the signal handler. NOTE: The assumption here is sighold and sigrelse apply process wide - TBD: Confirm this is true! If NOT then we need to grab the SCHED_LOCK so that thread cannot context switch here - ! Well just to be on safe side we grab SCHED_LOCK as well - pavani ! Which is needed for systems without sighold --rc */ SCHED_LOCK(); + #ifdef SIGHOLD sighold(SIGIO); + #endif + #if defined(NOPOLL) + FD_SET(fd, &selectInTable); + FD_SET(fd, &selectOutTable); + /*fprintf(stderr, "asking for io on fd %d\n", fd);*/ + fdCount++; + #else entry = &fdMap[fd]; if ((slot = entry->pollOffset) == -1) { entry->pollOffset = fdCount++; *************** *** 335,353 **** --- 373,406 ---- pollfd->fd = fd; /* may be redundant */ pollfd->events = entry->flags; Log2(1, "Activating fd=%d onto slot=%d\n", fd, slot); + #endif + + #ifdef SIGHOLD sigrelse(SIGIO); + #endif SCHED_UNLOCK(); } void asyncIODeactivateFD(int fd) { + #if !defined(NOPOLL) struct FdEntry *entry; int slot; + #endif SCHED_LOCK(); + #ifdef SIGHOLD sighold(SIGIO); + #endif + #if defined(NOPOLL) + FD_CLR(fd, &selectInTable); + FD_CLR(fd, &selectOutTable); + /*fprintf(stderr, "unasking for io on fd %d\n", fd);*/ + fdCount--; + sysAssert(fdCount >= 0); + #else entry = &fdMap[fd]; if ((slot = entry->pollOffset) != -1) { /* Now copy the highest slot in the poll array into this slot, *************** *** 371,377 **** --- 424,433 ---- pollTable[slot].events = entry->flags; } } + #endif + #ifdef SIGHOLD sigrelse(SIGIO); + #endif SCHED_UNLOCK(); } *************** *** 390,402 **** { int need_to_switch = 0; ! sysAssert(mid!=NULL); if (SCHED_LOCKED()) { /* * Queue this notification */ if ((mid->flags & SYS_MON_PENDING_NOTIFICATION) == 0) { ! sysAssert(mid->pendingq == SYS_MID_NULL); mid->pendingq = PendingNotifyQ; PendingNotifyQ = mid; } --- 446,458 ---- { int need_to_switch = 0; ! assert(mid!=NULL); if (SCHED_LOCKED()) { /* * Queue this notification */ if ((mid->flags & SYS_MON_PENDING_NOTIFICATION) == 0) { ! assert(mid->pendingq == SYS_MID_NULL); mid->pendingq = PendingNotifyQ; PendingNotifyQ = mid; } *************** *** 432,461 **** static int sigioNotifier(int interrupt, void *arg, void *siginfo) { - extern sys_mon_t **fdmon; int resched = 0; int i, nfds, count; nfds = fdCount; /* Optimization: when there's only one fd to choose from it must have been the one that delivered the sigio, right? */ if (nfds == 1) { ! Log1(1, "Notify single fd=%d\n", pollTable[0].fd); ! resched |= asyncEventNotify(fdmon[pollTable[0].fd]); } else if (nfds > 0) { ! count = (*systable[SYS_POLL].addr)((int)pollTable, nfds, 0); ! Log1(1, "Poll returns %d fds to look at\n", count); ! for (i = 0; (i < nfds) && (count>0); i++) { ! if ( ((pollTable[i].revents & (POLLIN)) != 0) || ! ((pollTable[i].revents & (POLLOUT)) != 0) ) { ! Log2(1, "Notify fd=%d on mon for revents %d \n", ! pollTable[i].fd, pollTable[i].revents); ! pollTable[i].events = (POLLIN|POLLOUT); ! resched |= asyncEventNotify(fdmon[pollTable[i].fd]); ! --count; ! } ! } } /* And for good measure... */ /* This monitor is the default io monitor mainly used for --- 488,554 ---- static int sigioNotifier(int interrupt, void *arg, void *siginfo) { int resched = 0; + #if defined(NOPOLL) + int i, count; + fd_set tableIn, tableOut; + struct timeval timeout; + + tableIn = selectInTable; + tableOut = selectOutTable; + + /* Optimization: when there's only one fd to choose from it must have + been the one that delivered the sigio, right? */ + if (fdCount != 1) { + timeout.tv_sec = timeout.tv_usec = 0; + /* unfortunately, we don't know how to know what the maximum + fd in there is */ + count = (*systable[SYS_SELECT].addr)(sizeof(tableIn)*8, + &tableIn, &tableOut, + NULL, &timeout); + } else + count = 1; + + for (i = 0; i < sizeof(tableIn)*8 && count > 0; i++) { + if (FD_ISSET(i, &tableIn)) { + resched |= asyncEventNotify(fdmon[i]); + /*fprintf(stderr, "io(in) on fd %d\n", i);*/ + count--; + } + + if (FD_ISSET(i, &tableOut)) { + resched |= asyncEventNotify(fdmon[i]); + /*fprintf(stderr, "io(out) on fd %d\n", i);*/ + count--; + } + } + + #else int i, nfds, count; + int activefd = 0; nfds = fdCount; /* Optimization: when there's only one fd to choose from it must have been the one that delivered the sigio, right? */ if (nfds == 1) { ! Log1(1, "Notify single fd=%d\n", pollTable[0].fd); ! resched |= asyncEventNotify(fdmon[pollTable[0].fd]); } else if (nfds > 0) { ! count = (*systable[SYS_POLL].addr)((int)pollTable, nfds, 0); ! Log1(1, "Poll returns %d fds to look at\n", count); ! for (i = 0; (i < nfds) && (count>0); i++) { ! if ( ((pollTable[i].revents & (POLLIN)) != 0) || ! ((pollTable[i].revents & (POLLOUT)) != 0) ) { ! Log2(1, "Notify fd=%d on mon for revents %d \n", ! pollTable[i].fd, pollTable[i].revents); ! pollTable[i].events = (POLLIN|POLLOUT); ! resched |= asyncEventNotify(fdmon[pollTable[i].fd]); ! --count; ! } ! } } + + #endif /* And for good measure... */ /* This monitor is the default io monitor mainly used for diff -c -r src/solaris/java/green_threads/src/synch.c src/freebsd/java/green_threads/src/synch.c *** src/solaris/java/green_threads/src/synch.c Wed May 8 18:49:28 1996 --- src/freebsd/java/green_threads/src/synch.c Wed May 21 14:17:50 1997 *************** *** 21,26 **** --- 21,34 ---- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. */ /* + * + * This is used by the malloc.c I put in to implement locking... + * + * --randy + * + */ + + /* * @(#)synch.c 1.13 95/11/29 * */ *************** *** 31,41 **** * instead of solaris threads, so we need a synchronization * mechanism that works with our thread package. */ ! #include "monitor.h" ! #include "synch.h" ! #include "schedule.h" ! #include "bool.h" ! #include "sys_api.h" extern bool_t monitorsInitialized; --- 39,47 ---- * instead of solaris threads, so we need a synchronization * mechanism that works with our thread package. */ ! #include ! #include ! #include extern bool_t monitorsInitialized; *************** *** 73,91 **** * scheduling locked. */ ! _mutex_lock(mutex_t *mp) { ! sysAssert(_scheduling_lock == 0); ! if (monitorsInitialized) { monitorEnter((int) mp); } return 0; } ! _mutex_unlock(mutex_t *mp) { ! sysAssert(_scheduling_lock == 0); if (monitorsInitialized) { monitorExit((int) mp); --- 79,104 ---- * scheduling locked. */ ! pthread_mutex_lock(void *mp) { ! #if 0 ! assert(_scheduling_lock == 0); ! #else ! if (_scheduling_lock == 0) ! #endif if (monitorsInitialized) { monitorEnter((int) mp); } return 0; } ! pthread_mutex_unlock(void *mp) { ! #if 0 ! assert(_scheduling_lock == 0); ! #else ! if (_scheduling_lock == 0) ! #endif if (monitorsInitialized) { monitorExit((int) mp); *************** *** 93,136 **** return 0; } ! /* ! * SPECIAL CASE: In Solaris, malloc() calls sbrk() for more memory, ! * and both call _mutex_lock(), which we override to make them Green ! * thread-safe. But either _mutex_lock() call can thus cause monitor ! * cache expansion, which can lead to reentrant malloc calls (we try ! * to expand when entering sbrk() called from malloc()). malloc() ! * isn't reentrant, so this causes trouble. Instead, we special-case ! * sbrk() by wrapping it up in a non-cache monitor. ! */ ! sys_mon_t _sbrk_lock; ! #define SBRK_LOCK_INIT() monitorRegister(&_sbrk_lock, "Sbrk lock") ! #define SBRK_LOCK() sysMonitorEnter(&_sbrk_lock) ! #define SBRK_UNLOCK() sysMonitorExit(&_sbrk_lock) ! ! static bool_t sbrk_initialized = FALSE; ! ! void InitializeSbrk() ! { ! if (!sbrk_initialized && monitorsInitialized) { ! /* Should put this elsewhere... */ ! SBRK_LOCK_INIT(); ! sbrk_initialized = TRUE; ! } ! } ! ! void *_sbrk(int increment) ! { ! void *ret; ! extern void *_sbrk_unlocked(); ! ! if (sbrk_initialized) { ! SBRK_LOCK(); ! ret = _sbrk_unlocked(increment); ! SBRK_UNLOCK(); ! } else { ! ret = _sbrk_unlocked(increment); ! } ! ! return ret; ! } --- 106,110 ---- return 0; } ! void InitializeSbrk() {} diff -c -r src/solaris/java/green_threads/src/threads_md.c src/freebsd/java/green_threads/src/threads_md.c *** src/solaris/java/green_threads/src/threads_md.c Wed May 8 18:49:21 1996 --- src/freebsd/java/green_threads/src/threads_md.c Wed May 21 14:17:51 1997 *************** *** 206,212 **** } int ! sysThreadCreate(long stack_size, unsigned int flags, void *(*start)(void *), sys_thread_t **ptid, void * cookie) { sysAssert(cookie != 0); --- 206,212 ---- } int ! sysThreadCreate(long stack_size, uint_t flags, void *(*start)(void *), sys_thread_t **ptid, void * cookie) { sysAssert(cookie != 0); diff -c -r src/solaris/java/include/OSName_md.h src/freebsd/java/include/OSName_md.h *** src/solaris/java/include/OSName_md.h Wed May 8 18:48:44 1996 --- src/freebsd/java/include/OSName_md.h Wed May 21 14:17:51 1997 *************** *** 27,30 **** /* Define the name of the Operating System */ ! #define OSName_MD "Solaris" --- 27,30 ---- /* Define the name of the Operating System */ ! #define OSName_MD "Linux" diff -c -r src/solaris/java/include/byteorder_md.h src/freebsd/java/include/byteorder_md.h *** src/solaris/java/include/byteorder_md.h Wed May 8 18:48:50 1996 --- src/freebsd/java/include/byteorder_md.h Wed May 21 14:17:51 1997 *************** *** 32,37 **** #ifndef _SOLARIS_BYTE_MD_H_ #define _SOLARIS_BYTE_MD_H_ - #include #endif /* !_SOLARIS_BYTE_MD_H_ */ --- 32,36 ---- diff -c -r src/solaris/java/include/jmath_md.h src/freebsd/java/include/jmath_md.h *** src/solaris/java/include/jmath_md.h Wed May 8 18:48:45 1996 --- src/freebsd/java/include/jmath_md.h Wed May 21 14:17:51 1997 *************** *** 25,31 **** * */ - #include - #define DREM(a,b) fmod(a,b) ! #define IEEEREM(a,b) remainder(a,b) --- 25,29 ---- * */ #define DREM(a,b) fmod(a,b) ! #define IEEEREM(a,b) fmod(a,b) diff -c -r src/solaris/java/include/limits_md.h src/freebsd/java/include/limits_md.h *** src/solaris/java/include/limits_md.h Wed May 8 18:48:51 1996 --- src/freebsd/java/include/limits_md.h Wed May 21 14:53:39 1997 *************** *** 20,26 **** * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. */ - /* * @(#)limits_md.h 1.5 95/01/31 * --- 20,25 ---- diff -c -r src/solaris/java/include/prof_md.h src/freebsd/java/include/prof_md.h *** src/solaris/java/include/prof_md.h Wed May 8 18:48:49 1996 --- src/freebsd/java/include/prof_md.h Wed May 21 14:17:51 1997 *************** *** 32,37 **** --- 32,42 ---- #ifndef _SOLARIS_PROF_MD_H_ #define _SOLARIS_PROF_MD_H_ + #if defined(__linux__) || defined(__FreeBSD__) + #undef MARK(K) + #define MARK(K) {} + #else #include + #endif #endif /* !_SOLARIS_PROF_MD_H_ */ diff -c -r src/solaris/java/include/timeval_md.h src/freebsd/java/include/timeval_md.h *** src/solaris/java/include/timeval_md.h Wed May 8 18:48:48 1996 --- src/freebsd/java/include/timeval_md.h Wed May 21 14:17:51 1997 *************** *** 28,33 **** --- 28,35 ---- #ifndef _SOLARIS_TIMEVAL_H_ #define _SOLARIS_TIMEVAL_H_ + #include + typedef struct { long tv_sec; /* seconds */ long tv_usec; /* microseconds (NOT milliseconds) */ diff -c -r src/solaris/java/include/typedefs_md.h src/freebsd/java/include/typedefs_md.h *** src/solaris/java/include/typedefs_md.h Wed May 8 18:48:45 1996 --- src/freebsd/java/include/typedefs_md.h Wed May 21 14:17:52 1997 *************** *** 41,55 **** --- 41,64 ---- typedef unsigned long long uint64_t; #define _UINT32_T typedef unsigned long uint32_t; + typedef unsigned long uint_t; #endif + #if !(defined(__BIT_TYPES_DEFINED__) || defined(_MACHTYPES_H_)) + /* that should get Linux, at least */ #ifndef _INT64_T #define _INT64_T typedef long long int64_t; #define _INT32_T typedef long int32_t; + typedef long int_t; + #endif #endif + #if !(defined(_SSIZE_T) || defined(_SYS_TYPES_H_)) + #define _SSIZE_T + typedef int ssize_t; + #endif /* use these macros when the compiler supports the long long type */ diff -c -r src/solaris/java/java/lang/UNIXProcess.java src/freebsd/java/java/lang/UNIXProcess.java *** src/solaris/java/java/lang/UNIXProcess.java Wed May 8 18:49:31 1996 --- src/freebsd/java/java/lang/UNIXProcess.java Wed May 21 14:17:52 1997 *************** *** 88,93 **** --- 88,94 ---- p.isalive = false; subprocs.remove(new Integer(pid)); p.exit_code = exitcode; + if (false) { try { /* if there is anyone doing io to the process - wake them up*/ p.stdin_stream.close(); *************** *** 95,100 **** --- 96,102 ---- p.stderr_stream.close(); } catch (IOException e) { } + } try { /* also wake up anyone who is doing a waitFor() */ Class.forName("java.lang.UNIXProcess").notify(); diff -c -r src/solaris/java/javai/javai.c src/freebsd/java/javai/javai.c *** src/solaris/java/javai/javai.c Wed May 8 18:49:08 1996 --- src/freebsd/java/javai/javai.c Wed May 21 14:17:52 1997 *************** *** 290,295 **** --- 290,299 ---- } verifyclasses = VERIFY_REMOTE; /* we've decided this is the default */ + __asm__("push %eax; movl $0x127f,%eax; push %eax; fldcw (%esp); pop %eax; pop %eax"); + #ifdef DEBUG + InitializeExecEnv(&ee, 0); /* Call before InitializeMem() */ + #endif while (--argc > 0) if ((++argv)[0][0] == '-' && sourcefile == 0) #ifndef trace *************** *** 388,394 **** --- 392,400 ---- sourcefile = *argv; } *dargv = 0; + #ifndef DEBUG InitializeExecEnv(&ee, 0); /* Call before InitializeMem() */ + #endif if (ee.initial_stack == 0) { out_of_memory(); } diff -c -r src/solaris/java/runtime/linker_md.c src/freebsd/java/runtime/linker_md.c *** src/solaris/java/runtime/linker_md.c Wed May 8 18:49:06 1996 --- src/freebsd/java/runtime/linker_md.c Wed May 21 14:17:52 1997 *************** *** 78,87 **** /* * setup linker search paths */ ! if ((ldpath = getenv("LD_LIBRARY_PATH")) != 0) { ! if ((ldpath = strdup(ldpath)) == 0) { ! out_of_memory(); ! } } if (linkerinitialized) { return(ldpath); --- 78,88 ---- /* * setup linker search paths */ ! ldpath = getenv("LD_LIBRARY_PATH"); ! if (!ldpath) ldpath = ""; ! ldpath = strdup(ldpath); ! if (ldpath == 0) { ! out_of_memory(); } if (linkerinitialized) { return(ldpath); *************** *** 151,156 **** --- 152,158 ---- sysDynamicLink(char *sym_p) { void *f = 0; + char buf[512]; int i; /* *************** *** 161,174 **** if (!linkerinitialized) { (void)sysInitializeLinker(); } ! ! if ((f = dlsym(RTLD_NEXT, sym_p)) == 0) { ! for (i = useddlsegments; --i >= 0;) { ! if ((f = dlsym(dlsegment[i].handle, sym_p))) { ! return((long)f); ! } } } return 0; } --- 163,190 ---- if (!linkerinitialized) { (void)sysInitializeLinker(); } ! ! #ifndef __linux__ ! #ifdef __FreeBSD__ ! strcpy(buf+1, sym_p); ! buf[0] = '_'; ! sym_p = buf; ! #endif ! for (i = useddlsegments; --i >= 0;) { ! if ((f = dlsym(dlsegment[i].handle, sym_p))) { ! return((long)f); } } return 0; + #else + if ((f = dlsym(RTLD_NEXT, sym_p)) == 0) { + for (i = useddlsegments; --i >= 0;) { + if ((f = dlsym(dlsegment[i].handle, sym_p))) { + return((long)f); + } + } + } + return f; + #endif } diff -c -r src/solaris/java/runtime/memory_md.c src/freebsd/java/runtime/memory_md.c *** src/solaris/java/runtime/memory_md.c Wed May 8 18:49:03 1996 --- src/freebsd/java/runtime/memory_md.c Wed May 21 14:17:52 1997 *************** *** 63,68 **** --- 63,81 ---- #endif /* !USE_MALLOC */ + #ifdef SUNOS4 + #include + #endif + + #if defined(__linux__) + /* MAP_NORESERVE is the only option on Linux, and it is default */ + #define MAP_NORESERVE 0 + #endif + + #ifndef MAP_FAILED + #define MAP_FAILED ((caddr_t)-1) + #endif + static unsigned int memGrainSize; /* A page for Solaris */ /* *************** *** 98,108 **** * Set system-specific variables used by mem allocator */ if (memGrainSize == 0) { memGrainSize = sysconf(_SC_PAGESIZE); } #ifndef USE_MALLOC ! devZeroFD = open("/dev/zero", O_RDWR); if (devZeroFD == -1) { perror("devzero"); sysExit(0); --- 111,127 ---- * Set system-specific variables used by mem allocator */ if (memGrainSize == 0) { + #ifdef _SC_PAGESIZE memGrainSize = sysconf(_SC_PAGESIZE); + #elif defined(PAGESIZE) + memGrainSize = PAGESIZE; + #else + memGrainSize = 8192; /* should be enough */ + #endif } #ifndef USE_MALLOC ! devZeroFD = open("/dev/zero", O_RDWR,0); if (devZeroFD == -1) { perror("devzero"); sysExit(0); diff -c -r src/solaris/java/runtime/properties_md.c src/freebsd/java/runtime/properties_md.c *** src/solaris/java/runtime/properties_md.c Wed May 8 18:48:58 1996 --- src/freebsd/java/runtime/properties_md.c Wed May 21 14:17:52 1997 *************** *** 29,34 **** --- 29,35 ---- #include #include #include + #include #include #include "timeval.h" *************** *** 60,70 **** char buf[MAXPATHLEN]; /* Needs to hold cwd */ struct passwd *pwent; int uid; /* java properties */ PUTPROP(props, "java.version", RELEASE); ! PUTPROP(props, "java.vendor", "Sun Microsystems Inc."); ! PUTPROP(props, "java.vendor.url", "http://www.sun.com/"); v = getenv("JAVA_HOME"); PUTPROP(props, "java.home", v ? v : "/usr/local/java"); if (jio_snprintf(buf, MAXPATHLEN, --- 61,72 ---- char buf[MAXPATHLEN]; /* Needs to hold cwd */ struct passwd *pwent; int uid; + struct utsname un; /* java properties */ PUTPROP(props, "java.version", RELEASE); ! PUTPROP(props, "java.vendor", "Sun Microsystems Inc., ported by Randy Chapman"); ! PUTPROP(props, "java.vendor.url", "http://java.blackdown.org/java-linux.html"); v = getenv("JAVA_HOME"); PUTPROP(props, "java.home", v ? v : "/usr/local/java"); if (jio_snprintf(buf, MAXPATHLEN, *************** *** 76,84 **** PUTPROP(props, "java.class.path", v ? v : ""); /* os properties */ ! PUTPROP(props, "os.name", "Solaris"); ! PUTPROP(props, "os.version", "2.x"); ! PUTPROP(props, "os.arch", "sparc"); /* file system properties */ PUTPROP(props, "file.separator", "/"); --- 78,91 ---- PUTPROP(props, "java.class.path", v ? v : ""); /* os properties */ ! uname(&un); ! PUTPROP(props, "os.name", un.sysname); /* but see later */ ! PUTPROP(props, "os.version", un.release); ! #if defined(__i386__) ! PUTPROP(props, "os.arch", "i386"); ! #else ! PUTPROP(props, "os.arch", un.machine); ! #endif /* file system properties */ PUTPROP(props, "file.separator", "/"); *************** *** 96,102 **** /* Java compiler */ v = getenv("JAVA_COMPILER"); if (v != NULL) ! PUTPROP(props, "java.compiler", v ? v : ""); /* user defined properties, set by main */ if (user_props != 0) { --- 103,121 ---- /* Java compiler */ v = getenv("JAVA_COMPILER"); if (v != NULL) ! PUTPROP(props, "java.compiler", v); ! ! /* environmental override for awt.toolkit */ ! v = getenv("JAVA_AWT_TOOLKIT"); ! if (v != NULL) ! PUTPROP(props, "awt.toolkit", v); ! ! /* environmental override for os.name */ ! /* used for jws at least, so it can be made to think ! we are Solaris */ ! v = getenv("JAVA_OS_NAME"); ! if (v != NULL) ! PUTPROP(props, "os.name", v); /* user defined properties, set by main */ if (user_props != 0) { diff -c -r src/solaris/java/runtime/system_md.c src/freebsd/java/runtime/system_md.c *** src/solaris/java/runtime/system_md.c Wed May 8 18:49:04 1996 --- src/freebsd/java/runtime/system_md.c Wed May 21 14:17:53 1997 *************** *** 33,40 **** --- 33,42 ---- #include "timeval.h" #include "sys_api.h" + #if 0 /* Not in sys/time.h, for some reason */ int gettimeofday(struct timeval *, void *); + #endif long sysGetMilliTicks() *************** *** 65,92 **** * thread-safe (including Green thread-safe using our synch.c trick), * so we must use _r versions of those functions. In the native threads * system, _REENTRANT is defined. */ #include - #ifndef _REENTRANT - extern struct tm *gmtime_r(const time_t *, struct tm *); - extern struct tm *localtime_r(const time_t *, struct tm *); - #endif /* _REENTRANT */ struct tm * sysLocaltime(time_t *t, struct tm *tm) { ! return localtime_r(t, tm); } struct tm * sysGmtime(time_t *t, struct tm *tm) { ! return gmtime_r(t, tm); } void sysStrftime(char *buf, int buflen, char *fmt, struct tm *t) { strftime(buf, buflen, fmt, t); } --- 67,104 ---- * thread-safe (including Green thread-safe using our synch.c trick), * so we must use _r versions of those functions. In the native threads * system, _REENTRANT is defined. + * + * Unfortunately, there is no equivalent under SunOS. For now, lets just hope =) + * */ #include struct tm * sysLocaltime(time_t *t, struct tm *tm) { ! /*!*/ ! struct tm *ptm; ! ptm = localtime(t); ! *tm = *ptm; ! return tm; } struct tm * sysGmtime(time_t *t, struct tm *tm) { ! /*!*/ ! struct tm *ptm; ! ptm = gmtime(t); ! *tm = *ptm; ! return tm; } void sysStrftime(char *buf, int buflen, char *fmt, struct tm *t) { + #ifdef __FreeBSD__ + t->tm_zone=NULL; /* this field isn't used in Solaris */ + #endif strftime(buf, buflen, fmt, t); } *************** *** 134,140 **** } typedef void (*pProc)(void); ! static struct exit_proc { pProc proc; struct exit_proc *next; --- 146,152 ---- } typedef void (*pProc)(void); ! /* should be flag on memmove */ static struct exit_proc { pProc proc; struct exit_proc *next; *************** *** 171,173 **** --- 183,209 ---- { abort(); } + #if defined(SUNOS4) + void memmove(void *dest, const void *src, size_t len) + { + bcopy( src, dest, len ); + } + #endif + + /* should be flag on atoll */ + #if !defined(SOLARIS) + long long atoll(const char *data) + { + return atol(data); + } + #endif + + /* bad thing.. what is using atexit() ? */ + /* looks like javai.c uses it for exiting stuff... need a way to do this =/ */ + #if defined(SUNOS4) + void atexit(void (*function)()) + { + } + #endif + + diff -c -r src/solaris/mmedia/audio.c src/freebsd/mmedia/audio.c *** src/solaris/mmedia/audio.c Wed May 8 18:49:32 1996 --- src/freebsd/mmedia/audio.c Wed May 21 14:17:53 1997 *************** *** 50,55 **** --- 50,58 ---- switch (errno) { case ENODEV: case EACCES: + #ifdef ENXIO + case ENXIO: + #endif /* Dont bother, there is no audio device */ return -1; } diff -c -r src/solaris/net/multicast.c src/freebsd/net/multicast.c *** src/solaris/net/multicast.c Wed May 8 18:51:23 1996 --- src/freebsd/net/multicast.c Wed May 21 14:17:53 1997 *************** *** 29,35 **** --- 29,37 ---- #include #include #include + #ifdef __solaris__ #include + #endif #include #include #include diff -c -r src/solaris/net/socket.c src/freebsd/net/socket.c *** src/solaris/net/socket.c Wed May 8 18:51:25 1996 --- src/freebsd/net/socket.c Wed May 21 14:17:53 1997 *************** *** 29,42 **** --- 29,46 ---- #include #include #include + #ifdef __solaris__ #include + #endif #include #include #include #include #include #include + #ifdef __solaris__ #include + #endif #include "java_net_Socket.h" #include "java_net_SocketImpl.h" *************** *** 76,81 **** --- 80,88 ---- extern ssize_t sysRecvfromFD(Classjava_io_FileDescriptor * fdobj, char *buf, int nbytes, int flags, struct sockaddr *from, int *fromlen); + void pthread_mutex_lock(void *mp); + void pthread_mutex_unlock(void *mp); + /* * InetAddress */ *************** *** 86,92 **** --- 93,103 ---- HString *localHostName; char hostname[MAXHOSTNAMELEN+1]; + #ifdef SI_HOSTNAME if (sysinfo(SI_HOSTNAME, hostname, sizeof(hostname)) == -1) { + #else + if (gethostname(hostname, sizeof(hostname)) == -1) { + #endif strcpy(hostname, "localhost"); } return makeJavaString(hostname, strlen(hostname)); *************** *** 234,242 **** HString * java_net_InetAddress_getHostByAddr(Hjava_net_InetAddress *dummy, long addr) { ! struct hostent hent, *hp; char buf[MAXHOSTNAMELEN+1]; int h_errno = 0; /* * We are careful here to use the reentrant version of --- 245,259 ---- HString * java_net_InetAddress_getHostByAddr(Hjava_net_InetAddress *dummy, long addr) { ! #ifndef R_FUNCTIONS ! static int locker; /* becomes key for the lock */ ! #else char buf[MAXHOSTNAMELEN+1]; + struct hostent hent; + #endif + struct hostent *hp; int h_errno = 0; + HString *retval; /* * We are careful here to use the reentrant version of *************** *** 245,257 **** */ addr = htonl(addr); hp = gethostbyaddr_r((char *)&addr, sizeof(addr), AF_INET, &hent, buf, sizeof(buf), &h_errno); if (hp == NULL) { SignalError(0, JAVANETPKG "UnknownHostException", NULL); return 0; } ! return makeJavaString(hp->h_name, strlen(hp->h_name)); } --- 262,283 ---- */ addr = htonl(addr); + #ifndef R_FUNCTIONS + pthread_mutex_lock(&locker); + hp = gethostbyaddr((char*)&addr, sizeof(addr), AF_INET); + #else hp = gethostbyaddr_r((char *)&addr, sizeof(addr), AF_INET, &hent, buf, sizeof(buf), &h_errno); + #endif if (hp == NULL) { SignalError(0, JAVANETPKG "UnknownHostException", NULL); return 0; } ! retval = makeJavaString(hp->h_name, strlen(hp->h_name)); ! #ifndef R_FUNCTIONS ! pthread_mutex_unlock(&locker); ! #endif ! return retval; } *************** *** 311,316 **** --- 337,345 ---- if (ee && exceptionOccurred(ee)) { return; } + #ifndef EPROTO + #define EPROTO (ELAST + 2) + #endif if (errno == EPROTO) { SignalError(0, JAVANETPKG "ProtocolException", strerror(errno)); } else { diff -c -r src/solaris/sun/awt_Choice.c src/freebsd/sun/awt_Choice.c *** src/solaris/sun/awt_Choice.c Wed May 8 18:50:42 1996 --- src/freebsd/sun/awt_Choice.c Wed May 21 14:17:53 1997 *************** *** 182,190 **** AWT_UNLOCK(); return; } ! XtVaSetValues(odata->comp.widget, ! XmNmenuHistory, odata->items[index], ! NULL); AWT_UNLOCK(); } --- 182,193 ---- AWT_UNLOCK(); return; } ! if (odata->items) { ! XtVaSetValues(odata->comp.widget, ! XmNmenuHistory, odata->items[index], ! NULL); ! } ! AWT_UNLOCK(); } diff -c -r src/solaris/sun/awt_Component.c src/freebsd/sun/awt_Component.c *** src/solaris/sun/awt_Component.c Wed May 8 18:50:29 1996 --- src/freebsd/sun/awt_Component.c Wed May 21 14:17:54 1997 *************** *** 108,114 **** struct Hjava_awt_Event *event) { Classjava_awt_Event *eventPtr; ! extern void awt_modify_Event(XEvent *xev, struct Hjava_awt_Event *jev); if (event == NULL) { return 0; --- 108,114 ---- struct Hjava_awt_Event *event) { Classjava_awt_Event *eventPtr; ! extern int awt_modify_Event(XEvent *xev, struct Hjava_awt_Event *jev); if (event == NULL) { return 0; *************** *** 118,125 **** AWT_LOCK(); eventPtr = unhand(event); if (eventPtr->data != 0) { ! awt_modify_Event((XEvent *)eventPtr->data, event); ! XtDispatchEvent((XEvent *)eventPtr->data); sysFree((void *)eventPtr->data); eventPtr->data = 0; AWT_UNLOCK(); --- 118,126 ---- AWT_LOCK(); eventPtr = unhand(event); if (eventPtr->data != 0) { ! /* this way awt_modify_Event can ask for an event to be lost */ ! if (awt_modify_Event((XEvent *)eventPtr->data, event)) ! XtDispatchEvent((XEvent *)eventPtr->data); sysFree((void *)eventPtr->data); eventPtr->data = 0; AWT_UNLOCK(); diff -c -r src/solaris/sun/awt_Frame.c src/freebsd/sun/awt_Frame.c *** src/solaris/sun/awt_Frame.c Wed May 8 18:50:34 1996 --- src/freebsd/sun/awt_Frame.c Wed May 21 14:17:54 1997 *************** *** 83,88 **** --- 83,90 ---- struct Hsun_awt_motif_MFramePeer *this = (struct Hsun_awt_motif_MFramePeer *)client_data; struct FrameData *wdata; + if (unhand(this) == 0) + return; wdata = PDATA(FrameData,this); if (wdata == 0) diff -c -r src/solaris/sun/awt_Graphics.c src/freebsd/sun/awt_Graphics.c *** src/solaris/sun/awt_Graphics.c Wed May 8 18:50:33 1996 --- src/freebsd/sun/awt_Graphics.c Wed May 21 14:17:54 1997 *************** *** 413,419 **** TY(this,y), (XChar2b*)data, length); ! rval = XTextWidth16(fdata->xfont, (XChar2b*)data, length); AWT_FLUSH_UNLOCK(); return rval; --- 413,419 ---- TY(this,y), (XChar2b*)data, length); ! rval = J_XTextWidth16(fdata->xfont, (XChar2b*)data, length); AWT_FLUSH_UNLOCK(); return rval; *************** *** 503,509 **** length); /* xxx this needs to be fixed for LE machines */ ! rval = XTextWidth16(fdata->xfont, (XChar2b*)data, length); AWT_FLUSH_UNLOCK(); return rval; --- 503,509 ---- length); /* xxx this needs to be fixed for LE machines */ ! rval = J_XTextWidth16(fdata->xfont, (XChar2b*)data, length); AWT_FLUSH_UNLOCK(); return rval; diff -c -r src/solaris/sun/awt_MToolkit.c src/freebsd/sun/awt_MToolkit.c *** src/solaris/sun/awt_MToolkit.c Wed May 8 18:50:52 1996 --- src/freebsd/sun/awt_MToolkit.c Wed May 21 14:17:54 1997 *************** *** 28,34 **** #include "color.h" #include "canvas.h" #include "interpreter.h" - #include #include #include "sun_awt_motif_MToolkit.h" #include "sun_awt_motif_InputThread.h" --- 28,33 ---- diff -c -r src/solaris/sun/awt_Menu.c src/freebsd/sun/awt_Menu.c *** src/solaris/sun/awt_Menu.c Wed May 8 18:50:39 1996 --- src/freebsd/sun/awt_Menu.c Wed May 21 14:17:54 1997 *************** *** 165,172 **** return; } XtUnmanageChild(mdata->comp.widget); ! XtDestroyWidget(mdata->itemData.comp.widget); XtDestroyWidget(mdata->comp.widget); sysFree((void *)mdata); AWT_UNLOCK(); } --- 165,173 ---- return; } XtUnmanageChild(mdata->comp.widget); ! /* these two destroys need to be in this order because of interdependencies -- RC */ XtDestroyWidget(mdata->comp.widget); + XtDestroyWidget(mdata->itemData.comp.widget); sysFree((void *)mdata); AWT_UNLOCK(); } diff -c -r src/solaris/sun/awt_TextField.c src/freebsd/sun/awt_TextField.c *** src/solaris/sun/awt_TextField.c Wed May 8 18:50:44 1996 --- src/freebsd/sun/awt_TextField.c Wed May 21 14:17:54 1997 *************** *** 235,241 **** /* modify the output to be the echo character */ for (len = 0; len < cbs->text->length; len++) { ! cbs->text->ptr[len] = (char)c; } } --- 235,241 ---- /* modify the output to be the echo character */ for (len = 0; len < cbs->text->length; len++) { ! cbs->text->ptr[len] = (char)(unsigned long)c; } } *************** *** 284,290 **** XmNvalue, cval, NULL); XtAddCallback(cdata->widget, XmNmodifyVerifyCallback, ! (XtCallbackProc)echoChar, (XtPointer)c); XtVaSetValues(cdata->widget, XmNuserData, (XtPointer)dp, NULL); --- 284,290 ---- XmNvalue, cval, NULL); XtAddCallback(cdata->widget, XmNmodifyVerifyCallback, ! (XtCallbackProc)echoChar, (XtPointer)(unsigned long)c); XtVaSetValues(cdata->widget, XmNuserData, (XtPointer)dp, NULL); diff -c -r src/solaris/sun/awt_Window.c src/freebsd/sun/awt_Window.c *** src/solaris/sun/awt_Window.c Wed May 8 18:51:02 1996 --- src/freebsd/sun/awt_Window.c Wed May 21 14:17:55 1997 *************** *** 280,292 **** } aw = w - (wdata->left + wdata->right); ! if (aw < 0) { aw = 0; } ah = h + hoffset - (wdata->top + wdata->bottom); ! if (ah < 0) { ah = 0; } XtUnmanageChild(wdata->mainWindow); --- 280,292 ---- } aw = w - (wdata->left + wdata->right); ! if (((signed int)aw) < 0) { aw = 0; } ah = h + hoffset - (wdata->top + wdata->bottom); ! if (((signed int)ah) < 0) { ah = 0; } XtUnmanageChild(wdata->mainWindow); diff -c -r src/solaris/sun/canvas.c src/freebsd/sun/canvas.c *** src/solaris/sun/canvas.c Wed May 8 18:50:46 1996 --- src/freebsd/sun/canvas.c Wed May 21 14:17:55 1997 *************** *** 190,196 **** } #ifdef NEW_EVENT_MODEL ! void awt_modify_Event(XEvent *xevent, Hjava_awt_Event *jevent) { Classjava_awt_Event *jevent_ptr = unhand(jevent); --- 190,196 ---- } #ifdef NEW_EVENT_MODEL ! int awt_modify_Event(XEvent *xevent, Hjava_awt_Event *jevent) { Classjava_awt_Event *jevent_ptr = unhand(jevent); *************** *** 283,291 **** --- 283,295 ---- keysym = 0; } } + #if 1 if (keysym != 0) { xevent->xkey.keycode = XKeysymToKeycode(awt_display,keysym); + if (!xevent->xkey.keycode) + return 0; /* lose the event */ } + #endif } if (keysym >= 'A' && keysym <= 'Z') { xevent->xkey.state |= ShiftMask; *************** *** 312,317 **** --- 316,323 ---- if (jevent_ptr->modifiers & java_awt_Event_ALT_MASK) { xevent->xkey.state |= awt_AltMask; } + + return 1; /* go on */ } #endif /* NEW_EVENT_MODEL */ *************** *** 348,353 **** --- 354,360 ---- buf[len - 1] = '\0'; if (keysym < 256) { + #if 1 if ((event->xkey.state & ControlMask)) { switch (keysym) { case '[': *************** *** 363,368 **** --- 370,376 ---- break; } } + #endif JAVA_UPCALL((EE(), (void *)client_data, javaMethod,"(JIIIII)V", *************** *** 622,632 **** (void *)client_data, "handleMouseDown","(JIIIIIII)V", int2ll(event->xbutton.time), - #ifdef KEYBOARD_ONLY_EVENTS - (long)0, - #else (passEvent==TRUE) ? (long)awt_copyXEvent(event) : (long)0, - #endif event->xbutton.x, event->xbutton.y, event->xbutton.x_root, --- 630,636 ---- *************** *** 640,650 **** (void *)client_data, "handleMouseUp","(JIIIIII)V", int2ll(event->xbutton.time), - #ifdef KEYBOARD_ONLY_EVENTS - (long)0, - #else (passEvent==TRUE) ? (long)awt_copyXEvent(event) : (long)0, - #endif event->xbutton.x, event->xbutton.y, event->xbutton.x_root, --- 644,650 ---- *************** *** 661,671 **** (void *)client_data, "handleMouseDrag","(JIIIIII)V", int2ll(event->xmotion.time), - #ifdef KEYBOARD_ONLY_EVENTS - (long)0, - #else (passEvent==TRUE) ? (long)awt_copyXEvent(event) : (long)0, - #endif event->xmotion.x, event->xmotion.y, event->xmotion.x_root, --- 661,667 ---- *************** *** 676,686 **** (void *)client_data, "handleMouseMoved","(JIIIIII)V", int2ll(event->xmotion.time), - #ifdef KEYBOARD_ONLY_EVENTS - (long)0, - #else (passEvent==TRUE) ? (long)awt_copyXEvent(event) : (long)0, - #endif event->xmotion.x, event->xmotion.y, event->xmotion.x_root, --- 672,678 ---- diff -c -r src/solaris/sun/color.c src/freebsd/sun/color.c *** src/solaris/sun/color.c Wed May 8 18:50:51 1996 --- src/freebsd/sun/color.c Wed May 21 14:17:55 1997 *************** *** 41,47 **** #define CLIP(val,min,max) ((val < min) ? min : ((val > max) ? max : val)) ! #define COMPOSE24(I, r, g, b) \ ((((b) & 0xff) << ((I)->clrdata.bOff)) | \ (((g) & 0xff) << ((I)->clrdata.gOff)) | \ (((r) & 0xff) << ((I)->clrdata.rOff))) --- 41,47 ---- #define CLIP(val,min,max) ((val < min) ? min : ((val > max) ? max : val)) ! #define COMPOSETC(I, r, g, b) \ ((((b) & 0xff) << ((I)->clrdata.bOff)) | \ (((g) & 0xff) << ((I)->clrdata.gOff)) | \ (((r) & 0xff) << ((I)->clrdata.rOff))) *************** *** 64,70 **** int (*AwtColorMatch)(int, int, int); int awt_color_match(int, int, int); ! int awt_color_match24(int, int, int); int awt_color_matchGS(int, int, int); ImgConvertFcn DirectImageConvert; --- 64,70 ---- int (*AwtColorMatch)(int, int, int); int awt_color_match(int, int, int); ! int awt_color_matchTC(int, int, int); int awt_color_matchGS(int, int, int); ImgConvertFcn DirectImageConvert; *************** *** 88,97 **** { 0, 8, 0, 0, 0 } }; ! awtImageData awtImage24 = { ! 24, { 0 }, ! { 0, 32, 0, 8, 16 } }; awtImageData awtImageGS = { --- 88,97 ---- { 0, 8, 0, 0, 0 } }; ! awtImageData awtImageTC = { ! -1, /* depth, must read and change */ { 0 }, ! { 0, -1, 0, 8, 16 } /* must change the -1 -- bitsperpixel */ }; awtImageData awtImageGS = { *************** *** 108,119 **** * Find the best color. */ int ! awt_color_match24(int r, int g, int b) { ! r = CLIP(r, 0, 255); ! g = CLIP(g, 0, 255); ! b = CLIP(b, 0, 255); ! return COMPOSE24(awtImage, r, g, b); } int --- 108,119 ---- * Find the best color. */ int ! awt_color_matchTC(int r, int g, int b) { ! r = (r&255) >> awtImage->clrdata.rScale; ! g = (g&255) >> awtImage->clrdata.gScale; ! b = (b&255) >> awtImage->clrdata.bScale; ! return COMPOSETC(awtImage, r, g, b); } int *************** *** 255,287 **** awt_fill_imgcv(awtImageGS.convert, 0, 0, PseudoImageConvert); awt_fill_imgcv(awtImageGS.convert, IMGCV_ORDERBITS, IMGCV_TDLRORDER, PseudoFSImageConvert); ! awt_fill_imgcv(awtImage24.convert, 0, 0, DirectImageConvert); ! awt_fill_imgcv(awtImage24.convert, (IMGCV_SCALEBITS | IMGCV_INSIZEBITS | IMGCV_ALPHABITS | IMGCV_CMBITS), (IMGCV_UNSCALED | IMGCV_BYTEIN | IMGCV_OPAQUE | IMGCV_ICM), DirectIcmOpqUnsImageConvert); ! awt_fill_imgcv(awtImage24.convert, (IMGCV_SCALEBITS | IMGCV_INSIZEBITS | IMGCV_ALPHABITS | IMGCV_CMBITS), (IMGCV_UNSCALED | IMGCV_BYTEIN | IMGCV_ALPHA | IMGCV_ICM), DirectIcmTrnUnsImageConvert); ! awt_fill_imgcv(awtImage24.convert, (IMGCV_SCALEBITS | IMGCV_INSIZEBITS | IMGCV_ALPHABITS | IMGCV_CMBITS), (IMGCV_SCALED | IMGCV_BYTEIN | IMGCV_OPAQUE | IMGCV_ICM), DirectIcmOpqSclImageConvert); ! awt_fill_imgcv(awtImage24.convert, (IMGCV_SCALEBITS | IMGCV_INSIZEBITS | IMGCV_ALPHABITS | IMGCV_CMBITS), (IMGCV_UNSCALED | IMGCV_INTIN | IMGCV_OPAQUE | IMGCV_DCM8), DirectDcmOpqUnsImageConvert); ! awt_fill_imgcv(awtImage24.convert, (IMGCV_SCALEBITS | IMGCV_INSIZEBITS | IMGCV_ALPHABITS | IMGCV_CMBITS), (IMGCV_UNSCALED | IMGCV_INTIN | IMGCV_ALPHA | IMGCV_DCM8), DirectDcmTrnUnsImageConvert); ! awt_fill_imgcv(awtImage24.convert, (IMGCV_SCALEBITS | IMGCV_INSIZEBITS | IMGCV_ALPHABITS | IMGCV_CMBITS), (IMGCV_SCALED | IMGCV_INTIN | IMGCV_OPAQUE | IMGCV_DCM8), --- 255,287 ---- awt_fill_imgcv(awtImageGS.convert, 0, 0, PseudoImageConvert); awt_fill_imgcv(awtImageGS.convert, IMGCV_ORDERBITS, IMGCV_TDLRORDER, PseudoFSImageConvert); ! awt_fill_imgcv(awtImageTC.convert, 0, 0, DirectImageConvert); ! awt_fill_imgcv(awtImageTC.convert, (IMGCV_SCALEBITS | IMGCV_INSIZEBITS | IMGCV_ALPHABITS | IMGCV_CMBITS), (IMGCV_UNSCALED | IMGCV_BYTEIN | IMGCV_OPAQUE | IMGCV_ICM), DirectIcmOpqUnsImageConvert); ! awt_fill_imgcv(awtImageTC.convert, (IMGCV_SCALEBITS | IMGCV_INSIZEBITS | IMGCV_ALPHABITS | IMGCV_CMBITS), (IMGCV_UNSCALED | IMGCV_BYTEIN | IMGCV_ALPHA | IMGCV_ICM), DirectIcmTrnUnsImageConvert); ! awt_fill_imgcv(awtImageTC.convert, (IMGCV_SCALEBITS | IMGCV_INSIZEBITS | IMGCV_ALPHABITS | IMGCV_CMBITS), (IMGCV_SCALED | IMGCV_BYTEIN | IMGCV_OPAQUE | IMGCV_ICM), DirectIcmOpqSclImageConvert); ! awt_fill_imgcv(awtImageTC.convert, (IMGCV_SCALEBITS | IMGCV_INSIZEBITS | IMGCV_ALPHABITS | IMGCV_CMBITS), (IMGCV_UNSCALED | IMGCV_INTIN | IMGCV_OPAQUE | IMGCV_DCM8), DirectDcmOpqUnsImageConvert); ! awt_fill_imgcv(awtImageTC.convert, (IMGCV_SCALEBITS | IMGCV_INSIZEBITS | IMGCV_ALPHABITS | IMGCV_CMBITS), (IMGCV_UNSCALED | IMGCV_INTIN | IMGCV_ALPHA | IMGCV_DCM8), DirectDcmTrnUnsImageConvert); ! awt_fill_imgcv(awtImageTC.convert, (IMGCV_SCALEBITS | IMGCV_INSIZEBITS | IMGCV_ALPHABITS | IMGCV_CMBITS), (IMGCV_SCALED | IMGCV_INTIN | IMGCV_OPAQUE | IMGCV_DCM8), *************** *** 302,325 **** pVI = &awt_visInfo; awt_num_colors = awt_visInfo.colormap_size; ! if (depth == 24) { ! awtImage = &awtImage24; ! AwtColorMatch = awt_color_match24; awtImage->clrdata.rOff = 0; for (i = pVI->red_mask; (i & 1) == 0; i >>= 1) { awtImage->clrdata.rOff++; } ! awtImage->clrdata.rScale = 0; awtImage->clrdata.gOff = 0; for (i = pVI->green_mask; (i & 1) == 0; i >>= 1) { awtImage->clrdata.gOff++; } ! awtImage->clrdata.gScale = 0; awtImage->clrdata.bOff = 0; for (i = pVI->blue_mask; (i & 1) == 0; i >>= 1) { awtImage->clrdata.bOff++; } ! awtImage->clrdata.bScale = 0; } else if (pVI->class == StaticGray || pVI->class == GrayScale || (forcegray && depth <= 8)) { awtImage = &awtImageGS; --- 302,354 ---- pVI = &awt_visInfo; awt_num_colors = awt_visInfo.colormap_size; ! if (depth > 8) { ! int size; ! awtImage = &awtImageTC; ! awtImage->Depth = depth; ! awtImage->clrdata.bitsperpixel = depth; /*! is this right? --rc */ ! #ifdef DEBUG ! fprintf(stderr, "RC: color depth: %d\n", depth); ! #endif ! AwtColorMatch = awt_color_matchTC; awtImage->clrdata.rOff = 0; for (i = pVI->red_mask; (i & 1) == 0; i >>= 1) { awtImage->clrdata.rOff++; } ! size = 0; ! for (; i; i >>= 1) { ! size++; ! } ! awtImage->clrdata.rScale = 8-size; ! #ifdef DEBUG ! fprintf(stderr, "RC: rOff: %d, rScale: %d\n", awtImage->clrdata.rOff, awtImage->clrdata.rScale); ! #endif ! awtImage->clrdata.gOff = 0; for (i = pVI->green_mask; (i & 1) == 0; i >>= 1) { awtImage->clrdata.gOff++; } ! size = 0; ! for (; i; i >>= 1) { ! size++; ! } ! awtImage->clrdata.gScale = 8-size; ! #ifdef DEBUG ! fprintf(stderr, "RC: gOff: %d, gScale: %d\n", awtImage->clrdata.gOff, awtImage->clrdata.gScale); ! #endif ! awtImage->clrdata.bOff = 0; for (i = pVI->blue_mask; (i & 1) == 0; i >>= 1) { awtImage->clrdata.bOff++; } ! size = 0; ! for (; i; i >>= 1) { ! size++; ! } ! awtImage->clrdata.bScale = 8-size; ! #ifdef DEBUG ! fprintf(stderr, "RC: bOff: %d, bScale: %d\n", awtImage->clrdata.bOff, awtImage->clrdata.bScale); ! #endif } else if (pVI->class == StaticGray || pVI->class == GrayScale || (forcegray && depth <= 8)) { awtImage = &awtImageGS; *************** *** 342,348 **** XFree(pPFV); } ! if (depth == 24) { return 1; } --- 371,377 ---- XFree(pPFV); } ! if (depth > 8) { return 1; } diff -c -r src/solaris/sun/image.c src/freebsd/sun/image.c *** src/solaris/sun/image.c Wed May 8 18:50:49 1996 --- src/freebsd/sun/image.c Wed May 21 14:17:55 1997 *************** *** 116,122 **** * DEBUG builds, the developer will have to turn it on manually if * they are compiling and running on Solaris 2.4 or later. */ ! #undef CVFUNCTRACKING #endif #ifdef CVFUNCTRACKING --- 116,125 ---- * DEBUG builds, the developer will have to turn it on manually if * they are compiling and running on Solaris 2.4 or later. */ ! /* Linux doesn't have this function, either, so what I do is write out ! * the address of it... nm can then tell me where that is. ! */ ! #define CVFUNCTRACKING #endif #ifdef CVFUNCTRACKING *************** *** 298,304 **** if (w >= 0 && h >= 0 && (ird->bufwidth < w || ird->bufheight < h)) { image_FreeBufs(ird); ! bpp = (ird->depth > 8) ? 32 : 8; slp = awtImage->wsImageFormat.scanline_pad; bpsl = ((w * bpp + slp - 1) & (~ (slp - 1))) >> 3; bufsize = bpsl * h; --- 301,307 ---- if (w >= 0 && h >= 0 && (ird->bufwidth < w || ird->bufheight < h)) { image_FreeBufs(ird); ! bpp = (ird->depth > 8) ? ((ird->depth == 16) ? 16 : 32) : 8; slp = awtImage->wsImageFormat.scanline_pad; bpsl = ((w * bpp + slp - 1) & (~ (slp - 1))) >> 3; bufsize = bpsl * h; *************** *** 551,556 **** --- 554,564 ---- cvfcn = awtImage->convert[flags]; #ifdef CVFUNCTRACKING if (flags != prevflags && cvfcn != prevfunc && getenv("IMGCV_VERBOSE")) { + #if defined(__linux__) || defined(__FreeBSD__) + prevflags = flags; + prevfunc = cvfcn; + fprintf(stderr, "now using %X for conversion\n", (unsigned long)cvfcn); + #else Dl_info dlinfo; prevflags = flags; prevfunc = cvfcn; *************** *** 558,563 **** --- 566,572 ---- if (ret) { fprintf(stderr, "now using %s for conversion\n", dlinfo.dli_sname); } + #endif } #endif ret = cvfcn(cmh, x, y, w, h, *************** *** 635,640 **** --- 644,654 ---- cvfcn = awtImage->convert[flags]; #ifdef CVFUNCTRACKING if (flags != prevflags && cvfcn != prevfunc && getenv("IMGCV_VERBOSE")) { + #if defined(__linux__) || defined(__FreeBSD__) + prevflags = flags; + prevfunc = cvfcn; + fprintf(stderr, "now using %X for conversion\n", (unsigned long)cvfcn); + #else Dl_info dlinfo; prevflags = flags; prevfunc = cvfcn; *************** *** 642,647 **** --- 656,662 ---- if (ret) { fprintf(stderr, "now using %s for conversion\n", dlinfo.dli_sname); } + #endif } #endif ret = cvfcn(cmh, x, y, w, h, *************** *** 953,962 **** if (d > 8) { pixh = (HObject *) ArrayAlloc(T_INT, w); buf = (char *) unhand(pixh); xim = XCreateImage(awt_display, awt_visual, awtImage->Depth, ZPixmap, 0, buf, ! w, 1, 32, 0); ! xim->bits_per_pixel = 32; } else { /* XGetSubImage takes care of expanding to 8 bit if necessary. */ /* But, that is not a supported feature. There are better ways */ --- 968,977 ---- if (d > 8) { pixh = (HObject *) ArrayAlloc(T_INT, w); buf = (char *) unhand(pixh); + xim->bits_per_pixel = (d == 16) ? 16 : 32; xim = XCreateImage(awt_display, awt_visual, awtImage->Depth, ZPixmap, 0, buf, ! w, 1, xim->bits_per_pixel, 0); } else { /* XGetSubImage takes care of expanding to 8 bit if necessary. */ /* But, that is not a supported feature. There are better ways */ diff -c -r src/solaris/sun/img_cvdirDcmOpqScl.c src/freebsd/sun/img_cvdirDcmOpqScl.c *** src/solaris/sun/img_cvdirDcmOpqScl.c Wed May 8 18:51:10 1996 --- src/freebsd/sun/img_cvdirDcmOpqScl.c Wed May 21 14:17:55 1997 *************** *** 32,39 **** #include "img_input32.h" #include "img_dcm8.h" #include "img_opaque.h" ! #include "img_dir8dither.h" ! #include "img_output32.h" #define NAME DirectDcmOpqSclImageConvert --- 32,40 ---- #include "img_input32.h" #include "img_dcm8.h" #include "img_opaque.h" ! /*#include "img_dir8dither.h"*/ ! #include "img_dirdither.h" ! #include "img_output8_16_32.h" #define NAME DirectDcmOpqSclImageConvert diff -c -r src/solaris/sun/img_cvdirDcmOpqUns.c src/freebsd/sun/img_cvdirDcmOpqUns.c *** src/solaris/sun/img_cvdirDcmOpqUns.c Wed May 8 18:51:09 1996 --- src/freebsd/sun/img_cvdirDcmOpqUns.c Wed May 21 14:17:56 1997 *************** *** 32,39 **** #include "img_input32.h" #include "img_dcm8.h" #include "img_opaque.h" ! #include "img_dir8dither.h" ! #include "img_output32.h" #define NAME DirectDcmOpqUnsImageConvert --- 32,40 ---- #include "img_input32.h" #include "img_dcm8.h" #include "img_opaque.h" ! /*#include "img_dir8dither.h"*/ ! #include "img_dirdither.h" ! #include "img_output8_16_32.h" #define NAME DirectDcmOpqUnsImageConvert diff -c -r src/solaris/sun/img_cvdirDcmTrnUns.c src/freebsd/sun/img_cvdirDcmTrnUns.c *** src/solaris/sun/img_cvdirDcmTrnUns.c Wed May 8 18:51:11 1996 --- src/freebsd/sun/img_cvdirDcmTrnUns.c Wed May 21 14:17:56 1997 *************** *** 32,39 **** #include "img_input32.h" #include "img_dcm8.h" #include "img_alpha.h" ! #include "img_dir8dither.h" ! #include "img_output32.h" #define NAME DirectDcmTrnUnsImageConvert --- 32,40 ---- #include "img_input32.h" #include "img_dcm8.h" #include "img_alpha.h" ! /*#include "img_dir8dither.h"*/ ! #include "img_dirdither.h" ! #include "img_output8_16_32.h" #define NAME DirectDcmTrnUnsImageConvert diff -c -r src/solaris/sun/img_cvdirIcmOpqScl.c src/freebsd/sun/img_cvdirIcmOpqScl.c *** src/solaris/sun/img_cvdirIcmOpqScl.c Wed May 8 18:51:15 1996 --- src/freebsd/sun/img_cvdirIcmOpqScl.c Wed May 21 14:17:56 1997 *************** *** 32,39 **** #include "img_input8.h" #include "img_icm.h" #include "img_opaque.h" ! #include "img_dir8dither.h" ! #include "img_output32.h" #define NAME DirectIcmOpqSclImageConvert --- 32,40 ---- #include "img_input8.h" #include "img_icm.h" #include "img_opaque.h" ! /*#include "img_dir8dither.h"*/ ! #include "img_dirdither.h" ! #include "img_output8_16_32.h" #define NAME DirectIcmOpqSclImageConvert diff -c -r src/solaris/sun/img_cvdirIcmOpqUns.c src/freebsd/sun/img_cvdirIcmOpqUns.c *** src/solaris/sun/img_cvdirIcmOpqUns.c Wed May 8 18:51:14 1996 --- src/freebsd/sun/img_cvdirIcmOpqUns.c Wed May 21 14:17:56 1997 *************** *** 32,39 **** #include "img_input8.h" #include "img_icm.h" #include "img_opaque.h" ! #include "img_dir8dither.h" ! #include "img_output32.h" #define NAME DirectIcmOpqUnsImageConvert --- 32,40 ---- #include "img_input8.h" #include "img_icm.h" #include "img_opaque.h" ! /*#include "img_dir8dither.h"*/ ! #include "img_dirdither.h" ! #include "img_output8_16_32.h" #define NAME DirectIcmOpqUnsImageConvert diff -c -r src/solaris/sun/img_cvdirIcmTrnUns.c src/freebsd/sun/img_cvdirIcmTrnUns.c *** src/solaris/sun/img_cvdirIcmTrnUns.c Wed May 8 18:51:16 1996 --- src/freebsd/sun/img_cvdirIcmTrnUns.c Wed May 21 14:17:56 1997 *************** *** 32,39 **** #include "img_input8.h" #include "img_icm.h" #include "img_alpha.h" ! #include "img_dir8dither.h" ! #include "img_output32.h" #define NAME DirectIcmTrnUnsImageConvert --- 32,40 ---- #include "img_input8.h" #include "img_icm.h" #include "img_alpha.h" ! /*#include "img_dir8dither.h"*/ ! #include "img_dirdither.h" ! #include "img_output8_16_32.h" #define NAME DirectIcmTrnUnsImageConvert diff -c -r src/solaris/sun/img_cvdirdefault.c src/freebsd/sun/img_cvdirdefault.c *** src/solaris/sun/img_cvdirdefault.c Wed May 8 18:51:13 1996 --- src/freebsd/sun/img_cvdirdefault.c Wed May 21 14:17:56 1997 *************** *** 33,39 **** #include "img_anycm.h" #include "img_alpha.h" #include "img_dirdither.h" ! #include "img_output32.h" #define NAME DirectImageConvert --- 33,39 ---- #include "img_anycm.h" #include "img_alpha.h" #include "img_dirdither.h" ! #include "img_output8_16_32.h" #define NAME DirectImageConvert diff -c -r src/solaris/sun/tiny_Graphics.c src/freebsd/sun/tiny_Graphics.c *** src/solaris/sun/tiny_Graphics.c Wed May 8 18:31:38 1996 --- src/freebsd/sun/tiny_Graphics.c Wed May 21 14:17:56 1997 *************** *** 238,244 **** length = 1024; } ! XDrawString16(awt_display, win, gc, TX(this, x), TY(this, y), (XChar2b *)dataptr, length); AWT_UNLOCK(); } --- 238,244 ---- length = 1024; } ! J_XDrawString16(awt_display, win, gc, TX(this, x), TY(this, y), (XChar2b *)dataptr, length); AWT_UNLOCK(); } *************** *** 271,277 **** if (len > 1024) { len = 1024; } ! XDrawString16(awt_display, win, gc, TX(this,x), TY(this,y), (XChar2b*)dataptr + off, len); AWT_UNLOCK(); } --- 271,277 ---- if (len > 1024) { len = 1024; } ! J_XDrawString16(awt_display, win, gc, TX(this,x), TY(this,y), (XChar2b*)dataptr + off, len); AWT_UNLOCK(); } diff -c -r src/solaris/sun/tiny_Toolkit.c src/freebsd/sun/tiny_Toolkit.c *** src/solaris/sun/tiny_Toolkit.c Wed May 8 18:51:08 1996 --- src/freebsd/sun/tiny_Toolkit.c Wed May 21 14:17:56 1997 *************** *** 28,34 **** #include #include - #include "thread.h" #include "tiny.h" #include "java_awt_Event.h" #include "sun_awt_tiny_TinyToolkit.h" --- 28,33 ---- *************** *** 702,708 **** new_y, winattr.width, winattr.height)); ! XFree(winattr); break; default: --- 701,707 ---- new_y, winattr.width, winattr.height)); ! /*XFree(winattr);*/ break; default: *** /dev/null Wed May 21 15:25:25 1997 --- src/freebsd/java/green_threads/include/locks_md.h Wed May 21 14:17:57 1997 *************** *** 0 **** --- 1,12 ---- + + #ifndef _LOCKS_MD_H + #define _LOCKS_MD_H + + #define __libc_lock_lock(NAME) \ + pthread_mutex_lock (NAME) + + #define __libc_lock_unlock(NAME) \ + pthread_mutex_unlock (NAME) + + #endif /* !_LOCKS_MD_H */ + *** /dev/null Wed May 21 15:25:25 1997 --- src/freebsd/java/green_threads/src/malloc.c Wed May 21 14:17:57 1997 *************** *** 0 **** --- 1,205 ---- + + #undef VMEMDEBUG + + #include + #include + #include + #include + + int malloc_init; + void __libc_free(void*); + void *__libc_malloc(size_t); + void *__libc_calloc(size_t,size_t); + void *__libc_valloc(size_t); + void *__libc_memalign(size_t,size_t); + void *__libc_realloc(void *,size_t); + + #define __libc_lock_lock(NAME) pthread_mutex_lock(NAME) + #define __libc_unlock_lock(NAME) pthread_mutex_unlock(NAME) + + static int __libc_malloc_lock_fake[4]; + static void *__libc_malloc_lock = &__libc_malloc_lock_fake; + + #define LASTSIZE 4 + static void *last_freed[LASTSIZE]; + static int last_free_place=0; + + /* keep track of the lowest memory address */ + /* we will do a malloc(1) to get this initially */ + static void *firstAlloc = 0; + + #ifdef DEBUG + #define NestLevel _javamalloc_NestLevel + static int NestLevel=0; + inline void NestStart() { + if (NestLevel) { + fprintf(stderr, "OUCH: nested memory code, to %d levels.\n", NestLevel); + } + NestLevel++; + } + inline void NestEnd() { + NestLevel--; + } + #else + inline void NestStart() {} + inline void NestEnd() {} + #endif + + static int add_freed_pointer(void *ptr) + { + int i; + + for (i = LASTSIZE; i--;) { + if (last_freed[i] == ptr) { + return 0; + } + } + + last_freed[last_free_place++] = ptr; + if (last_free_place >= LASTSIZE) last_free_place = 0; + + return 1; + } + + static void remove_freed_pointer(void *ptr) + { + int i; + + for (i = LASTSIZE; i--;) { + if (last_freed[i] == ptr) { + last_freed[i] = 0; + return; + } + } + } + + void + free (void *ptr) + { + if (ptr == NULL) return; + + #if defined(__i386__) && defined(linux) + /* UGLY HACK */ + /* something in X or Motif is freeing memory in the code block */ + /* this should trap that... */ + if ((ptr >= (void*)0x40000000 && ptr <= (void*)0x50000000) || (ptr < firstAlloc)) { + #ifdef DEBUG + fprintf(stderr, "RC: free: out-of-range: %X\n", ptr); + #endif + return; + } + #endif + + __libc_lock_lock(__libc_malloc_lock); + NestStart(); + + /* wimpy check against multi-free */ + if (add_freed_pointer(ptr)) { + #ifdef VMEMDEBUG + fprintf(stderr, "freeing at %lX...", ptr); + fflush(stderr); + #endif + __libc_free (ptr); + #ifdef VMEMDEBUG + fprintf(stderr, "done\n"); + #endif + } else { + #ifdef DEBUG + fprintf(stderr, "RC: free: double-freed at %lX\n", ptr); + #endif + } + NestEnd(); + __libc_lock_unlock(__libc_malloc_lock); + } + + void * + malloc (size_t size) + { + void * ret; + __libc_lock_lock(__libc_malloc_lock); + NestStart(); + + #if defined(__i386__) && defined(linux) + /* keep track of what should be the heap's base, so we know what + is a low-memory free, and can ignore it! */ + if (firstAlloc == 0) { + firstAlloc = __libc_malloc(1); + #ifdef VMEMDEBUG + fprintf(stderr, "firstAlloc: %X\n", firstAlloc); + #endif + } + #endif + + ret = __libc_malloc (size); + remove_freed_pointer(ret); + #ifdef VMEMDEBUG + fprintf(stderr, "malloced %d at %lX\n", (int)size, (long)ret); + #endif + NestEnd(); + __libc_lock_unlock(__libc_malloc_lock); + return ret; + } + + void * + valloc (size_t size) + { + void * ret; + __libc_lock_lock(__libc_malloc_lock); + NestStart(); + ret = __libc_valloc (size); + remove_freed_pointer(ret); + #ifdef VMEMDEBUG + /*fprintf(stderr, "valloced %d at %lX\n", (int)size, (long)ret);*/ + #endif + NestEnd(); + __libc_lock_unlock(__libc_malloc_lock); + return ret; + } + + void * + calloc (size_t nmemb, size_t size) + { + void * ret; + __libc_lock_lock(__libc_malloc_lock); + NestStart(); + ret = __libc_calloc (nmemb, size); + remove_freed_pointer(ret); + #ifdef VMEMDEBUG + fprintf(stderr, "calloced %d at %lX\n", (int)(nmemb*size), (long)ret); + #endif + NestEnd(); + __libc_lock_unlock(__libc_malloc_lock); + return ret; + } + + void * + memalign (size_t alignment, size_t size) + { + void * ret; + __libc_lock_lock(__libc_malloc_lock); + NestStart(); + ret = __libc_memalign (alignment, size); + remove_freed_pointer(ret); + #ifdef VMEMDEBUG + fprintf(stderr, "memaligned %d at %lX\n", (int)size, (long)ret); + #endif + NestEnd(); + __libc_lock_unlock(__libc_malloc_lock); + return ret; + } + + void * + realloc (void *ptr, size_t size) + { + void * ret; + __libc_lock_lock(__libc_malloc_lock); + NestStart(); + ret = __libc_realloc (ptr, size); + #ifdef VMEMDEBUG + fprintf(stderr, "realloced %d at %lX\n", (int)size, (long)ret); + #endif + NestEnd(); + __libc_lock_unlock(__libc_malloc_lock); + return ret; + } + *** /dev/null Wed May 21 15:25:25 1997 --- src/freebsd/sun/Text16.c Wed May 21 14:17:57 1997 *************** *** 0 **** --- 1,152 ---- + /* $XConsortium: Text16.c,v 11.25 94/04/17 20:21:17 kaleb Exp $ */ + /* + + Copyright (c) 1986 X Consortium + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + Except as contained in this notice, the name of the X Consortium shall not be + used in advertising or otherwise to promote the sale, use or other dealings + in this Software without prior written authorization from the X Consortium. + + */ + + #include "X11/Xlibint.h" + + #if NeedFunctionPrototypes + J_XDrawString16( + register Display *dpy, + Drawable d, + GC gc, + int x, + int y, + _Xconst XChar2b *string, + int length) + #else + J_XDrawString16(dpy, d, gc, x, y, string, length) + register Display *dpy; + Drawable d; + GC gc; + int x, y; + XChar2b *string; + int length; + #endif + { + int Datalength = 0; + register xPolyText16Req *req; + + if (length <= 0) + return 0; + + LockDisplay(dpy); + FlushGC(dpy, gc); + GetReq (PolyText16, req); + req->drawable = d; + req->gc = gc->gid; + req->x = x; + req->y = y; + + + Datalength += SIZEOF(xTextElt) * ((length + 253) / 254) + (length << 1); + + + req->length += (Datalength + 3)>>2; /* convert to number of 32-bit words */ + + + /* + * If the entire request does not fit into the remaining space in the + * buffer, flush the buffer first. If the request does fit into the + * empty buffer, then we won't have to flush it at the end to keep + * the buffer 32-bit aligned. + */ + + if (dpy->bufptr + Datalength > dpy->bufmax) + _XFlush (dpy); + + { + int nbytes; + int PartialNChars = length; + register xTextElt *elt; + XChar2b *CharacterOffset = (XChar2b *)string; + + while(PartialNChars > 254) + { + nbytes = 254 * 2 + SIZEOF(xTextElt); + BufAlloc (xTextElt *, elt, nbytes); + elt->delta = 0; + elt->len = 254; + { + register int i; + register unsigned char *cp; + for (i = 0, cp = ((unsigned char *)elt) + 2; i < 254; i++) { + *cp++ = CharacterOffset[i].byte2; + *cp++ = CharacterOffset[i].byte1; + } + } + PartialNChars = PartialNChars - 254; + CharacterOffset += 254; + } + + if (PartialNChars) + { + nbytes = PartialNChars * 2 + SIZEOF(xTextElt); + BufAlloc (xTextElt *, elt, nbytes); + elt->delta = 0; + elt->len = PartialNChars; + { + register int i; + register unsigned char *cp; + for (i = 0, cp = ((unsigned char *)elt) + 2; i < PartialNChars; + i++) { + *cp++ = CharacterOffset[i].byte2; + *cp++ = CharacterOffset[i].byte1; + } + } + } + } + + /* Pad request out to a 32-bit boundary */ + + if (Datalength &= 3) { + char *pad; + /* + * BufAlloc is a macro that uses its last argument more than + * once, otherwise I'd write "BufAlloc (char *, pad, 4-length)" + */ + length = 4 - Datalength; + BufAlloc (char *, pad, length); + /* + * if there are 3 bytes of padding, the first byte MUST be 0 + * so the pad bytes aren't mistaken for a final xTextElt + */ + *pad = 0; + } + + /* + * If the buffer pointer is not now pointing to a 32-bit boundary, + * we must flush the buffer so that it does point to a 32-bit boundary + * at the end of this routine. + */ + + if ((dpy->bufptr - dpy->buffer) & 3) + _XFlush (dpy); + UnlockDisplay(dpy); + SyncHandle(); + return 0; + } + *** /dev/null Wed May 21 15:25:25 1997 --- src/freebsd/sun/TextExt16.c Wed May 21 14:17:57 1997 *************** *** 0 **** --- 1,171 ---- + /* $XConsortium: TextExt16.c,v 11.23 94/04/17 20:21:19 kaleb Exp $ */ + /* + + Copyright (c) 1989 X Consortium + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + Except as contained in this notice, the name of the X Consortium shall + not be used in advertising or otherwise to promote the sale, use or + other dealings in this Software without prior written authorization + from the X Consortium. + + */ + + + #include "X11/Xlibint.h" + + #define min_byte2 min_char_or_byte2 + #define max_byte2 max_char_or_byte2 + + /* + * XTextExtents16 - compute the extents of string given as a sequence of + * XChar2bs. + */ + #if NeedFunctionPrototypes + J_XTextExtents16 ( + XFontStruct *fs, + _Xconst XChar2b *string, + int nchars, + int *dir, /* RETURN font information */ + int *font_ascent, /* RETURN font information */ + int *font_descent, /* RETURN font information */ + register XCharStruct *overall) /* RETURN character information */ + #else + J_XTextExtents16 (fs, string, nchars, dir, font_ascent, font_descent, overall) + XFontStruct *fs; + XChar2b *string; + int nchars; + int *dir, *font_ascent, *font_descent; /* RETURN font information */ + register XCharStruct *overall; /* RETURN character information */ + #endif + { + int i; /* iterator */ + Bool singlerow = (fs->max_byte1 == 0); /* optimization */ + int nfound = 0; /* number of characters found */ + XCharStruct *def; /* info about default char */ + + if (singlerow) { + CI_GET_DEFAULT_INFO_1D (fs, def); + } else { + CI_GET_DEFAULT_INFO_2D (fs, def); + } + + *dir = fs->direction; + *font_ascent = fs->ascent; + *font_descent = fs->descent; + + /* + * Iterate over the input string getting the appropriate * char struct. + * The default (which may be null if there is no def_char) will be returned + * if the character doesn't exist. On the first time * through the loop, + * assign the values to overall; otherwise, compute * the new values. + */ + + for (i = 0; i < nchars; i++, string++) { + register XCharStruct *cs; + unsigned int c = (unsigned int) string->byte1; /* watch for macros */ + unsigned int r = (unsigned int) string->byte2; /* watch for macros */ + + if (singlerow) { + unsigned int ind = ((r << 8) | c); /* watch for macros */ + CI_GET_CHAR_INFO_1D (fs, ind, def, cs); + } else { + CI_GET_CHAR_INFO_2D (fs, r, c, def, cs); + } + + if (cs) { + if (nfound++ == 0) { + *overall = *cs; + } else { + overall->ascent = max (overall->ascent, cs->ascent); + overall->descent = max (overall->descent, cs->descent); + overall->lbearing = min (overall->lbearing, + overall->width + cs->lbearing); + overall->rbearing = max (overall->rbearing, + overall->width + cs->rbearing); + overall->width += cs->width; + } + } + } + + /* + * if there were no characters, then set everything to 0 + */ + if (nfound == 0) { + overall->width = overall->ascent = overall->descent = + overall->lbearing = overall->rbearing = 0; + } + + return 0; + } + + + /* + * XTextWidth16 - compute the width of sequence of XChar2bs. This is a + * subset of XTextExtents16. + */ + #if NeedFunctionPrototypes + int J_XTextWidth16 ( + XFontStruct *fs, + _Xconst XChar2b *string, + int count) + #else + int J_XTextWidth16 (fs, string, count) + XFontStruct *fs; + XChar2b *string; + int count; + #endif + { + int i; /* iterator */ + Bool singlerow = (fs->max_byte1 == 0); /* optimization */ + XCharStruct *def; /* info about default char */ + int width = 0; /* RETURN value */ + + if (singlerow) { + CI_GET_DEFAULT_INFO_1D (fs, def); + } else { + CI_GET_DEFAULT_INFO_2D (fs, def); + } + + if (def && fs->min_bounds.width == fs->max_bounds.width) + return (fs->min_bounds.width * count); + + /* + * Iterate over all character in the input string; only consider characters + * that exist. + */ + for (i = 0; i < count; i++, string++) { + register XCharStruct *cs; + unsigned int c = (unsigned int) string->byte1; /* watch for macros */ + unsigned int r = (unsigned int) string->byte2; /* watch for macros */ + + if (singlerow) { + unsigned int ind = ((r << 8) | c); /* watch for macros */ + CI_GET_CHAR_INFO_1D (fs, ind, def, cs); + } else { + CI_GET_CHAR_INFO_2D (fs, r, c, def, cs); + } + + if (cs) width += cs->width; + } + + return width; + } *** src/share/java/include/jmath.h.orig Wed May 8 18:39:09 1996 --- src/share/java/include/jmath.h Wed May 21 14:17:57 1997 *************** *** 29,36 **** * Math library definitions for all the public functions implemented in libm.a. */ ! #ifndef _MATH_H_ ! #define _MATH_H_ #include --- 29,36 ---- * Math library definitions for all the public functions implemented in libm.a. */ ! #ifndef _JMATH_H_ ! #define _JMATH_H_ #include *** src/share/java/include/oobj.h.orig Wed May 21 15:07:45 1997 --- src/share/java/include/oobj.h Wed May 21 15:08:02 1997 *************** *** 67,74 **** extern unicode *str2unicode(char *, unicode *, long); extern char *int642CString(int64_t number, char *buf, int buflen); ! #define ALIGN(n) (((n)+3)&~3) ! #define UCALIGN(n) ((unsigned char *)ALIGN((int)(n))) struct fieldblock { struct ClassClass *clazz; --- 67,74 ---- extern unicode *str2unicode(char *, unicode *, long); extern char *int642CString(int64_t number, char *buf, int buflen); ! #define JAVA_ALIGN(n) (((n)+3)&~3) ! #define UCALIGN(n) ((unsigned char *)JAVA_ALIGN((int)(n))) struct fieldblock { struct ClassClass *clazz;