diff -c -r build/solaris/GNUmakefile build/sunos/GNUmakefile *** build/solaris/GNUmakefile Wed May 8 18:28:50 1996 --- build/sunos/GNUmakefile Thu May 22 10:11:17 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/sunos/make_doc \ build/macos \ ! build/sunos/java/jio/ \ ! build/sunos/sun/hotjava/ \ ! build/sunos/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/sunos/bin/hotjava.sh \ ! src/sunos/doc/ \ ! src/sunos/java/native_threads/ \ src/win32/bin/hotjava.c \ src/win32/bin/hotjava.ico \ src/win32/doc/ diff -c -r build/solaris/java/GNUmakefile build/sunos/java/GNUmakefile *** build/solaris/java/GNUmakefile Wed May 8 18:28:48 1996 --- build/sunos/java/GNUmakefile Thu May 22 10:11:18 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 = sunos 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/sunos/java/applet/GNUmakefile *** build/solaris/java/applet/GNUmakefile Wed May 8 18:28:50 1996 --- build/sunos/java/applet/GNUmakefile Thu May 22 10:11:18 1997 *************** *** 2,8 **** TOPDIR = ../../../.. PACKAGE = java.applet ! PLATFORM = solaris PRODUCT = sun # --- 2,8 ---- TOPDIR = ../../../.. PACKAGE = java.applet ! PLATFORM = sunos PRODUCT = sun # diff -c -r build/solaris/java/awt/GNUmakefile build/sunos/java/awt/GNUmakefile *** build/solaris/java/awt/GNUmakefile Wed May 8 18:28:49 1996 --- build/sunos/java/awt/GNUmakefile Thu May 22 10:11:18 1997 *************** *** 2,8 **** TOPDIR = ../../../.. PACKAGE = java.awt ! PLATFORM = solaris PRODUCT = sun # --- 2,8 ---- TOPDIR = ../../../.. PACKAGE = java.awt ! PLATFORM = sunos PRODUCT = sun # diff -c -r build/solaris/java/java/GNUmakefile build/sunos/java/java/GNUmakefile *** build/solaris/java/java/GNUmakefile Wed May 8 18:28:49 1996 --- build/sunos/java/java/GNUmakefile Thu May 22 10:11:19 1997 *************** *** 5,11 **** # PROGRAM = java ! PLATFORM = solaris PRODUCT = java # --- 5,11 ---- # PROGRAM = java ! PLATFORM = sunos PRODUCT = java # *************** *** 69,80 **** 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 - endif THREADS_FLAG = green --- 69,76 ---- system_md.c # We need ARCH *before* we do the include that gets us Defs-solaris.gmk ! # FILES.c += machgc_nonsparc.c FILES.s += machgc_sparc.s THREADS_FLAG = green *************** *** 109,121 **** process_md.c - ifeq ($(ARCH),sparc) - EXTRAFILES-green = - else - EXTRAFILES-green = edi.s - endif - EXTRAFILES-native = solaris_regs.s - FILES.s += $(EXTRAFILES-$(THREADS_FLAG)) THREADFILES= $(THREADFILES-$(THREADS_FLAG)) FILES.c += $(THREADFILES) --- 105,110 ---- *************** *** 153,159 **** PKGPATH = $(PLATFORM_SRC)/java $(SHARE_SRC)/java ! LDLIBS += -lsocket -lnsl -lresolv clean :: FORCE rm -rf CClassHeaders --- 142,154 ---- PKGPATH = $(PLATFORM_SRC)/java $(SHARE_SRC)/java ! LDLIBS += -lnsl -lresolv ! ! ifeq ($(USE_MOTIF),-DUSE_MOTIF) ! LDLIBS += -L/usr/lib/X11 -lXm -lXmu -lXt -lXext -lX11 ! else ! LDLIBS += -L/usr/X11R5/lib -lXmu -lXt -lXext -lX11 ! endif clean :: FORCE rm -rf CClassHeaders diff -c -r build/solaris/java/javac/GNUmakefile build/sunos/java/javac/GNUmakefile *** build/solaris/java/javac/GNUmakefile Wed May 8 18:28:47 1996 --- build/sunos/java/javac/GNUmakefile Thu May 22 10:11:19 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/sunos/sun/GNUmakefile *** build/solaris/sun/GNUmakefile Wed May 8 18:28:51 1996 --- build/sunos/sun/GNUmakefile Thu May 22 10:11:21 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 = sunos 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/sunos/sun/applet/GNUmakefile *** build/solaris/sun/applet/GNUmakefile Wed May 8 18:28:50 1996 --- build/sunos/sun/applet/GNUmakefile Thu May 22 10:11:22 1997 *************** *** 2,8 **** TOPDIR = ../../../.. PACKAGE = sun.applet ! PLATFORM = solaris PRODUCT = sun # --- 2,8 ---- TOPDIR = ../../../.. PACKAGE = sun.applet ! PLATFORM = sunos PRODUCT = sun # diff -c -r build/solaris/sun/awt/GNUmakefile build/sunos/sun/awt/GNUmakefile *** build/solaris/sun/awt/GNUmakefile Wed May 8 18:28:50 1996 --- build/sunos/sun/awt/GNUmakefile Thu May 22 10:11:22 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,16 ---- TOPDIR = ../../../.. PACKAGE = sun.awt LIBRARY = awt ! PLATFORM = sunos PRODUCT = sun # # Rules # ! clean: classes.clean library.clean # # include rules *************** *** 176,206 **** vpath %.c $(SHARE_SRC)/sun/gif vpath %.c $(SHARE_SRC)/sun/images # # 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 \ -I$(SHARE_SRC)/sun/images \ $(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 --- 175,219 ---- vpath %.c $(SHARE_SRC)/sun/gif vpath %.c $(SHARE_SRC)/sun/images + # all stuff moved down here to check against USE_MOTIF + + ifeq ($(USE_MOTIF),-DUSE_MOTIF) + all: classes library + else + all: + endif + # # Default Motif directory # Set MOTIF_DIR to ALT_MOTIF_DIR if set otherwise, set it to _MOTIF_DIR # ! _MOTIF_DIR=/usr/X11R5 MOTIF_DIR=$(_MOTIF_DIR$(ALT_MOTIF_DIR))$(ALT_MOTIF_DIR) $(DEBUG) $(OPTIMIZED): motif + $(DEBUG) $(OPTIMIZED): motif + motif: .library.dirs.$(ARCH) .library.motif.$(ARCH) ! .library.motif.$(ARCH): /usr/lib/X11/libXm.so.1.2 ! cp /usr/lib/X11/libXm.so.1.2 $(LIBDIR)/$(ARCH) ! cd $(LIBDIR)/$(ARCH); rm -f libXm.so; ln -s libXm.so.1.2 libXm.so @-touch .library.motif.$(ARCH) motif.clean : rm -f $(LIBDIR)/$(ARCH)/libXm.* ! ! CPPFLAGS += -I/usr/include/X11 \ -I$(MOTIF_DIR)/include \ -I$(SHARE_SRC)/sun/images \ $(EVENT_MODEL) \ -I$(JAVAHOME)/$(PLATFORM)/java/java/CClassHeaders ! LDFLAGS += #-L$(LIBDIR)/$(ARCH) -L$(MOTIF_DIR)/lib -L/usr/lib/X11 -lXm ! ! LDFLAGS += #-L/usr/X11R5/lib -lXt -lXext -lX11 #-lXpm ! #LDFLAGS += #-L/usr/src/X/libraries/lesstif-current/libXm -lXm -lm -L/usr/X11R5/lib -lXt -lXext -lX11 -lXpm CLASSES.export += java.lang.String java.io.InputStream diff -c -r build/solaris/sun/debug/GNUmakefile build/sunos/sun/debug/GNUmakefile *** build/solaris/sun/debug/GNUmakefile Wed May 8 18:28:54 1996 --- build/sunos/sun/debug/GNUmakefile Thu May 22 10:11:22 1997 *************** *** 6,12 **** LIBRARY = agent PACKAGE = sun.tools ! PLATFORM = solaris PRODUCT = sun # --- 6,12 ---- LIBRARY = agent PACKAGE = sun.tools ! PLATFORM = sunos PRODUCT = sun # diff -c -r build/solaris/sun/javac/GNUmakefile build/sunos/sun/javac/GNUmakefile *** build/solaris/sun/javac/GNUmakefile Wed May 8 18:28:52 1996 --- build/sunos/sun/javac/GNUmakefile Thu May 22 10:11:23 1997 *************** *** 6,12 **** PROGRAM = javac PACKAGE = sun.tools ! PLATFORM = solaris PRODUCT = sun TOPDIR = ../../../.. --- 6,12 ---- PROGRAM = javac PACKAGE = sun.tools ! PLATFORM = sunos PRODUCT = sun TOPDIR = ../../../.. diff -c -r build/solaris/sun/javadoc/GNUmakefile build/sunos/sun/javadoc/GNUmakefile *** build/solaris/sun/javadoc/GNUmakefile Wed May 8 18:28:55 1996 --- build/sunos/sun/javadoc/GNUmakefile Thu May 22 10:11:23 1997 *************** *** 6,12 **** PROGRAM = javadoc PACKAGE = sun.tools ! PLATFORM = solaris PRODUCT = sun default: all --- 6,12 ---- PROGRAM = javadoc PACKAGE = sun.tools ! PLATFORM = sunos PRODUCT = sun default: all diff -c -r build/solaris/sun/jpeg/GNUmakefile build/sunos/sun/jpeg/GNUmakefile *** build/solaris/sun/jpeg/GNUmakefile Wed May 8 18:28:52 1996 --- build/sunos/sun/jpeg/GNUmakefile Thu May 22 10:11:23 1997 *************** *** 3,9 **** TOPDIR = ../../../.. PACKAGE = sun.awt LIBRARY = jpeg ! PLATFORM = solaris PRODUCT = sun # --- 3,9 ---- TOPDIR = ../../../.. PACKAGE = sun.awt LIBRARY = jpeg ! PLATFORM = sunos PRODUCT = sun # diff -c -r build/solaris/sun/misc/GNUmakefile build/sunos/sun/misc/GNUmakefile *** build/solaris/sun/misc/GNUmakefile Wed May 8 18:28:52 1996 --- build/sunos/sun/misc/GNUmakefile Thu May 22 10:11:23 1997 *************** *** 2,8 **** TOPDIR = ../../../.. PACKAGE = sun.misc ! PLATFORM = solaris PRODUCT = sun # --- 2,8 ---- TOPDIR = ../../../.. PACKAGE = sun.misc ! PLATFORM = sunos PRODUCT = sun # diff -c -r build/solaris/sun/mmedia/GNUmakefile build/sunos/sun/mmedia/GNUmakefile *** build/solaris/sun/mmedia/GNUmakefile Wed May 8 18:28:51 1996 --- build/sunos/sun/mmedia/GNUmakefile Thu May 22 10:11:24 1997 *************** *** 3,9 **** TOPDIR = ../../../.. PACKAGE = sun.audio LIBRARY = mmedia ! PLATFORM = solaris PRODUCT = sun # --- 3,9 ---- TOPDIR = ../../../.. PACKAGE = sun.audio LIBRARY = mmedia ! PLATFORM = sunos PRODUCT = sun # diff -c -r build/solaris/sun/net/GNUmakefile build/sunos/sun/net/GNUmakefile *** build/solaris/sun/net/GNUmakefile Wed May 8 18:28:51 1996 --- build/sunos/sun/net/GNUmakefile Thu May 22 10:11:24 1997 *************** *** 2,8 **** TOPDIR = ../../../.. PACKAGE = sun.net ! PLATFORM = solaris PRODUCT = sun # --- 2,8 ---- TOPDIR = ../../../.. PACKAGE = sun.net ! PLATFORM = sunos PRODUCT = sun # diff -c -r build/solaris/sun/security/GNUmakefile build/sunos/sun/security/GNUmakefile *** build/solaris/sun/security/GNUmakefile Wed May 8 18:28:56 1996 --- build/sunos/sun/security/GNUmakefile Thu May 22 10:11:25 1997 *************** *** 2,8 **** TOPDIR = ../../../.. PACKAGE = sun.security ! PLATFORM = solaris PRODUCT = sun # --- 2,8 ---- TOPDIR = ../../../.. PACKAGE = sun.security ! PLATFORM = sunos PRODUCT = sun # diff -c -r build/solaris/sun/tawt/GNUmakefile build/sunos/sun/tawt/GNUmakefile *** build/solaris/sun/tawt/GNUmakefile Wed May 8 18:28:55 1996 --- build/sunos/sun/tawt/GNUmakefile Thu May 22 10:11:25 1997 *************** *** 3,9 **** TOPDIR = ../../../.. PACKAGE = sun.awt LIBRARY = tawt ! PLATFORM = solaris PRODUCT = sun # --- 3,9 ---- TOPDIR = ../../../.. PACKAGE = sun.awt LIBRARY = tawt ! PLATFORM = sunos PRODUCT = sun # *************** *** 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 --- 119,128 ---- vpath %.c $(SHARE_SRC)/sun/gif vpath %.c $(SHARE_SRC)/sun/images ! CPPFLAGS += -I/usr/X11R5/include \ -I$(SHARE_SRC)/sun/images \ -I$(JAVAHOME)/$(PLATFORM)/java/java/CClassHeaders ! LDFLAGS += -L/usr/X115/lib -lX11 CLASSES.export += java.lang.String java.io.InputStream *** /dev/null Thu May 22 13:50:01 1997 --- build/sunos/makefiles/Defs-sunos.gmk Thu May 22 10:11:26 1997 *************** *** 0 **** --- 1,86 ---- + # + # @(#)Defs-solaris.gmk 1.16 95/11/13 + # + # Makefile to specify compiler flags for programs and libraries + # targeted to Solaris. Should not contain any rules. + # + + ARCH = $(shell arch) + + # This default is redefined during a release build. + RELEASE = $(shell echo jdk1.0.1-`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 + + USE_MOTIF = -DUSE_MOTIF + ifeq ($(ARCH),sun3) + CPPFLAGS_COMMON = -D$(ARCH) -DSUNOS4 -DRELEASE='"$(RELEASE)"' -DBREAKPTS $(USE_MOTIF) + else + CPPFLAGS_COMMON = -D$(ARCH) -DSUNOS4 -DRELEASE='"$(RELEASE)"' -DBREAKPTS -DHAVE_ALIGNED_LONGLONGS -DHAVE_ALIGNED_DOUBLES $(USE_MOTIF) + endif + + CPPFLAGS_OPT = -DTRIMMED + CPPFLAGS_DBG = -DDEBUG -DTRACING + + ASFLAGS_COMMON = -P + ASFLAGS_OPT = + ASFLAGS_DBG = + + LDFLAGS_COMMON = + 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 += + LDLIBS_COMMON += -lm -ldl + 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 + *** /dev/null Thu May 22 13:50:01 1997 --- src/sunos/java/include/strerror.h Thu May 22 10:11:26 1997 *************** *** 0 **** --- 1,2 ---- + char *sys_errlist[]; + #define strerror(errno) sys_errlist[errno] diff -c -r src/solaris/bin/java_wrapper.sh src/sunos/bin/java_wrapper.sh *** src/solaris/bin/java_wrapper.sh Wed May 8 18:31:15 1996 --- src/sunos/bin/java_wrapper.sh Thu May 22 10:11:27 1997 *************** *** 25,30 **** --- 25,35 ---- JAVA_HOME=$J_HOME fi + if [ -z "$LIBCPATH" ] ; then + LIBCPATH=`ls /usr/lib/libc.so.*[0-9] | tail -1` + export LIBCPATH + fi + CLASSPATH="${CLASSPATH-.}" if [ -z "${CLASSPATH}" ] ; then CLASSPATH="$J_HOME/classes:$J_HOME/lib/classes.zip" *************** *** 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 --- 39,48 ---- export CLASSPATH export LD_LIBRARY_PATH ! LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$J_HOME/lib/`uname -p 2>/dev/null || arch 2>/dev/null || uname -m`" progname=`basename $0` ! prog=$J_HOME/bin/`uname -p 2>/dev/null || arch 2>/dev/null || uname -m`/${progname} if [ -f $prog ] then diff -c -r src/solaris/java/green_threads/include/context_md.h src/sunos/java/green_threads/include/context_md.h *** src/solaris/java/green_threads/include/context_md.h Wed May 8 18:49:14 1996 --- src/sunos/java/green_threads/include/context_md.h Thu May 22 10:11:27 1997 *************** *** 33,43 **** --- 33,47 ---- #define _SOLARIS_CONTEXT_MD_H_ #include + #ifndef SUNOS4 #include #include #ifdef i386 #include #endif + #else + #include + #endif /* * Routines that call getcontext have strange control flow graphs, *************** *** 47,56 **** */ #pragma unknown_control_flow(getcontext) ! #ifdef i386 ! #include ! #endif ! /* * A solaris2 context. Everything else is on the stack. */ --- 51,57 ---- */ #pragma unknown_control_flow(getcontext) ! #ifndef SUNOS4 /* * A solaris2 context. Everything else is on the stack. */ *************** *** 66,76 **** --- 67,91 ---- unsigned int unix_errno; ucontext_t ucontext; } context_t; + #else + typedef struct { + unsigned int unix_errno; + sigjmp_buf sigjmpbuf; + sigset_t oldMask, blockMask; + } context_t; + #endif /* Save state of the current content and call rescheduler */ void reschedule(void); + #ifdef SUNOS4 + #define yieldContext(contextp) \ + if(! sigsetjmp((contextp)->sigjmpbuf, -1)) { \ + (contextp)->unix_errno = errno; \ + reschedule(); \ + } + #else #if i386 int getedi(void); *************** *** 101,109 **** --- 116,131 ---- } #endif /* i386 */ + #endif /* switch to the new context */ + #ifdef SUNOS4 + #define switchContext(contextp) { \ + errno = (contextp)->unix_errno; \ + siglongjmp((contextp)->sigjmpbuf, 1); \ + } + #else #ifdef i386 #define switchContext(contextp) { \ errno = (contextp)->unix_errno; \ *************** *** 117,121 **** --- 139,144 ---- setcontext(&((contextp)->ucontext)); \ } #endif /* i386 */ + #endif #endif /* !_SOLARIS_CONTEXT_MD_H_ */ diff -c -r src/solaris/java/green_threads/include/iomgr.h src/sunos/java/green_threads/include/iomgr.h *** src/solaris/java/green_threads/include/iomgr.h Wed May 8 18:49:17 1996 --- src/sunos/java/green_threads/include/iomgr.h Thu May 22 10:11:27 1997 *************** *** 58,65 **** --- 58,70 ---- #define FD_NBINIT 0x1 #define FD_CLOSED 0x2 + #ifdef SUNOS4 + #define READ_TIMEOUT TIMEOUT_INFINITY /* should trip on sigio? */ + #define WRITE_TIMEOUT 40 /* sigio doesn't trip on write avail */ + #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 **** --- 97,105 ---- #define SYS_FCNTL 10 #define SYS_DUP 11 #define SYS_CREAT 12 + #ifdef SUNOS4 + #define SYS_ACCEPT 13 + #define SYS_SELECT 14 + #endif #endif /* !_GREEN_IOMGR_H_ */ diff -c -r src/solaris/java/green_threads/src/context.c src/sunos/java/green_threads/src/context.c *** src/solaris/java/green_threads/src/context.c Wed May 8 18:49:23 1996 --- src/sunos/java/green_threads/src/context.c Thu May 22 10:11:28 1997 *************** *** 46,51 **** --- 46,55 ---- #include "sys_api.h" + #ifdef SUNOS4 + #include + #endif + /* * The list on which we put freed thread stacks pending reclamation. */ *************** *** 159,165 **** --- 163,177 ---- } else { /* Didn't get one */ SCHED_UNLOCK(); /* Can't allocate with SCHED_LOCKED() */ if (redZoneSize == 0) { + #ifdef SUNOS4 + #ifdef sun3 + redZoneSize = PAGESIZE; + #else + redZoneSize = getpagesize(); + #endif + #else redZoneSize = sysconf(_SC_PAGESIZE); /* one page */ + #endif } size += redZoneSize; /* For redzone */ stack->base = (stackp_t) sysMapMem(size, &size); *************** *** 190,195 **** --- 202,208 ---- currentStackPointer(sys_thread_t *tp) { context_t *context = &tp->mdcontext; + #ifndef SUNOS4 ucontext_t *uc = &(context->ucontext); #ifdef i386 return (void *) (uc->uc_mcontext.gregs[USP]); *************** *** 196,204 **** #else /* Presumed to be SPARC */ return (void *) (uc->uc_mcontext.gregs[REG_O6]); #endif /* i386 */ ! } #ifdef i386 /* Solaris/x86 version */ --- 209,258 ---- #else /* Presumed to be SPARC */ return (void *) (uc->uc_mcontext.gregs[REG_O6]); #endif /* i386 */ ! #else ! return (void *) (context->sigjmpbuf[3]); ! #endif } + + #ifdef SUNOS4 + void + initContext(sys_thread_t *tid, unsigned int pc, + void (*death_func)(), unsigned int arg) + { + context_t *mdcontext = CONTEXT(tid); + machdep_t *machdepP = MACHDEP(tid); + unsigned char *sp; + int *p; + + memset(mdcontext->sigjmpbuf, 0, sizeof(mdcontext->sigjmpbuf)); + machdepP->intrLockCount = 0; + + sp = (unsigned char *) tid->stack_base; + /* Note: WINDOWSIZE stuff is for SPARC, not really needed for m68k */ + sp -= (sizeof(sys_thread_t) + WINDOWSIZE + SA(MINFRAME)); + /* Force sp to be double aligned! */ + sp = (unsigned char *)((unsigned long)(sp) & 0xfffffff8); + /* for m68k the args to death_func are passed on the stack */ + p = (int *)sp; + + *p-- = (int ) 0xdeadbeef; /* frame pointer */ + p -= 4; /* no arguments 3, 4, 5 */ + + *p-- = (int ) pc; + *p-- = (int ) arg; + *p-- = (int ) 1; /* dummy arg - for compatibility with SPARC version */ + + p -= 8; /* saved locals */ + + /* sigjmpbuf[0] is -1 */ + mdcontext->sigjmpbuf[0] = -1; + /* signal mask is 0 (at 2), not block anything */ + mdcontext->sigjmpbuf[3] = (int)(char *)p; + mdcontext->sigjmpbuf[4] = (int)death_func; + mdcontext->sigjmpbuf[5] = (int)death_func+4; + } + #else #ifdef i386 /* Solaris/x86 version */ *************** *** 314,319 **** --- 368,374 ---- } #endif /* i386 */ + #endif /* * This routine allocates enought memory for the thread context *************** *** 377,379 **** --- 432,435 ---- } return; } + diff -c -r src/solaris/java/green_threads/src/interrupt_md.c src/sunos/java/green_threads/src/interrupt_md.c *** src/solaris/java/green_threads/src/interrupt_md.c Wed May 8 18:49:20 1996 --- src/sunos/java/green_threads/src/interrupt_md.c Thu May 22 10:11:28 1997 *************** *** 35,42 **** --- 35,44 ---- */ #include #include + #ifndef SUNOS4 #include #include + #endif #include #include "sys_api.h" *************** *** 69,74 **** --- 71,94 ---- "SIGPIPE 13 write on a pipe or other socket with no one to read it", "SIGALRM 14 alarm clock", "SIGTERM 15 software termination signal", + #ifdef SUNOS4 + "SIGURG 16@ urgent condition on IO channel", + "SIGSTOP 17 stop not from tty", + "SIGTSTP 18 stop from tty", + "SIGCONT 19@ continue after stop", + "SIGCHLD 20 child status change", + "SIGTTIN 21+ background read attempted from control terminal", + "SIGTTOU 22+ background write attempted to control terminal", + "SIGPOLL 23 pollable event occurred (also SIGIO)", + "SIGXCPU 24 cpu time limit exceeded (see getrlimit(2))", + "SIGXFSZ 25 file size limit exceeded (see getrlimit(2))", + "SIGVTALRM 26 virtual time alarm (see getitimer(2))", + "SIGPROF 27 profiling timer alarm (see getitimer(2))", + "SIGWINCH 28@ window changed (see termio(4) and win(4S))", + "SIGLOST 29 resource lost", + "SIGUSR1 30 user defined signal 1", + "SIGUSR2 31 user defined signal 2", + #else "SIGUSR1 16 user defined signal 1", "SIGUSR2 17 user defined signal 2", "SIGCHLD 18@ child status change", *************** *** 92,104 **** --- 112,130 ---- "SIGTHAW 35 private to checkpoint/resume", "SIGRTMIN 36 first (high-priority) realtime signal", "SIGRTMAX 43 last (lowest-priority) realtime signal" + #endif }; /* * Local routine prototypes. */ + #ifdef SUNOS4 + static void signalHandlerPanic(int); + static void signalHandlerDispatch(int); + #else static void signalHandlerPanic(int, siginfo_t *, void *); static void signalHandlerDispatch(int, siginfo_t *, void *); + #endif /* * Exported routines. *************** *** 179,190 **** --- 205,227 ---- * Install the panic handler for the signals that should cause us * to panic. */ + #ifdef SUNOS4 + sigAct.sa_handler = signalHandlerPanic; + #else sigAct.sa_handler = NULL; sigAct.sa_sigaction = signalHandlerPanic; + #endif sigemptyset(&(sigAct.sa_mask)); sigaddset(&sigAct.sa_mask, SIGPIPE); + #ifdef SUNOS4 + sigAct.sa_flags = 0; /* no SA_RESTART :( */ + #else sigAct.sa_flags = SA_SIGINFO | SA_RESTART; + #endif + #ifdef LINUX + /* linux diffs comment out: ABRT, EMT, SYSSYS */ + #endif sigaction(SIGABRT, &sigAct, (struct sigaction *)0); sigaction(SIGBUS, &sigAct, (struct sigaction *)0); sigaction(SIGILL, &sigAct, (struct sigaction *)0); *************** *** 198,204 **** --- 235,245 ---- sigaction(SIGXCPU, &sigAct, (struct sigaction *)0); sigaction(SIGXFSZ, &sigAct, (struct sigaction *)0); + #ifdef SUNOS4 + signal(SIGPIPE, SIG_IGN); + #else sigignore(SIGPIPE); + #endif if (sigprocmask(SIG_SETMASK, &(sigAct.sa_mask), NULL)) perror("intrinitMD - 2"); *************** *** 232,240 **** --- 273,286 ---- */ sigfillset(&(sigAct.sa_mask)); + #ifdef SUNOS4 + sigAct.sa_handler = signalHandlerDispatch; + sigAct.sa_flags = 0; /* no SA_RESTART :( */ + #else sigAct.sa_handler = 0; sigAct.sa_sigaction = signalHandlerDispatch; sigAct.sa_flags = SA_SIGINFO | SA_RESTART; + #endif sigaction(interrupt, &sigAct, (struct sigaction *)0); } *************** *** 252,260 **** --- 298,311 ---- * Set to the panic handler in case we get one when we shouldn't */ sigfillset(&(sigAct.sa_mask)); + #ifdef SUNOS4 + sigAct.sa_handler = signalHandlerPanic; + sigAct.sa_flags = 0; + #else sigAct.sa_handler = NULL; sigAct.sa_sigaction = signalHandlerPanic; sigAct.sa_flags = SA_SIGINFO; + #endif sigaction(interrupt, &sigAct, (struct sigaction *)0); } *************** *** 262,267 **** --- 313,319 ---- * Local routines. */ + #ifndef SUNOS4 /* * Decode a siginfo_t structure, and print out something interesting * about it. Truncate and succeed if the buffer write overflows. It's *************** *** 378,383 **** --- 430,436 ---- return msg; } } + #endif /*- * signalHandlerPanic() -- Deal with unexpected signals by dumping *************** *** 385,393 **** --- 438,452 ---- * panicing. */ static void + #ifdef SUNOS4 + signalHandlerPanic(int sig) + #else signalHandlerPanic(int sig, siginfo_t *info, void *uc) + #endif { + #ifndef SUNOS4 extern void CompiledCodeSignalHandler(int sig, siginfo_t *info, void *uc); + #endif extern void DumpMonitors(); extern void DumpAlarmQ(); static int count = 0; *************** *** 397,410 **** --- 456,474 ---- sysAbort(); } + #ifndef SUNOS4 CompiledCodeSignalHandler(sig, info, uc); if (sig > MAXSIG) { + #else + if (sig > NSIG) { + #endif fprintf(stderr, "Unknown signal: %d\n", sig); } else { fprintf(stderr, "%s\n", signalNames[sig]); } + #ifndef SUNOS4 if (info) { /* print out signal info */ if (info->si_code != SI_NOINFO) { *************** *** 422,427 **** --- 486,492 ---- sysThreadStackPointer(sysThreadSelf())); } } + #endif DumpThreads(); DumpMonitors(); *************** *** 436,442 **** --- 501,511 ---- * signalHandlerDispatch() -- Turn our signal into an intrDispatch(). */ static void + #ifdef SUNOS4 + signalHandlerDispatch(int sig) + #else signalHandlerDispatch(int sig, siginfo_t *info, void *uc) + #endif { int old_errno; *************** *** 446,452 **** --- 515,525 ---- Log1(1, "signalHandlerDispatch(sig=%d)\n", sig); old_errno = errno; + #ifdef SUNOS4 + intrDispatch(sig, NULL); + #else intrDispatch(sig, (void *) info); + #endif errno = old_errno; diff -c -r src/solaris/java/green_threads/src/io_md.c src/sunos/java/green_threads/src/io_md.c *** src/solaris/java/green_threads/src/io_md.c Wed May 8 18:49:22 1996 --- src/sunos/java/green_threads/src/io_md.c Thu May 22 10:11:29 1997 *************** *** 82,87 **** --- 82,93 ---- #include "log.h" #include "fd_md.h" + #ifdef SUNOS4 + 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); *************** *** 360,366 **** sysAssert(mon!=NULL); sysMonitorEnter(mon); - fd = fdobj->fd - 1; if (fd>=0) ret = listen(fd, count); sysMonitorExit(mon); --- 366,371 ---- *************** *** 385,391 **** --- 390,415 ---- sysMonitorEnter(mon); fd = fdobj->fd - 1; + #ifndef SUNOS4 if (fd>=0) ret = accept(fd, him, len); + #else + /* IO_LOCK(); */ + while (1) { + ret = (*systable[SYS_ACCEPT].addr)(fd, him, len); + if ((ret != -1) || pendingException() || + ((errno != EAGAIN) && (errno != EWOULDBLOCK) && (errno != EINTR))) + break; + sysMonitorWait(mon, SYS_TIMEOUT_INFINITY); + } + if (ret != -1) { + Log1(1, "Accept ret: %d \n", ret); + } else { + Log1(1, "Accept error: %d\n", errno); + } + + /* IO_UNLOCK(); */ + #endif + sysMonitorExit(mon); return ret; *************** *** 399,406 **** --- 423,432 ---- fd_set write_fds; struct timeval poll; sys_mon_t *mon; + #ifndef SUNOS4 extern int _select (int width, fd_set *, fd_set *, fd_set *, struct timeval *); + #endif int s = fdobj->fd-1; if (s < 0) { *************** *** 419,430 **** --- 445,469 ---- poll.tv_sec = poll.tv_usec = 0; result = connect(s, him, len); + while (result < 0 && !pendingException()) { + #ifndef SUNOS4 if (errno == EINPROGRESS) { 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 SUNOS4 + 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,449 **** --- 476,491 ---- sysAssert(result < 0); break; } + #endif result = 0; break; } sysMonitorWait(mon, delay); + #ifndef SUNOS4 } else { break; } + #endif } /* end of while */ } sysMonitorExit(mon); diff -c -r src/solaris/java/green_threads/src/iomgr.c src/sunos/java/green_threads/src/iomgr.c *** src/solaris/java/green_threads/src/iomgr.c Wed May 8 18:49:26 1996 --- src/sunos/java/green_threads/src/iomgr.c Thu May 22 10:11:29 1997 *************** *** 66,71 **** --- 66,77 ---- #include "log.h" #include "sys_api.h" + #ifdef SUNOS4 + typedef unsigned boolean_t; + #define B_TRUE ((boolean_t)1) + #define B_FALSE ((boolean_t)0) + #endif + /* Pavani's Async IO notes: *************** *** 144,150 **** --- 150,180 ---- #define IO_OPTIMIZE + #ifdef SUNOS4 + int syscalldebug(); + syscall_t systable[] = { + { "write", syscalldebug }, + { "writev", syscalldebug }, + { "read", syscalldebug }, + { "readv", syscalldebug }, + { "getmsg", syscalldebug }, + { "putmsg", syscalldebug }, + { "poll", syscalldebug }, + { "open", syscalldebug }, + { "close", syscalldebug }, + { "pipe", syscalldebug }, + { "fcntl", syscalldebug }, + { "dup", syscalldebug }, + { "creat", syscalldebug }, + #ifdef SUNOS4 + { "accept", syscalldebug }, + { "select", syscalldebug }, + #endif + { (char *) 0, 0 } + }; + #else + syscall_t systable[] = { { "write", 0 }, { "writev", 0 }, { "read", 0 }, *************** *** 155,171 **** { "open", 0 }, { "close", 0 }, { "pipe", 0 }, ! { "fcntl", 0}, { "dup", 0 }, { "creat", 0 }, { (char *) 0, 0 } }; extern int errno; /* This isn't in syscall.h, for some reason. */ int syscall (int, ...); int _select (int width, fd_set *, fd_set *, fd_set *, struct timeval *); /* macro to copy fd_set. fd_set is an array of fd_mask */ /* NFDBITS is defined in select.h to be bits per fd_mask */ --- 185,208 ---- { "open", 0 }, { "close", 0 }, { "pipe", 0 }, ! { "fcntl", 0 }, { "dup", 0 }, { "creat", 0 }, + #ifdef SUNOS4 + { "accept", 0 }, + { "select", 0 }, + #endif { (char *) 0, 0 } }; + #endif extern int errno; /* This isn't in syscall.h, for some reason. */ int syscall (int, ...); + #ifndef SUNOS4 int _select (int width, fd_set *, fd_set *, fd_set *, struct timeval *); + #endif /* macro to copy fd_set. fd_set is an array of fd_mask */ /* NFDBITS is defined in select.h to be bits per fd_mask */ *************** *** 179,188 **** initSyscalls() { syscall_t *tp = systable; ! ! while (tp->sym != (char *) 0) { ! tp->addr = (sysfunc_t) dlsym(RTLD_NEXT, tp->sym); ! tp++; } } --- 216,268 ---- initSyscalls() { syscall_t *tp = systable; ! #ifdef SUNOS4 ! #include ! ! /* alternative to this is to not redefine open() etc, but to ! go through and patch open(), etc, to jmp to the C replacements, ! and the systable stuff will be functions in 68k that set up ! the traps. */ ! ! static void *dlMain = NULL; ! char *libc; ! ! if(!dlMain) { ! if(!(libc=getenv("LIBCPATH"))) { ! DIR *dirp; ! struct dirent *dp; ! char *name = "libc.so."; ! /* could do some funky stuff to try and find libc here */ ! /* sysWrite(2, "**Could not find libc, set LIBCPATH to filename\n", 48); */ ! ! /* this is a catch-22, we need the redefined open/read to read */ ! /* the directory... */ ! dirp = opendir("/usr/lib"); ! for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) { ! if (strncmp(dp->d_name, name, strlen(name)) == 0 && strcmp(libc, dp->d_name) > 0) { ! libc = dp->d_name; ! } ! } ! closedir(dirp); ! if (!libc) { ! sysAbort(); ! } ! } ! ! if(!(dlMain = dlopen(libc,1))) { ! /* sysWrite(2, "**Could not open libc, check LIBCPATH\n", 38); */ ! sysAbort(); ! } ! #endif ! ! while (tp->sym != (char *) 0) { ! #ifdef SUNOS4 ! tp->addr = (sysfunc_t) dlsym(dlMain, tp->sym); ! #else ! tp->addr = (sysfunc_t) dlsym(RTLD_NEXT, tp->sym); ! #endif ! tp++; ! } } } *************** *** 287,292 **** --- 367,375 ---- nonblock_io(int desc, int onoff) { long flgs; + #ifdef SUNOS4 + pid_t pid; + #endif sysAssert(desc < max_files); sysAssert(fdmon[desc] != NULL); *************** *** 301,308 **** --- 384,399 ---- if ((flgs = fcntl(desc, F_GETFL, 0)) == -1) { IO_UNLOCK(); sysMonitorExit(fdmon[desc]); return -1;} + #ifdef SUNOS4 + fcntl(desc, F_SETFL, flgs | O_NONBLOCK | FASYNC ); + pid=1; + ioctl(desc, FIONBIO, &pid); + pid = getpid (); + fcntl(desc, F_SETOWN, pid); + #else fcntl(desc, F_SETFL, flgs | O_NONBLOCK); ioctl(desc, I_SETSIG, S_INPUT | S_OUTPUT); + #endif asyncIOActivateFD(desc); *************** *** 317,324 **** --- 408,423 ---- if ((flgs = fcntl(desc, F_GETFL, 0)) == -1) { IO_UNLOCK(); sysMonitorExit(fdmon[desc]); return -1; } + #ifdef SUNOS4 + fcntl(desc, F_SETFL, flgs & ~(O_NONBLOCK | FASYNC)); + { + int zero = 0; + ioctl(desc, FIONBIO, &zero); + } + #else fcntl(desc, F_SETFL, flgs & ~O_NONBLOCK); ioctl(desc, I_SETSIG, 0); + #endif fd_flags[desc] &= ~FD_NBINIT; *************** *** 470,477 **** } ! ssize_t ! read(int fd, void *buf, unsigned int nbytes) { register int nread; sys_mon_t *mon = fdmon[fd]; --- 569,576 ---- } ! int ! read(int fd, void *buf, __SIZE_TYPE__ nbytes) { register int nread; sys_mon_t *mon = fdmon[fd]; *************** *** 513,520 **** } ! ssize_t ! write(int fd, const void *buf, unsigned int nbytes) { register int nwrote; register caddr_t next = (caddr_t)buf; --- 612,619 ---- } ! int ! write(int fd, const void *buf, __SIZE_TYPE__ nbytes) { register int nwrote; register caddr_t next = (caddr_t)buf; *************** *** 540,547 **** --- 639,648 ---- if ((nwrote!=-1 && (total_written == nbytes)) || ((nwrote==-1) && (errno != EAGAIN && errno != EINTR)) || pendingException()) { + #if 0 Log2(1, "Write for %d bytes finished (did not block) on fd: %d\n", \ nwrote, fd); + #endif return ((nwrote!=-1)?total_written:-1); } /* else take the slow path */ *************** *** 574,580 **** --- 675,683 ---- call system close on the fd */ if (fd_ref[fd]==0 && closed_fd(fd)) system_close(fd); + #if 0 Log2(1, "Write for %d bytes finished on fd: %d\n", nwrote, fd); + #endif sysMonitorExit(mon); return total_written; *************** *** 768,774 **** --- 871,879 ---- int delay = 50; /* sleep 50 ms and try again */ fd_set write_fds; struct timeval poll; + #ifndef SUNOS4 extern int _select (int width, fd_set *, fd_set *, fd_set *, struct timeval *); + #endif FD_ZERO(&write_fds); FD_SET(s, &write_fds); *************** *** 775,787 **** --- 880,906 ---- poll.tv_sec = poll.tv_usec = 0; sysMonitorEnter(asyncMon(SYS_ASYNC_MON_IO)); + result = connect(s, him, len); + while (result < 0 && !pendingException()) { + #ifndef SUNOS4 if (errno == EINPROGRESS) { 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 SUNOS4 + 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) { *************** *** 794,806 **** --- 913,928 ---- sysAssert(result < 0); break; } + #endif result = 0; break; } sysMonitorWait(asyncMon(SYS_ASYNC_MON_IO), delay); + #ifndef SUNOS4 } else { break; } + #endif } sysMonitorExit(asyncMon(SYS_ASYNC_MON_IO)); return result; *************** *** 879,885 **** int i; for (i = 0; i < width; i++) { ! if (i >= OPEN_MAX) break; if ((readfds != 0 && FD_ISSET(i, readfds)) || (writefds != 0 && FD_ISSET(i, writefds)) --- 1001,1007 ---- int i; for (i = 0; i < width; i++) { ! if (i >= OPEN_MAX_FD) break; if ((readfds != 0 && FD_ISSET(i, readfds)) || (writefds != 0 && FD_ISSET(i, writefds)) *************** *** 907,913 **** --- 1029,1039 ---- timeval_t delay; int timeout = SYS_TIMEOUT_INFINITY; + #ifdef SUNOS4 + nfds = (*systable[SYS_SELECT].addr)(width, readfds, writefds, exceptfds, &poll); + #else nfds = _select(width, readfds, writefds, exceptfds, &poll); + #endif if (nfds != 0) { break; *************** *** 1045,1050 **** --- 1171,1186 ---- va_start(ap, cmd); arg = va_arg(ap, int); IO_LOCK(); + #ifdef SUNOS4 + #ifdef FCNTL_HACK + if (cmd == F_SETFL && arg == FNONBLOCK) { + arg = FNONBLOCK|FASYNC; + } + #endif /* FCNTL_HACK */ + if (cmd == F_SETFL && arg == O_NONBLOCK) { + arg = O_NONBLOCK|FASYNC; + } + #endif while (1) { fd = (*systable[SYS_FCNTL].addr)(fildes, cmd, arg); if ((fd != -1) || pendingException() || *************** *** 1112,1115 **** --- 1248,1357 ---- IO_UNLOCK(); return fd; } + + + #ifdef SUNOS4 + int accept(int s, void *addr, int *length) + { + int ret; + + IO_LOCK(); + while (1) { + ret = (*systable[SYS_ACCEPT].addr)(s, addr, length); + if ((ret != -1) || pendingException() || + ((errno != EAGAIN) && (errno != EINTR))) + break; + } + if (ret != -1) { + Log1(1, "Accept ret: %d \n", ret); + } else { + Log1(1, "Accept error: %d\n", errno); + } + + IO_UNLOCK(); + return ret; + } + #endif + + + #ifdef SUNOS4 + int syscalldebug(void) { + /* sysWrite(2, "**Attempt to call system call before initSyscalls\n", 50); */ + sysAbort(); + } + #endif + + #ifdef SUNOS4 + #include + + struct hostent * + gethostbyaddr_r(const char *addr, int length, int type, struct hostent *resp, char *buffer, int buflen, int *h_errnop) + { + struct hostent *result; + int old_h_errno; + char *filp = buffer; + char **aliasp, **out_aliasp; + char **addrp, **out_addrp; + unsigned k; + unsigned len; + + IO_LOCK(); + old_h_errno = h_errno; + result = gethostbyaddr (addr, length, type); + if (result != 0) + { + *resp = *result; + /* copy h_name */ + len = strlen (result->h_name)+1; + if (filp+len > buffer+buflen) + goto out_of_buffer_space; + memcpy (filp, result->h_name, len); + resp->h_name = filp; + filp += len; + /* copy h_aliases */ + resp->h_aliases = out_aliasp = (char **) filp; + len = sizeof (char *); + for (aliasp = result->h_aliases; *aliasp != 0; ++aliasp) + { + if (filp+len > buffer+buflen) + goto out_of_buffer_space; + filp += len; + } + for (aliasp = result->h_aliases; *aliasp != 0; ++aliasp) + { + len = strlen (*aliasp)+1; + if (filp+len > buffer+buflen) + goto out_of_buffer_space; + memcpy (filp, *aliasp, len); + *out_aliasp++ = filp; + filp += len; + } + /* copy h_addr_list */ + len = sizeof (char *); + resp->h_addr_list = out_addrp = (char **) filp; + for (addrp = result->h_addr_list; *addrp != 0; ++addrp) + { + if (filp+len > buffer+buflen) + goto out_of_buffer_space; + filp += len; + } + len = result->h_length; + for (addrp = result->h_addr_list; *addrp != 0; ++addrp) + { + if (filp+len > buffer+buflen) + goto out_of_buffer_space; + memcpy (filp, *addrp, len); + *out_addrp = filp; + filp += len; + } + } + *h_errnop = h_errno; + h_errno = old_h_errno; + IO_UNLOCK(); + return resp; + out_of_buffer_space: + *h_errnop = 42; /* out of buffer space */ + return 0; + } + #endif diff -c -r src/solaris/java/green_threads/src/itimer.c src/sunos/java/green_threads/src/itimer.c *** src/solaris/java/green_threads/src/itimer.c Wed May 8 18:49:25 1996 --- src/sunos/java/green_threads/src/itimer.c Thu May 22 10:11:30 1997 *************** *** 37,43 **** --- 37,45 ---- #include "monitor_md.h" #include "itimer_md.h" + #ifndef SUNOS4 extern int gettimeofday(struct timeval *, void *); + #endif /* * The minimum clock resolution in uSeconds. diff -c -r src/solaris/java/green_threads/src/process_md.c src/sunos/java/green_threads/src/process_md.c *** src/solaris/java/green_threads/src/process_md.c Wed May 8 18:49:29 1996 --- src/sunos/java/green_threads/src/process_md.c Thu May 22 10:11:30 1997 *************** *** 29,35 **** --- 29,39 ---- #include #include #include + #ifdef SUNOS4 + #include + #else #include + #endif #include #include *************** *** 59,65 **** --- 63,74 ---- void java_lang_ProcessReaper_waitForDeath(Hjava_lang_ProcessReaper *this) { + #ifndef SUNOS4 siginfo_t info; + #else + pid_t pid; + int status; + #endif sys_mon_t *mon = asyncMon(SYS_ASYNC_MON_CHILD); char *classname = JAVAPKG "UNIXProcess"; ClassClass *cb = FindClass(0, classname, TRUE); *************** *** 71,84 **** --- 80,106 ---- while (1) { sysMonitorEnter(mon); + #ifdef SUNOS4 + while ((pid = waitpid(0, &status, WNOHANG)) == 0) { + #else while (waitid(P_ALL, 0, &info, WEXITED|WNOHANG) != 0 || info.si_pid == 0) { + #endif sysMonitorWait(mon, TIMEOUT_INFINITY); } /* * fprintf(stderr, "pid %d status %d\n", info.si_pid, info.si_status); */ + #ifdef SUNOS4 + if (-1 == pid) { + sysMonitorWait(mon, TIMEOUT_INFINITY); + continue; + } execute_java_static_method(EE(), cb, "deadChild", "(II)V", + pid, status); + #else + execute_java_static_method(EE(), cb, "deadChild", "(II)V", info.si_pid, info.si_status); + #endif sysMonitorExit(mon); } } *************** *** 87,95 **** --- 109,123 ---- long java_lang_UNIXProcess_waitForUNIXProcess(Hjava_lang_UNIXProcess *this) { + #ifdef SUNOS4 + int status; + + waitpid(unhand(this)->pid, &status, 0); + #else siginfo_t info; waitid(P_PID, unhand(this)->pid, &info, WEXITED); + #endif return 1; } *************** *** 113,119 **** /* sysThreadSingle(); */ if ((pid = fork()) == 0) { /* Child process */ ! dup2(fdin[1], 0); dup2(fdout[1], 1); dup2(fderr[1], 2); --- 141,147 ---- /* 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; } --- 153,173 ---- close(fderr[1]); { int err; char c; ! err = (*systable[SYS_READ].addr)(fdsync[0], &c, 1); fprintf(stderr, "err = %d!\n", err); } } 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/sunos/java/green_threads/src/signals.c *** src/solaris/java/green_threads/src/signals.c Wed May 8 18:49:28 1996 --- src/sunos/java/green_threads/src/signals.c Thu May 22 10:11:30 1997 *************** *** 32,38 **** --- 32,40 ---- /* * Header files. */ + #ifndef SUNOS4 #include + #endif #include #include #include *************** *** 42,48 **** --- 44,52 ---- #include "threads_md.h" #include "monitor_md.h" #include "interrupt.h" + #ifndef SUNOS4 #include "ucontext.h" + #endif #include "log.h" #include "itimer_md.h" #include "schedule.h" *************** *** 319,328 **** 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) { --- 323,335 ---- 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(); + #ifndef SUNOS4 sighold(SIGIO); + #endif entry = &fdMap[fd]; if ((slot = entry->pollOffset) == -1) { *************** *** 335,341 **** --- 342,350 ---- pollfd->fd = fd; /* may be redundant */ pollfd->events = entry->flags; Log2(1, "Activating fd=%d onto slot=%d\n", fd, slot); + #ifndef SUNOS4 sigrelse(SIGIO); + #endif SCHED_UNLOCK(); } *************** *** 346,352 **** --- 355,363 ---- int slot; SCHED_LOCK(); + #ifndef SUNOS4 sighold(SIGIO); + #endif entry = &fdMap[fd]; if ((slot = entry->pollOffset) != -1) { *************** *** 371,377 **** --- 382,390 ---- pollTable[slot].events = entry->flags; } } + #ifndef SUNOS4 sigrelse(SIGIO); + #endif SCHED_UNLOCK(); } diff -c -r src/solaris/java/green_threads/src/synch.c src/sunos/java/green_threads/src/synch.c *** src/solaris/java/green_threads/src/synch.c Wed May 8 18:49:28 1996 --- src/sunos/java/green_threads/src/synch.c Thu May 22 10:11:30 1997 *************** *** 31,41 **** --- 31,46 ---- * instead of solaris threads, so we need a synchronization * mechanism that works with our thread package. */ + #ifndef SUNOS4 #include "monitor.h" #include "synch.h" #include "schedule.h" #include "bool.h" #include "sys_api.h" + #else + #include + #include + #endif extern bool_t monitorsInitialized; *************** *** 73,78 **** --- 78,84 ---- * scheduling locked. */ + #ifndef SUNOS4 _mutex_lock(mutex_t *mp) { sysAssert(_scheduling_lock == 0); *************** *** 92,98 **** --- 98,108 ---- } return 0; } + #endif + #ifdef SUNOS4 + void InitializeSbrk() {} + #else /* * SPECIAL CASE: In Solaris, malloc() calls sbrk() for more memory, * and both call _mutex_lock(), which we override to make them Green *************** *** 133,136 **** return ret; } ! --- 143,146 ---- return ret; } ! #endif diff -c -r src/solaris/java/green_threads/src/threads_md.c src/sunos/java/green_threads/src/threads_md.c *** src/solaris/java/green_threads/src/threads_md.c Wed May 8 18:49:21 1996 --- src/sunos/java/green_threads/src/threads_md.c Thu May 22 10:11:31 1997 *************** *** 200,212 **** static void start_func(int dummy, int arg, void (*func)()) { SCHED_UNLOCK(); (*func)(arg); panic("returned from start_func\n"); } int ! sysThreadCreate(long stack_size, unsigned int flags, void *(*start)(void *), sys_thread_t **ptid, void * cookie) { sysAssert(cookie != 0); --- 200,217 ---- static void start_func(int dummy, int arg, void (*func)()) { SCHED_UNLOCK(); + #if 0 (*func)(arg); + #else + /** fudgie stuff **/ + __asm__("ld [%fp+44], %o1; ld [%fp+40], %o0; call %o1; nop"); + #endif panic("returned from start_func\n"); } 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/sunos/java/include/OSName_md.h *** src/solaris/java/include/OSName_md.h Wed May 8 18:48:44 1996 --- src/sunos/java/include/OSName_md.h Thu May 22 10:11:31 1997 *************** *** 27,30 **** --- 27,34 ---- /* Define the name of the Operating System */ + #ifdef SUNOS4 + #define OSName_MD "SunOS" + #else #define OSName_MD "Solaris" + #endif diff -c -r src/solaris/java/include/byteorder_md.h src/sunos/java/include/byteorder_md.h *** src/solaris/java/include/byteorder_md.h Wed May 8 18:48:50 1996 --- src/sunos/java/include/byteorder_md.h Thu May 22 10:11:31 1997 *************** *** 32,37 **** --- 32,39 ---- #ifndef _SOLARIS_BYTE_MD_H_ #define _SOLARIS_BYTE_MD_H_ + #ifndef SUNOS4 #include + #endif #endif /* !_SOLARIS_BYTE_MD_H_ */ diff -c -r src/solaris/java/include/jmath_md.h src/sunos/java/include/jmath_md.h *** src/solaris/java/include/jmath_md.h Wed May 8 18:48:45 1996 --- src/sunos/java/include/jmath_md.h Thu May 22 10:11:31 1997 *************** *** 25,31 **** --- 25,33 ---- * */ + #ifndef SUNOS4 #include + #endif #define DREM(a,b) fmod(a,b) #define IEEEREM(a,b) remainder(a,b) diff -c -r src/solaris/java/include/timeval_md.h src/sunos/java/include/timeval_md.h *** src/solaris/java/include/timeval_md.h Wed May 8 18:48:48 1996 --- src/sunos/java/include/timeval_md.h Thu May 22 10:11:32 1997 *************** *** 28,33 **** --- 28,37 ---- #ifndef _SOLARIS_TIMEVAL_H_ #define _SOLARIS_TIMEVAL_H_ + #ifdef SUNOS4 + #include + #endif + typedef struct { long tv_sec; /* seconds */ long tv_usec; /* microseconds (NOT milliseconds) */ diff -c -r src/solaris/java/include/typedefs_md.h src/sunos/java/include/typedefs_md.h *** src/solaris/java/include/typedefs_md.h Wed May 8 18:48:45 1996 --- src/sunos/java/include/typedefs_md.h Thu May 22 10:11:32 1997 *************** *** 41,47 **** --- 41,50 ---- typedef unsigned long long uint64_t; #define _UINT32_T typedef unsigned long uint32_t; + #ifdef SUNOS4 + typedef unsigned long uint_t; #endif + #endif #ifndef _INT64_T #define _INT64_T *************** *** 48,55 **** --- 51,64 ---- typedef long long int64_t; #define _INT32_T typedef long int32_t; + #ifdef SUNOS4 + typedef long int_t; #endif + #endif + #ifdef SUNOS4 + typedef int ssize_t; + #endif /* use these macros when the compiler supports the long long type */ diff -c -r src/solaris/java/javai/javai.c src/sunos/java/javai/javai.c *** src/solaris/java/javai/javai.c Wed May 8 18:49:08 1996 --- src/sunos/java/javai/javai.c Thu May 22 10:11:32 1997 *************** *** 48,54 **** #include #include #include ! #else NATIVE #include #endif /* NATIVE */ --- 48,54 ---- #include #include #include ! #else /* NATIVE */ #include #endif /* NATIVE */ *************** *** 219,226 **** --- 219,235 ---- #define MINHEAPSIZE ((int) ( 3 * (1024*1024))) #define MAXHEAPSIZE MINHEAPSIZE #else + #ifdef SUNOS4 #define MINHEAPSIZE ((int) ( 1 * (1024*1024))) + #ifdef sun4 #define MAXHEAPSIZE ((int) (16 * (1024*1024))) + #else + #define MAXHEAPSIZE ((int) ( 3 * (1024*1024))) + #endif + #else + #define MINHEAPSIZE ((int) ( 1 * (1024*1024))) + #define MAXHEAPSIZE ((int) (16 * (1024*1024))) + #endif #endif /* USE_MALLOC */ /* *************** *** 290,295 **** --- 299,312 ---- } verifyclasses = VERIFY_REMOTE; /* we've decided this is the default */ + #ifdef SUNOS4 + #ifndef USE_MOTIF + add_user_prop("awt.toolkit=sun.awt.tiny.TinyToolkit"); + #endif + #endif + #ifdef DEBUG + InitializeExecEnv(&ee, 0); /* Call before InitializeMem() */ + #endif while (--argc > 0) if ((++argv)[0][0] == '-' && sourcefile == 0) #ifndef trace *************** *** 388,394 **** --- 405,413 ---- sourcefile = *argv; } *dargv = 0; + #ifndef DEBUG InitializeExecEnv(&ee, 0); /* Call before InitializeMem() */ + #endif if (ee.initial_stack == 0) { out_of_memory(); } *************** *** 728,730 **** --- 747,764 ---- "the network [default]\n"); fprintf(stderr, " -noverify do not verify any class\n"); } + + #if defined(SUNOS4) + void referenceXstuff(void) { + /* this is never called, but is in here to get the loader to pull up + libXm, libXt, libXext, and libX11 */ + #ifdef USE_MOTIF + XmActivateProtocol(); + #endif + XmuClientWindow(); + XtInitialize(); + XextFindDisplay(); + XServerVendor(); + } + #endif + diff -c -r src/solaris/java/runtime/linker_md.c src/sunos/java/runtime/linker_md.c *** src/solaris/java/runtime/linker_md.c Wed May 8 18:49:06 1996 --- src/sunos/java/runtime/linker_md.c Thu May 22 10:11:33 1997 *************** *** 78,88 **** --- 78,97 ---- /* * setup linker search paths */ + #ifdef SUNOS4 + if(!(ldpath = getenv("LD_LIBRARY_PATH"))) { + if(!ldpath) ldpath = ""; + } + if((ldpath = strdup(ldpath)) == 0) { + out_of_memory(); + } + #else if ((ldpath = getenv("LD_LIBRARY_PATH")) != 0) { if ((ldpath = strdup(ldpath)) == 0) { out_of_memory(); } } + #endif if (linkerinitialized) { return(ldpath); } *************** *** 162,174 **** --- 171,187 ---- (void)sysInitializeLinker(); } + #ifndef SUNOS4 if ((f = dlsym(RTLD_NEXT, sym_p)) == 0) { + #endif for (i = useddlsegments; --i >= 0;) { if ((f = dlsym(dlsegment[i].handle, sym_p))) { return((long)f); } } + #ifndef SUNOS4 } + #endif return 0; } diff -c -r src/solaris/java/runtime/machgc_sparc.s src/sunos/java/runtime/machgc_sparc.s *** src/solaris/java/runtime/machgc_sparc.s Wed May 8 18:49:01 1996 --- src/sunos/java/runtime/machgc_sparc.s Thu May 22 10:11:33 1997 *************** *** 29,46 **** * For SPARC Solaris only: the one piece of GC that can't be in C. */ ! #include ! .global gc_locked ! .global gc0_locked /* * Flush register windows, then enter the real garbage collector. * Should only be executed when holding the heap lock. */ ! gc_locked: ta ST_FLUSH_WINDOWS mov %o7, %g1 ! save value that "call" bashes ! call gc0_locked mov %g1, %o7 mov %o0,%i0 --- 29,46 ---- * For SPARC Solaris only: the one piece of GC that can't be in C. */ ! #include ! .global _gc_locked ! .global _gc0_locked /* * Flush register windows, then enter the real garbage collector. * Should only be executed when holding the heap lock. */ ! _gc_locked: ta ST_FLUSH_WINDOWS mov %o7, %g1 ! save value that "call" bashes ! call _gc0_locked mov %g1, %o7 mov %o0,%i0 diff -c -r src/solaris/java/runtime/math_md.c src/sunos/java/runtime/math_md.c *** src/solaris/java/runtime/math_md.c Wed May 8 18:48:57 1996 --- src/sunos/java/runtime/math_md.c Thu May 22 10:11:33 1997 *************** *** 35,41 **** --- 35,46 ---- int64_t a2ll(char * dummy) { + #ifdef SUNOS4 + /* HACK HACK HACK HACK HACK */ + return atol(dummy); + #else return atoll(dummy); + #endif } int diff -c -r src/solaris/java/runtime/memory_md.c src/sunos/java/runtime/memory_md.c *** src/solaris/java/runtime/memory_md.c Wed May 8 18:49:03 1996 --- src/sunos/java/runtime/memory_md.c Thu May 22 10:11:33 1997 *************** *** 63,68 **** --- 63,75 ---- #endif /* !USE_MALLOC */ + #ifdef SUNOS4 + #include + #ifndef MAP_FAILED + #define MAP_FAILED ((caddr_t)-1) + #endif + #endif + static unsigned int memGrainSize; /* A page for Solaris */ /* *************** *** 98,104 **** --- 105,119 ---- * Set system-specific variables used by mem allocator */ if (memGrainSize == 0) { + #ifdef SUNOS4 + #ifdef sun3 + memGrainSize = PAGESIZE; + #else + memGrainSize = getpagesize(); + #endif + #else memGrainSize = sysconf(_SC_PAGESIZE); + #endif } #ifndef USE_MALLOC diff -c -r src/solaris/java/runtime/properties_md.c src/sunos/java/runtime/properties_md.c *** src/solaris/java/runtime/properties_md.c Wed May 8 18:48:58 1996 --- src/sunos/java/runtime/properties_md.c Thu May 22 10:11:33 1997 *************** *** 76,84 **** --- 76,94 ---- PUTPROP(props, "java.class.path", v ? v : ""); /* os properties */ + #ifdef SUNOS4 + PUTPROP(props, "os.name", "SunOS"); + PUTPROP(props, "os.version", "4.1.x"); + #ifdef sun3 + PUTPROP(props, "os.arch", "sun3"); + #else + PUTPROP(props, "os.arch", "sparc"); + #endif + #else PUTPROP(props, "os.name", "Solaris"); PUTPROP(props, "os.version", "2.x"); PUTPROP(props, "os.arch", "sparc"); + #endif /* file system properties */ PUTPROP(props, "file.separator", "/"); diff -c -r src/solaris/java/runtime/system_md.c src/sunos/java/runtime/system_md.c *** src/solaris/java/runtime/system_md.c Wed May 8 18:49:04 1996 --- src/sunos/java/runtime/system_md.c Thu May 22 10:11:34 1997 *************** *** 34,40 **** --- 34,42 ---- #include "sys_api.h" /* Not in sys/time.h, for some reason */ + #ifndef SUNOS4 int gettimeofday(struct timeval *, void *); + #endif long sysGetMilliTicks() *************** *** 65,70 **** --- 67,74 ---- * 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. + * + * No equivalent under SunOS. look at gethostbyaddr_r in io* and copy idea */ #include #ifndef _REENTRANT *************** *** 75,98 **** --- 79,137 ---- struct tm * sysLocaltime(time_t *t, struct tm *tm) { + #ifdef SUNOS4 + struct tm *ptm; + ptm = localtime(t); + *tm = *ptm; + return tm; + #else return localtime_r(t, tm); + #endif } struct tm * sysGmtime(time_t *t, struct tm *tm) { + #ifdef SUNOS4 + struct tm *ptm; + ptm = gmtime(t); + *tm = *ptm; + return tm; + #else return gmtime_r(t, tm); + #endif } void sysStrftime(char *buf, int buflen, char *fmt, struct tm *t) { + #ifdef SUNOS4 + /* some stuff in src/share/java/lang/date.c decides to set up a struct tm + as a local variable, and does not inititalize everything we have. */ + + time_t cursec = time(NULL); + struct tm *ltm = localtime(&cursec); + + if(!(t->tm_zone=(char *)strdup(ltm->tm_zone))) { + out_of_memory(); + } + t->tm_gmtoff=ltm->tm_gmtoff; + + #endif strftime(buf, buflen, fmt, t); + #ifdef SUNOS4 + free(t->tm_zone); + t->tm_zone=NULL; /* just in case */ + #endif } time_t sysMktime(struct tm *t) { + #ifdef SUNOS4 + return timelocal(t); + #else return mktime(t); + #endif } /* *************** *** 171,173 **** --- 210,219 ---- { abort(); } + + #ifdef SUNOS4 + void memmove(void *dest, const void *src, size_t len) { + bcopy(src, dest, len); + } + #endif + diff -c -r src/solaris/net/multicast.c src/sunos/net/multicast.c *** src/solaris/net/multicast.c Wed May 8 18:51:23 1996 --- src/sunos/net/multicast.c Thu May 22 10:11:34 1997 *************** *** 29,35 **** --- 29,37 ---- #include #include #include + #ifndef SUNOS4 #include + #endif #include #include #include *************** *** 41,46 **** --- 43,51 ---- #include "sun_net_MulticastSocket.h" #include "java_io_FileDescriptor.h" + #ifdef SUNOS4 + #include "strerror.h" + #endif #define JAVANETPKG "java/net/" *************** *** 51,57 **** --- 56,64 ---- void sun_net_MulticastSocket_multicastJoin(struct Hsun_net_MulticastSocket *this, struct Hjava_net_InetAddress *mcast_address) { struct sockaddr_in name; + #ifndef SUNOS4 struct ip_mreq mname; + #endif Classjava_net_InetAddress *addrptr; Classsun_net_MulticastSocket *thisptr = unhand(this); Classjava_io_FileDescriptor *fdptr = unhand(thisptr->fd); *************** *** 66,71 **** --- 73,81 ---- return; } + #ifdef SUNOS4 + SignalError(0, JAVANETPKG "SocketException", "multicast not supported"); + #else addrptr = unhand(mcast_address); /* Set the multicast group address in the ip_mreq field */ *************** *** 88,93 **** --- 98,104 ---- SignalError(0, JAVANETPKG "SocketException", strerror(errno)); } } + #endif return; } *************** *** 94,100 **** --- 105,113 ---- void sun_net_MulticastSocket_multicastLeave(struct Hsun_net_MulticastSocket *this, struct Hjava_net_InetAddress *mcast_address) { struct sockaddr_in name; + #ifndef SUNOS4 struct ip_mreq mname; + #endif Classjava_net_InetAddress *addrptr; Classsun_net_MulticastSocket *thisptr = unhand(this); Classjava_io_FileDescriptor *fdptr = unhand(thisptr->fd); *************** *** 109,114 **** --- 122,130 ---- return; } + #ifdef SUNOS4 + SignalError(0, JAVANETPKG "SocketException", "multicast not supported"); + #else addrptr = unhand(mcast_address); /* Set the multicast group address in the ip_mreq field */ *************** *** 131,136 **** --- 147,153 ---- SignalError(0, JAVANETPKG "SocketException", strerror(errno)); } } + #endif return; } *************** *** 145,150 **** --- 162,170 ---- return; } + #ifdef SUNOS4 + SignalError(0, JAVANETPKG "SocketException", "multicast not supported"); + #else /* setsockopt to be correct ttl */ if (setsockopt(fdptr->fd -1, IPPROTO_IP, IP_MULTICAST_TTL, (char*)&ttl, sizeof (ttl)) < 0) { *************** *** 152,157 **** --- 172,178 ---- if (!(ee && exceptionOccurred(ee))) SignalError(0, JAVANETPKG "SocketException", strerror(errno)); } + #endif } diff -c -r src/solaris/net/socket.c src/sunos/net/socket.c *** src/solaris/net/socket.c Wed May 8 18:51:25 1996 --- src/sunos/net/socket.c Thu May 22 10:11:34 1997 *************** *** 29,35 **** --- 29,37 ---- #include #include #include + #ifndef SUNOS4 #include + #endif #include #include #include *************** *** 50,55 **** --- 52,62 ---- #include "java_io_FileDescriptor.h" #include "fd_md.h" + #ifdef SUNOS4 + #include "strerror.h" + extern struct hostent *gethostbyaddr_r(); + #endif + #define JAVANETPKG "java/net/" #define BODYOF(h) unhand(h)->body *************** *** 76,81 **** --- 83,93 ---- extern ssize_t sysRecvfromFD(Classjava_io_FileDescriptor * fdobj, char *buf, int nbytes, int flags, struct sockaddr *from, int *fromlen); + #ifdef SUNOS4 + void pthread_mutex_lock(void *mp); + void pthread_mutex_unlock(void *mp); + #endif + /* * InetAddress */ *************** *** 86,92 **** --- 98,108 ---- HString *localHostName; char hostname[MAXHOSTNAMELEN+1]; + #ifdef SUNOS4 + if (gethostname(hostname, sizeof(hostname)) == -1) { + #else if (sysinfo(SI_HOSTNAME, hostname, sizeof(hostname)) == -1) { + #endif strcpy(hostname, "localhost"); } return makeJavaString(hostname, strlen(hostname)); diff -c -r src/solaris/sun/awt_MToolkit.c src/sunos/sun/awt_MToolkit.c *** src/solaris/sun/awt_MToolkit.c Wed May 8 18:50:52 1996 --- src/sunos/sun/awt_MToolkit.c Thu May 22 10:11:35 1997 *************** *** 130,136 **** --- 130,138 ---- { #ifdef DEBUG printf("Xt error\n"); + #ifdef NOKSW SignalError(0, JAVAPKG "NullPointerException", 0); + #endif #endif return 0; } diff -c -r src/solaris/sun/canvas.c src/sunos/sun/canvas.c *** src/solaris/sun/canvas.c Wed May 8 18:50:46 1996 --- src/sunos/sun/canvas.c Thu May 22 10:11:35 1997 *************** *** 618,632 **** break; } modifiers = getModifiers(event->xbutton.state); JAVA_UPCALL((EE(), (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, --- 618,641 ---- break; } modifiers = getModifiers(event->xbutton.state); + #ifdef KEYBOARD_ONLY_EVENTS JAVA_UPCALL((EE(), (void *)client_data, "handleMouseDown","(JIIIIIII)V", int2ll(event->xbutton.time), (long)0, + event->xbutton.x, + event->xbutton.y, + event->xbutton.x_root, + event->xbutton.y_root, + clickCount, + modifiers)); #else + JAVA_UPCALL((EE(), + (void *)client_data, + "handleMouseDown","(JIIIIIII)V", + int2ll(event->xbutton.time), (passEvent==TRUE) ? (long)awt_copyXEvent(event) : (long)0, event->xbutton.x, event->xbutton.y, event->xbutton.x_root, *************** *** 633,655 **** event->xbutton.y_root, clickCount, modifiers)); break; case ButtonRelease: modifiers = getModifiers(event->xbutton.state); JAVA_UPCALL((EE(), (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, event->xbutton.y_root, modifiers)); break; case MotionNotify: clickCount = 0; --- 642,674 ---- event->xbutton.y_root, clickCount, modifiers)); + #endif break; case ButtonRelease: modifiers = getModifiers(event->xbutton.state); + #ifdef KEYBOARD_ONLY_EVENTS JAVA_UPCALL((EE(), (void *)client_data, "handleMouseUp","(JIIIIII)V", int2ll(event->xbutton.time), (long)0, + event->xbutton.x, + event->xbutton.y, + event->xbutton.x_root, + event->xbutton.y_root, + modifiers)); #else + JAVA_UPCALL((EE(), + (void *)client_data, + "handleMouseUp","(JIIIIII)V", + int2ll(event->xbutton.time), (passEvent==TRUE) ? (long)awt_copyXEvent(event) : (long)0, event->xbutton.x, event->xbutton.y, event->xbutton.x_root, event->xbutton.y_root, modifiers)); + #endif break; case MotionNotify: clickCount = 0; *************** *** 657,691 **** peer = 0; modifiers = getModifiers(event->xmotion.state); if (event->xmotion.state & (Button1Mask | Button2Mask | Button3Mask)) { JAVA_UPCALL((EE(), (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, event->xmotion.y_root, modifiers)); } else { JAVA_UPCALL((EE(), (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, event->xmotion.y_root, modifiers)); } break; case KeyPress: --- 676,728 ---- peer = 0; modifiers = getModifiers(event->xmotion.state); if (event->xmotion.state & (Button1Mask | Button2Mask | Button3Mask)) { + #ifdef KEYBOARD_ONLY_EVENTS JAVA_UPCALL((EE(), (void *)client_data, "handleMouseDrag","(JIIIIII)V", int2ll(event->xmotion.time), (long)0, + event->xmotion.x, + event->xmotion.y, + event->xmotion.x_root, + event->xmotion.y_root, + modifiers)); #else + JAVA_UPCALL((EE(), + (void *)client_data, + "handleMouseDrag","(JIIIIII)V", + int2ll(event->xmotion.time), (passEvent==TRUE) ? (long)awt_copyXEvent(event) : (long)0, event->xmotion.x, event->xmotion.y, event->xmotion.x_root, event->xmotion.y_root, modifiers)); + #endif } else { + #ifdef KEYBOARD_ONLY_EVENTS JAVA_UPCALL((EE(), (void *)client_data, "handleMouseMoved","(JIIIIII)V", int2ll(event->xmotion.time), (long)0, + event->xmotion.x, + event->xmotion.y, + event->xmotion.x_root, + event->xmotion.y_root, + modifiers)); #else + JAVA_UPCALL((EE(), + (void *)client_data, + "handleMouseMoved","(JIIIIII)V", + int2ll(event->xmotion.time), (passEvent==TRUE) ? (long)awt_copyXEvent(event) : (long)0, event->xmotion.x, event->xmotion.y, event->xmotion.x_root, event->xmotion.y_root, modifiers)); + #endif } break; case KeyPress: diff -c -r src/solaris/sun/tiny_Toolkit.c src/sunos/sun/tiny_Toolkit.c *** src/solaris/sun/tiny_Toolkit.c Wed May 8 18:51:08 1996 --- src/sunos/sun/tiny_Toolkit.c Thu May 22 10:11:35 1997 *************** *** 28,34 **** --- 28,36 ---- #include #include + #ifndef SUNOS4 #include "thread.h" + #endif #include "tiny.h" #include "java_awt_Event.h" #include "sun_awt_tiny_TinyToolkit.h" *************** *** 193,199 **** --- 195,203 ---- key = '\010'; break; case XK_Delete: + #ifndef SUNOS4 case XK_KP_Delete: + #endif key = '\177'; break; case XK_Tab: *************** *** 265,277 **** --- 269,285 ---- javaMethod = actionKeyMethod; break; case XK_F29: + #ifndef SUNOS4 case XK_Page_Up: + #endif /* PgUp */ key = java_awt_Event_PGUP; javaMethod = actionKeyMethod; break; case XK_F35: + #ifndef SUNOS4 case XK_Page_Down: + #endif /* PgDn */ key = java_awt_Event_PGDN; javaMethod = actionKeyMethod; *************** *** 702,708 **** --- 710,718 ---- new_y, winattr.width, winattr.height)); + #if 0 XFree(winattr); + #endif break; default: