Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Most of this I did yesterday. ISP pulled a brainfart and switched a few

thousand customers including me to a brocken ras.

I've forgotten. basically I walked through linux rh71, solaris 2.6 and winNT4
and fixed compile/runtime issues.  This should be the uucp lock contrib and
nanosleep fixes on Solaris.  Compile fixes to match on win32 and linux.
update Documentation and merge with 1.5 docs as best as possible.

The should be a solid base to sync into.  there will be minor bug fixes as we
go.  I'll make a relase of this on rxtx.org tonight.
  • Loading branch information...
commit 0928af18f90dd4db4fe206eb455f9733f625f570 1 parent 375481b
jarvi authored
View
8 .cvsignore
@@ -16,3 +16,11 @@ gnu
WIN32
CROSSCOMPILE
COPYING.CYGNUS
+Makefile.in
+aclocal.m4
+config.guess
+config.h.in
+config.sub
+configure
+ltconfig
+ltmain.sh
View
36 ChangeLog
@@ -3,14 +3,32 @@ This is ChangeLog Wed Jun 20 10:47:21 MDT 2001
rxtx-1.5 and rxtx-1.4 changes are kept in the same file. skip to the version
you downloaded.
+1.5-6 win32 fixes <wroberts1@home.com>
+ Initial Solaris port
+ initial Mac OS X port
+ Joseph Goldstone <joseph@lp.com>
+ Paul Tokarchuk <ptokarchuk@sympatico.ca>
+ package renamed to gnu.io
+ Memory leak Cleanups
+ cross-compile fixes
+ more windows fixes.
+ more ioctl support for windows
+ more fcntl suppport for windows
+ misc changes to windows
+ Makefile for building on mingw32 systems in DOS
+ uucp_lock file support
+ Many thanks to Mathworks for Making it happen.
+ symbolic link lock files now work (Mandrake)
+ peter.beelen@philips.com
+ Configure.in fixes for permission issues
+ Vadim Tkachenko <vt@freehold.crocodile.org>
+ Closed memleaks on open()/close()
+ registered port support.
+ Joseph Goldstone <joseph@lp.com>
1.5-5 Jun 28, 2001 Merged with rxtx-1.4
- Working Mac OS X port
+ More work on Mac OS X port
Joseph Goldstone <joseph@lp.com>
minor cleanups
- Many win32 fixes
- Many Solaris fixes
- uucp lock files
- symbolic link lock files now work (Mandrake)
1.5-4 Jan 26, 2001 Irix build fixes (still needs CFLAGS fixed?)
Michael Delgadillo <delgadil@ymi.com>
Windows build support with lcc
@@ -38,13 +56,7 @@ you downloaded.
Stallion Card support
Greg Luck <gluck@tempo-services.com.au>
CommPort enumeration with rxtx's comm.jar
-1.4-10 Aug 31, 2001 Follow symbolic links with lock files
- peter.beelen@philips.com
- Configure.in fixes for permission issues
- Vadim Tkachenko <vt@freehold.crocodile.org>
- Closed memleaks on open()/close()
- Joseph Goldstone <joseph@lp.com>
- registered port support.
+1.4-10 Aug 31, 2001 see rxtx-1.5-6
1.4-9 Jun 21, 2001 Steve Drach <drach@eng.sun.com>
Minor fix of error reporting in lockfiles
Mac OS X port Joseph Goldstone <joseph@lp.com>
View
53 INSTALL
@@ -243,7 +243,58 @@ A. Japanese
is provided for people that may have demanding needs and coding
ability.
- Instructions unique to win32 builds.
+ There is only serial port code at this time.
+
+ Three ways of compiling win32 libraries are offered:
+
+ mingw32 tools in DOS
+ lcc tools in DOS
+ cross-compiling from Linux
+
+ ----------------- mingw32 tools in DOS -----------------------
+
+ Install mingw32 http://www.mingw.org
+ Install a jdk http://java.sun.com/j2se
+ Make sure the ming32\bin and jdk\bin directories are in your
+ path.
+ In the rxtx top directory to the following:
+ mkdir build
+ copy Makefile.mingw32 build\Makefile
+ cd build
+ edit the Makefile and make sure the directories are correct.
+ execute the following:
+ make
+ make install
+
+ ----------------- lcc tools in DOS ---------------------------
+
+ Install a jdk http://java.sun.com/j2se
+ Install lcc http://www.cs.virginia.edu/~lcc-win32/
+
+ A make file (Makefile.lcc) for compiling rxtx with lcc
+ contributed by Valentin Pavlov
+
+ You will need a config.h file in the src directory. Other
+ builds usually generate them automatically. The following
+ should work.
+
+ #define HAVE_FCNTL_H
+ #define HAVE_SIGNAL_H
+ #undef HAVE_SYS_FCNTL_H
+ #undef HAVE_SYS_FILE_H
+ #undef HAVE_SYS_SIGNAL_H
+ #undef HAVE_TERMIOS_H
+ #undef HAVE_SYS_TIME_H
+
+ if you know how to create the above in a dos Makefile send in the changes.
+
+ the following commands should then work fine on the command
+ line.
+
+ cd src
+ make -f ..\Makefile.lcc
+
+ ----------------- cross-compiling from Linux -----------------
Grab ming32:
View
13 Makefile.am
@@ -40,17 +40,18 @@ javahfiles = $(patsubst $(SPATH)/%.java,%,$(wildcard $(SPATH)/*.java))
#######################
CLEANFILES = $(TOP)/*.class $(TOP)/$(CLASSDEST)/*.class $(TOP)/$(JARTARGET)
-# compile src/SerialImp.c and simular files into libraries.
+# compile src/SerialImp.c and similar files into libraries.
# LIBTOOL_FIX handles problems encountered on some OS's. See configure.in
# If a LIBTOOL_FIX is added be sure to provide a trailing ';' in configure.in
-$(target_alias)/lib%.la: $(SPATH)/%Imp.@EXTENSION@ $(CLASSES)
- @( \
- $(LIBTOOL_FIX) \
- cd $(DEST); \
+
+$(target_alias)/lib%.la: $(SPATH)/%Imp.@EXTENSION@ $(CLASSES) $(SPATH)/%Imp.h
+ @( \
+ $(LIBTOOL_FIX) \
+ cd $(DEST); \
$(LIBTOOLC) ../$(SPATH)/$*Imp.@EXTENSION@ -o $(TOP)/$(DEST)/$*Imp.lo; \
$(LINK) -o lib$*.la -rpath $(RXTX_PATH) $(TOP)/$(DEST)/$*Imp.lo)
-# compile src/RXTXPort.java and simular files into classes
+# compile src/RXTXPort.java and similar files into classes
# then create the .jar file
$(CLASSES): $(javafiles) $(TOP)/Makefile
$(JAVAH_FIX)
View
16 Makefile.in
@@ -104,6 +104,7 @@ JAVADOC = @JAVADOC@
JAVAH = @JAVAH@
JAVAH_FIX = @JAVAH_FIX@
JAVAINCLUDE = @JAVAINCLUDE@
+JAVAINCLUDEDIR = @JAVAINCLUDEDIR@
JAVANATINC = @JAVANATINC@
JAVA_CLASS_PATH = @JAVA_CLASS_PATH@
JAVA_CLASS_VERSION = @JAVA_CLASS_VERSION@
@@ -270,7 +271,7 @@ distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
- cp -pr $$/$$file $(distdir)/$$file; \
+ cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
@@ -344,17 +345,18 @@ distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
-# compile src/SerialImp.c and simular files into libraries.
+# compile src/SerialImp.c and similar files into libraries.
# LIBTOOL_FIX handles problems encountered on some OS's. See configure.in
# If a LIBTOOL_FIX is added be sure to provide a trailing ';' in configure.in
-$(target_alias)/lib%.la: $(SPATH)/%Imp.@EXTENSION@ $(CLASSES)
- @( \
- $(LIBTOOL_FIX) \
- cd $(DEST); \
+
+$(target_alias)/lib%.la: $(SPATH)/%Imp.@EXTENSION@ $(CLASSES) $(SPATH)/%Imp.h
+ @( \
+ $(LIBTOOL_FIX) \
+ cd $(DEST); \
$(LIBTOOLC) ../$(SPATH)/$*Imp.@EXTENSION@ -o $(TOP)/$(DEST)/$*Imp.lo; \
$(LINK) -o lib$*.la -rpath $(RXTX_PATH) $(TOP)/$(DEST)/$*Imp.lo)
-# compile src/RXTXPort.java and simular files into classes
+# compile src/RXTXPort.java and similar files into classes
# then create the .jar file
$(CLASSES): $(javafiles) $(TOP)/Makefile
$(JAVAH_FIX)
View
309 Makefile.mingw32
@@ -1,143 +1,166 @@
-#-------------------------------------------------------------------------
-# rxtx is a native interface to serial ports in java.
-# Copyright 1997-2001 by Trent Jarvi trentjarvi@yahoo.com.
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this library; if not, write to the Free
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#-------------------------------------------------------------------------
-# This Makefile works on windows 98/NT with mingw32 in a DOS shell
-# mingw build tools are used
-# PATH=c:\mingw\bin;c:\jdk118\bin;%PATH%
-# mingw32 version 1.0.1-20010726
-# jdk was 1.1.8
-# java.sun.com
-
-######################
-# user defined variables
-######################
-
-# path to the source code (directory with SerialImp.c) Unix style path
-SRC=../src
-
-# path to the jdk directory that has include, bin, lib, ... Unix style path
-JDKHOME=/jdk118
-
-# path to install jcl.jar DOS style path
-COMMINSTALL="\jdk118\lib"
-
-# path to install the shared libraries DOS style path
-LIBINSTALL="\jdk118\bin"
-
-# path to the mingw32 libraries (directory with libmingw32.a) DOS style path
-MINGLIBS="d:\gcc-2.95.2-1\i386-mingw32msvc\lib"
-
-# path for comm.jar and classes.zip
-CLASSPATH= -classpath "\jdk118\lib\comm.jar;\jdk118\lib\classes.zip;."
-
-######################
-# End of user defined variables
-######################
-
-######################
-# Tools
-######################
-
-AS=as
-CC=gcc
-LD=ld
-DLLTOOL=dlltool
-# this looks like a nice tool but I was not able to get symbols in the dll.
-DLLWRAP=dllwrap
-
-JAVAC=javac $(CLASSPATH)
-JAVAH=javah $(CLASSPATH)
-JAR=jar
-
-######################
-# Tool Flags
-######################
-
-CFLAGS= $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall
-INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include
-JAVAHFLAGS= -jni -d include
-LIBS=-L $(MINGLIBS) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll
-
-# path to the java native interface headers (directory with jni.h)
-JDKINCLUDE=$(JDKHOME)/include
-MINGJAVAFILES = $(wildcard $(SRC)/*.java)
-CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc)
-INCLUDES=$(wildcard $(SRC)/*.h)
-TARGETLIBS= Serial.dll
-DLLOBJECTS= fixup.o init.o
-
-all: javaxtimestamp $(TARGETLIBS)
-
-include:
- mkdir include
-
-gnu:
- mkdir gnu
- mkdir gnu\\io
-
-# yayaya We should have put the files in gnu.io to start with
-javaxtimestamp: $(MINGJAVAFILES) $(CFILES) include gnu
- xcopy ..\\\src\\\*.* gnu\\\io
- echo > javaxtimestamp
-
-init.o: $(INCLUDES)
- $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o
-
-%.o: jcl.jar $(SRC)/%.c $(INCLUDES) init.o
- $(CC) $(CFLAGS) -c $(SRC)/$*.c -o $*.o
-
-Serial.dll: $(CFILES) include/config.h $(DLLOBJECTS) SerialImp.o termios.o
- $(LD) --base-file Serial.base --dll -o Serial.dll $(DLLOBJECTS) SerialImp.o termios.o $(LIBS) -e _dll_entry@12
- $(DLLTOOL) --no-export-all-symbols --output-def Serial.def Serial.dll
- $(DLLTOOL) --as=$(AS) --dllname Serial.dll --def Serial.def --base-file Serial.base --output-exp Serial.exp
- $(LD) --base-file Serial.base Serial.exp -dll -o Serial.dll $(DLLOBJECTS) SerialImp.o termios.o $(LIBS) -e _dll_entry@12
- $(DLLTOOL) --as=$(AS) --dllname Serial.dll --def Serial.def --base-file Serial.base --output-exp Serial.exp
- $(LD) --base-file Serial.base Serial.exp -dll -o Serial.dll $(DLLOBJECTS) SerialImp.o termios.o $(LIBS) -e _dll_entry@12
-
-# This should replace the mess above if it worked.
-# nm shows no symbols in the dll produced. The old stuff above works ok.
-# $(DLLWRAP) --output-def $*.def --output-exp $*.exp --add-stdcall-alias --driver-name gcc -mwindows --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s -mno-cygwin
-
-jcl.jar: $(MINGJAVAFILES)
- $(JAVAC) gnu\\\io\\\*.java
- $(JAR) -cf jcl.jar gnu\\\io\\\*.class
- $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java))
-
-include/config.h:
- echo "#define HAVE_FCNTL_H 1" > include\\\config.h
- echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h
- echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h
- echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h
- echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h
- echo "#undef HAVE_TERMIOS_H\n" >> include\\\config.h
-
-install: all
- xcopy jcl.jar $(COMMINSTALL)
- xcopy Serial.dll $(LIBINSTALL)
-
-uninstall:
- del $(COMMINSTALL)\jcl.jar
- del $(LIBINSTALL)\Serial.dll
-
-clean:
- del /Q gnu\io\\*.*
- rmdir gnu\io
- rmdir gnu
- del /Q include\\*
- rmdir include
- del /Q Serial.* javaxtimestamp *.o jcl.jar
+#-------------------------------------------------------------------------
+# rxtx is a native interface to serial ports in java.
+# Copyright 1997-2001 by Trent Jarvi trentjarvi@yahoo.com.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the Free
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#-------------------------------------------------------------------------
+# This Makefile works on windows 98/NT with mingw32 in a DOS shell
+# One catch. We cant figure out how to generate .def files with default
+# DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging
+# C functions.
+# mingw build tools are used
+# PATH=c:\mingw\bin;c:\jdk118\bin;%PATH%
+# mingw32 version 1.0.1-20010726
+# jdk was 1.1.8
+# java.sun.com
+
+######################
+# user defined variables
+######################
+
+# path to the source code (directory with SerialImp.c) Unix style path
+SRC=../src
+# and the dos path
+DOSSRC=..\\\src
+
+# path to the jdk directory that has include, bin, lib, ... Unix style path
+JDKHOME=/jdk118
+
+# path to install jcl.jar DOS style path
+COMMINSTALL="\jdk118\lib"
+
+# path to install the shared libraries DOS style path
+LIBINSTALL="\jdk118\bin"
+
+# path to the mingw32 libraries (directory with libmingw32.a) DOS style path
+LIBDIR="\mingw\lib"
+
+######################
+# End of user defined variables
+######################
+
+
+######################
+# Tools
+######################
+
+AS=as
+CC=gcc
+LD=ld
+DLLTOOL=dlltool
+# this looks like a nice tool but I was not able to get symbols in the dll.
+DLLWRAP=dllwrap
+
+JAVAH=javah
+JAR=jar
+JAVAC=javac
+
+######################
+# Tool Flags
+######################
+
+CFLAGS= $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall
+INCLUDE= -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include
+JAVAHFLAGS= -jni -d include
+LIBS=-L $(LIBDIR) -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll
+
+# path to the java native interface headers (directory with jni.h)
+JDKINCLUDE=$(JDKHOME)/include
+JAVAFILES = $(wildcard $(SRC)/*.java)
+CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc)
+TARGETLIBS= Serial.dll
+DLLOBJECTS= fixup.o SerialImp.o termios.o init.o
+
+all: $(TARGETLIBS)
+
+include:
+ mkdir include
+
+gnu:
+ mkdir gnu
+ mkdir gnu\\\io
+
+# yayaya We should have put the files in gnu.io to start with
+gnutimestamp: $(JAVAFILES) $(CFILES) include gnu
+ xcopy $(DOSSRC)\\\*.* gnu\\\io\\\ # need a space here
+ echo > gnutimestamp
+
+# FIXME make 3.79.1 behaves really strage if we use %.o rules.
+
+init.o:
+ $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o
+
+fixup.o:
+ $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o
+
+SerialImp.o:
+ $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o
+
+termios.o:
+ $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o
+
+# This file is a pain in the rear to generate. If your looking at this you
+# need to install cygwin.
+
+$(SRC)/Serial.def: $(DLLOBJECTS)
+ $(LD) --base-file Serial.base --dll -o Serial.dll $(DLLOBJECTS) $(LIBS) -e _dll_entry@12
+ echo EXPORTS >$(SRC)/Serial.def;for i in `nm Serial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def
+ xcopy $(DOSSRC)\\\Serial.def gnu\\\io\\\ # need a space here
+
+
+$(TARGETLIBS): jcl.jar $(DLLOBJECTS) $(SRC)/Serial.def
+ $(LD) --base-file Serial.base --dll -o Serial.dll $(DLLOBJECTS) \
+ $(LIBS) -e _dll_entry@12
+ $(DLLTOOL) --as=$(AS) --dllname Serial.dll --def $(SRC)/Serial.def \
+ --base-file Serial.base --output-exp Serial.exp
+ $(LD) --base-file Serial.base Serial.exp -dll -o Serial.dll \
+ $(DLLOBJECTS) $(LIBS) -e _dll_entry@12
+ $(DLLTOOL) --as=$(AS) --dllname Serial.dll --def $(SRC)/Serial.def \
+ --base-file Serial.base --output-exp Serial.exp
+ $(LD) --base-file Serial.base Serial.exp -dll -o Serial.dll \
+ $(DLLOBJECTS) $(LIBS) -e _dll_entry@12
+#
+# This should replace the mess above if it worked.
+# nm shows no symbols in the dll produced. The old stuff above works ok.
+# $(DLLWRAP) --output-def $*.def --output-exp $*.exp \
+# --add-stdcall-alias --driver-name gcc -mwindows \
+# --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s
+# -mno-cygwin
+
+jcl.jar: gnutimestamp
+ $(JAVAC) gnu\\\io\\\\*.java
+ $(JAR) -cf jcl.jar gnu\\\io\\\\*.class
+ $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java))
+
+include/config.h: gnutimestamp
+ echo "#define HAVE_FCNTL_H 1" > include\\\config.h
+ echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h
+ echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h
+ echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h
+ echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h
+ echo "#undef HAVE_TERMIOS_H" >> include\\\config.h
+
+install: all
+ xcopy jcl.jar $(COMMINSTALL)
+ xcopy $(TARGETLIBS) $(LIBINSTALL)
+
+uninstall:
+ del $(COMMINSTALL)\\\jcl.jar
+ del $(LIBINSTALL)\\\$(TARGETLIBS)
+
+clean:
+ deltree gnu\\\io\\\*.*
+ deltree include
+ del Serial.* gnutimestamp *.o jcl.jar
View
160 configure
@@ -2035,6 +2035,7 @@ fi
+
JHOME=
RXTX_PATH=
EXTENSION="c"
@@ -2083,15 +2084,15 @@ fi
find_java_native_include()
{
-JAVANATINC="-I \$(JPATH)/include/`cd $JPATH/include; find . -name $1|sed s#$1##|head -n1`"
-if test `cd $JPATH/include; find . -name $1|wc -l` != "1" ; then
+JAVANATINC="-I \$(JAVAINCLUDEDIR)/`cd $JAVAINCLUDEDIR; find . -name $1|sed s#$1##|head -n1`"
+if test `cd $JAVAINCLUDEDIR; find . -name $1|wc -l` != "1" ; then
echo 1>&2
echo WARNING: configure is having a hard time determining which 1>&2
echo directory contains the file $1. Edit Makefile and fix the 1>&2
echo variable JAVANATINC to point to the correct directory. 1>&2
echo 1>&2
echo The following options are available: 1>&2
- find $JPATH/include -name $1|sed s#jni_md\.h## 1>&2
+ find $JAVAINCLUDEDIR -name $1|sed s#jni_md\.h## 1>&2
echo 1>&2
echo If there are more than one option available the first was selected. 1>&2
echo 1>&2
@@ -2121,9 +2122,9 @@ run_conftest()
{
echo $ac_n checking $1 " " 1>&6
if test x$JPATH = x; then
- VAR=`java conftest $1`
+ VAR=`java -classpath . conftest $1`
else
- VAR=`$JPATH/bin/java conftest $1`
+ VAR=`$JPATH/bin/java -classpath . conftest $1`
fi
echo $VAR 1>&6
echo $VAR
@@ -2222,8 +2223,8 @@ EOF
echo 1>&2
echo " WARNING: Older libc on linux detected. Patching a local copy of jni_md.h" 1>&2
echo 1>&2
- ln -s `find $JPATH/include -name jni.h` .
- cp `find $JPATH/include -name typedefs_md.h` .
+ ln -s `find $JAVAINCLUDEDIR -name jni.h` .
+ cp `find $JAVAINCLUDEDIR -name typedefs_md.h` .
# not pretty. could be cleaned up
patch << EOF
--- typedefs_md.h Tue Jan 11 14:17:08 2000
@@ -2414,15 +2415,24 @@ fix_comm_jar()
fi;
}
-JAVAINCLUDE="-I \$(JPATH)/include"
+ case $OS_NAME in
+ Mac\ OS\ X)
+ JAVAINCLUDEDIR=$JPATH/../../../Headers
+ ;;
+ *)
+ JAVAINCLUDEDIR=$JPATH/include
+ ;;
+esac
+
+JAVAINCLUDE="-I \$(JAVAINCLUDEDIR)"
if test "$CC" = "gcc" || test "$CC"="egcs"; then
case $JAVA_VENDOR in
Tran*)
find_java_native_include jni.h
- JAVAH="\$(JPATH)/bin/kaffeh \$(CLASSPATH) -d \$(DEST) -jni"
- JAVAC="\$(JPATH)/bin/javac \$(CLASSPATH) -d \$(TOP)/ -O"
+ JAVAH="\$(JPATH)/bin/kaffeh -classpath \$(CLASSPATH) -d \$(DEST) -jni"
+ JAVAC="\$(JPATH)/bin/javac -classpath \$(CLASSPATH) -d \$(TOP)/ -O"
JAR="\$(JPATH)/bin/jar"
- JAVADOC="\$(JPATH)/bin/javadoc \$(CLASSPATH)"
+ JAVADOC="\$(JPATH)/bin/javadoc -classpath \$(CLASSPATH)"
CFLAGS="$CFLAGS -D_BSD_SOURCE"
JAVAINCLUDE=""
JAVAH_FIX="if test ! -d \$(target_alias);then mkdir \$(target_alias);fi;"
@@ -2431,8 +2441,8 @@ if test "$CC" = "gcc" || test "$CC"="egcs"; then
;;
*)
find_java_native_include jni_md.h
- JAVAH="\$(JPATH)/bin/javah \$(CLASSPATH) -d \$(DEST) -jni"
- JAVAC="\$(JPATH)/bin/javac \$(CLASSPATH) -d \$(TOP)/ -O"
+ JAVAH="\$(JPATH)/bin/javah -classpath \$(CLASSPATH) -d \$(DEST) -jni"
+ JAVAC="\$(JPATH)/bin/javac -classpath \$(CLASSPATH) -d \$(TOP)/ -O"
JAR="\$(JPATH)/bin/jar"
JAVADOC="\$(JPATH)/bin/javadoc"
CFLAGS="$CFLAGS -D_BSD_SOURCE"
@@ -2455,17 +2465,18 @@ fi
Linux)
check_kernel_headers
check_java_headers
+ CFLAGS="$CFLAGS -D__need_timespec"
case $JAVA_VERSION in
1.2*|1.3*|1.4*)
fix_parameters $JPATH/jre/lib/javax.comm.properties
fix_comm_jar $JPATH/jre/lib/ext/comm.jar
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:"`find $JPATH/ -name comm.jar |head -n1`
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:"`find $JPATH/ -name comm.jar |head -n1`
JHOME=$JPATH"/jre/lib/ext"
RXTX_PATH="\$(JPATH)/jre/lib/\$(OS_ARCH)"
;;
- 1.*)
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:"` \
+ 1.1*)
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:"` \
if [ -d $JPATH/share/kaffe/ ]; then
find $JPATH/share/kaffe/ -name [cK]lasses.[jz][ai][rp]
elif [ -d $JPATH/lib/ ]; then
@@ -2498,6 +2509,9 @@ Linux)
esac
# Cross Compilers
+ echo ----------------------------
+ echo $target_os
+ echo ----------------------------
case $target_os in
linux*)
;;
@@ -2511,6 +2525,12 @@ Linux)
;;
freebsd*)
;;
+ solaris*)
+ TARGETLIB="\$(target_alias)/libSerial.la"
+ echo ----------------------------
+ echo $target_os
+ echo ----------------------------
+ ;;
esac
;;
@@ -2518,17 +2538,48 @@ Linux)
RXTX_PATH="\$(prefix)/lib"
JHOME=$JPATH/"lib"
CFLAGS="$CFLAGS -D_NO_POSIX=1 -D_NO_XOPEN4=1"
- TARGETLIB="\$(target_alias)/libSerial.la"
+ TARGETLIB="\$(target_alias)/libSerial.la \
+ \$(target_alias)/libParallel.la"
case $JAVA_VERSION in
- 1.2*|1.3*)
+ 1.2*|1.3*|1.4*)
fix_parameters $JPATH/jre/lib/javax.comm.properties
fix_comm_jar $JPATH/jre/lib/ext/comm.jar
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:"`find $JPATH/ -name comm.jar |head -n1`
+ RXTX_PATH="\$(JPATH)/jre/lib/\$(OS_ARCH)"
+ JHOME=$JPATH/"jre/lib/ext"
;;
- 1.*)
+ 1.1*)
check_prefix
fix_parameters $JPATH/lib/javax.comm.properties
fix_comm_jar $JPATH/lib/comm.jar
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar"
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:"` \
+ if [ -d $JPATH/share/kaffe/ ]; then
+ find $JPATH/share/kaffe/ -name [cK]lasses.[jz][ai][rp]
+ elif [ -d $JPATH/lib/ ]; then
+ find $JPATH/lib/ -name [cK]lasses.[jz][ai][rp]
+ fi`":"`
+ if [ -d $JPATH/share/kaffe/ ]; then
+ find $JPATH/share/kaffe/ -name comm.jar
+ elif [ -d $JPATH/lib/ ]; then
+ find $JPATH/lib/ -name comm.jar
+ fi`
+
+ if test x"$RXTX_PATH" = x;then
+ # We are not using Kaffe
+ fix_comm_jar $JPATH/lib/comm.jar
+ #fix_parameters $JPATH/lib/javax.comm.properties
+ check_prefix
+ RXTX_PATH="\$(prefix)/lib/"
+ JAVAH_FIX="if [ ! -d com ]; then if [ ! -f \$(JPATH)/lib/comm.jar ]; then echo \"Please install comm.jar from CommAPI in \$(JPATH)/java/lib/ 1>&2\"; else mkdir -p com/sun/comm;\$(JAR) -xf \$(JPATH)/lib/comm.jar; fi; fi;";
+ else
+ # Kaffe
+ fix_comm_jar $JPATH/share/kaffe/comm.jar
+ CLASSPATH=$CLASSPATH:`find $JHOME -name comm.jar`
+ echo "Warning! Kaffe's comm.jar does not support rxtx"
+ echo "See INSTALL for details"
+ fi;
+ RXTX_PATH="\$(prefix)/lib"
+ JHOME=$JPATH/"lib"
;;
*)
;;
@@ -2538,7 +2589,7 @@ Linux)
Irix*)
JHOME=$JPATH/"lib"
CFLAGS="$CFLAGS -I/usr/include"
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
RXTX_PATH="\$(JPATH)/lib/\$(OS_ARCH)"
TARGETLIB="\$(target_alias)/libSerial.la"
;;
@@ -2552,7 +2603,7 @@ HP-UX)
fix_parameters $JPATH/jre/lib/javax.comm.properties
fix_comm_jar $JPATH/jre/lib/ext/comm.jar
JHOME=$JPATH"/jre/lib/ext"
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/jre/lib/ext/comm.jar:$CLASSPATH"
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/jre/lib/ext/comm.jar:$CLASSPATH"
RXTX_PATH="\$(JPATH)/jre/lib/\$(OS_ARCH)"
echo WARNING $JAVA_VERSION is untested please email this message to TrentJarvi@yahoo.com and let me know if it works.
;;
@@ -2560,14 +2611,14 @@ HP-UX)
fix_parameters $JPATH/lib/javax.comm.properties
fix_comm_jar $JPATH/lib/comm.jar
JHOME=$JPATH/"lib"
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
RXTX_PATH="\$(prefix)/lib/"
;;
*)
fix_parameters $JPATH/lib/javax.comm.properties
fix_comm_jar $JPATH/lib/comm.jar
JHOME=$JPATH"/lib"
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
RXTX_PATH="\$(prefix)/lib/"
echo WARNING $JAVA_VERSION is untested please email this message to TrentJarvi@yahoo.com and let me know if it works.
;;
@@ -2597,7 +2648,7 @@ BeOS)
JHOME=$JPATH"/share/kaffe"
RXTX_PATH="\$(JPATH)/lib/"
CFLAGS="$CFLAGS -D_NO_POSIX=1 -D_NO_XOPEN4=1"
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/../src:\$(JPATH)/share/kaffe/Klasses.jar:\$(JPATH)/lib/comm.jar:$CLASSPATH"
+ CLASSPATH=".:\$(TOP):\$(TOP)/../src:\$(JPATH)/share/kaffe/Klasses.jar:\$(JPATH)/lib/comm.jar:$CLASSPATH"
TARGETLIB="\$(target_alias)/libSerial.la"
EXTENSION="cpp"
LDFLAGS="-ldevice"
@@ -2619,8 +2670,8 @@ WIN32)
CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:`find $JPATH/ -name comm.jar |head -n1`:$CLASSPATH"
JHOME=$JPATH"/jre/lib/ext"
;;
- 1.*)
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
+ 1.1*)
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
RXTX_PATH="\$(prefix)/lib/"
#JAVAH_FIX="if [ ! -d com ]; then if [ ! -f \$(JPATH)/lib/comm.jar ]; then echo \"Please install comm.jar from CommAPI in \$(JPATH)/java/lib/ 1>&2\"; else mkdir -p com/sun/comm;\$(JAR) -xf \$(JPATH)/lib/comm.jar; fi; fi;"
JHOME=$JPATH/"lib"
@@ -2646,92 +2697,84 @@ Mac\ OS\ X)
TARGETLIB="\$(target_alias)/libSerial.la"
RXTX_PATH="/usr/lib/java"
JHOME=$JPATH"/lib/ext"
- LDFLAGS="$LDFLAGS -framework JavaVM -install_name libSerial.jnilib"
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/ext/comm.jar:$CLASSPATH"
-# sigh auto*/libtool only like one library extension and mac os x likes a few
-# email trentjarvi@yahoo.com if you know a nicer fix.
- LIBTOOL_FIX="sed s/dynlib/jnilib/g libtool > tmp; mv tmp libtool; chmod +x libtool;"
+ CFLAGS="$CFLAGS -bundle"
+ LDFLAGS="$LDFLAGS -module -framework JavaVM -framework IOKit -framework CoreFoundation"
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/ext/comm.jar:$CLASSPATH"
+ # email trentjarvi@yahoo.com if you know a nicer fix.
+ LIBTOOL_FIX="sed s/echo\ so/echo\ jnilib/g libtool > tmp; mv tmp libtool; chmod +x libtool;"
;;
Solaris*)
+ LDFLAGS="-lposix4"
+ TARGETLIB="\$(target_alias)/libSerial.la"
+ JHOME=$JPATH/"lib"
+ CFLAGS="$CFLAGS -D_NO_POSIX=1 -D_NO_XOPEN4=1"
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
+
case $JAVA_VERSION in
1.2*|1.3*|1.4*)
fix_parameters $JPATH/jre/lib/javax.comm.properties
- TARGETLIB="\$(target_alias)/libSerial.la"
RXTX_PATH="\$(JPATH)/jre/lib/\$(OS_ARCH)"
- JHOME=$JPATH/"lib"
- CFLAGS="$CFLAGS -D_NO_POSIX=1 -D_NO_XOPEN4=1"
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
;;
- 1.*)
+ 1.1*)
fix_parameters $JPATH/lib/javax.comm.properties
- TARGETLIB="\$(target_alias)/libSerial.la"
RXTX_PATH="\$(JPATH)/lib/"
- JHOME=$JPATH/"lib"
- CFLAGS="$CFLAGS -D_NO_POSIX=1 -D_NO_XOPEN4=1"
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
;;
esac
;;
OS*2)
# Place marker only
- TARGETLIB="\$(target_alias)/libSerial.la \
- \$(target_alias)/libfuser.la"
+ TARGETLIB="\$(target_alias)/libSerial.la"
RXTX_PATH="\$(JPATH)/jre/lib/\$(OS_ARCH)"
JHOME=$JPATH/"lib"
CFLAGS="$CFLAGS -D_NO_POSIX=1 -D_NO_XOPEN4=1"
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
;;
AIX)
- TARGETLIB="\$(target_alias)/libSerial.la \
- \$(target_alias)/libfuser.la"
+ TARGETLIB="\$(target_alias)/libSerial.la"
RXTX_PATH="\$(JPATH)/jre/lib/\$(OS_ARCH)"
JHOME=$JPATH/"lib"
CFLAGS="$CFLAGS -D_NO_POSIX=1 -D_NO_XOPEN4=1"
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
;;
Digital\ Unix)
- TARGETLIB="\$(target_alias)/libSerial.la \
- \$(target_alias)/libfuser.la"
+ TARGETLIB="\$(target_alias)/libSerial.la"
RXTX_PATH="\$(JPATH)/jre/lib/\$(OS_ARCH)"
JHOME=$JPATH/"lib"
CFLAGS="$CFLAGS -D_NO_POSIX=1 -D_NO_XOPEN4=1 -pthread"
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
;;
NetWare*)
# Place marker only
- TARGETLIB="\$(target_alias)/libSerial.la \
- \$(target_alias)/libfuser.la"
+ TARGETLIB="\$(target_alias)/libSerial.la"
RXTX_PATH="\$(JPATH)/jre/lib/\$(OS_ARCH)"
JHOME=$JPATH/"lib"
CFLAGS="$CFLAGS -D_NO_POSIX=1 -D_NO_XOPEN4=1"
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
;;
MPE*)
- TARGETLIB="\$(target_alias)/libSerial.la \
- \$(target_alias)/libfuser.la"
+ TARGETLIB="\$(target_alias)/libSerial.la"
RXTX_PATH="\$(JPATH)/jre/lib/\$(OS_ARCH)"
JHOME=$JPATH/"lib"
CFLAGS="$CFLAGS -D_NO_POSIX=1 -D_NO_XOPEN4=1"
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
;;
*)
- echo test *!!!
TARGETLIB="\$(target_alias)/libSerial.la"
RXTX_PATH="\$(JPATH)/jre/lib/\$(OS_ARCH)"
JHOME=$JPATH/"lib"
CFLAGS="$CFLAGS -D_NO_POSIX=1 -D_NO_XOPEN4=1"
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
;;
esac
@@ -2900,6 +2943,7 @@ s%@MAKEINFO@%$MAKEINFO%g
s%@SET_MAKE@%$SET_MAKE%g
s%@CPP@%$CPP%g
s%@WINDOWS_JAVA_INCLUDE@%$WINDOWS_JAVA_INCLUDE%g
+s%@JAVAINCLUDEDIR@%$JAVAINCLUDEDIR%g
s%@JAVAINCLUDE@%$JAVAINCLUDE%g
s%@JAVANATINC@%$JAVANATINC%g
s%@CLASSPATH@%$CLASSPATH%g
View
159 configure.in
@@ -35,6 +35,7 @@ AC_CHECK_HEADERS(grp.h)
AC_CHECK_HEADERS(pwd.h)
AC_PROG_GCC_TRADITIONAL
AC_SUBST(WINDOWS_JAVA_INCLUDE)
+AC_SUBST(JAVAINCLUDEDIR)
AC_SUBST(JAVAINCLUDE)
AC_SUBST(JAVANATINC)
AC_SUBST(CLASSPATH)
@@ -102,15 +103,15 @@ AC_ARG_ENABLE(DEBUG,
)
find_java_native_include()
{
-JAVANATINC="-I \$(JPATH)/include/`cd $JPATH/include; find . -name $1|sed s#$1##|head -n1`"
-if [ test `cd $JPATH/include; find . -name $1|wc -l` != "1" ]; then
+JAVANATINC="-I \$(JAVAINCLUDEDIR)/`cd $JAVAINCLUDEDIR; find . -name $1|sed s#$1##|head -n1`"
+if [ test `cd $JAVAINCLUDEDIR; find . -name $1|wc -l` != "1" ]; then
echo 1>&2
echo WARNING: configure is having a hard time determining which 1>&2
echo directory contains the file $1. Edit Makefile and fix the 1>&2
echo variable JAVANATINC to point to the correct directory. 1>&2
echo 1>&2
echo The following options are available: 1>&2
- find $JPATH/include -name $1|sed s#jni_md\.h## 1>&2
+ find $JAVAINCLUDEDIR -name $1|sed s#jni_md\.h## 1>&2
echo 1>&2
echo If there are more than one option available the first was selected. 1>&2
echo 1>&2
@@ -140,9 +141,9 @@ run_conftest()
{
echo $ac_n checking $1 " " 1>&6
if test x$JPATH = x; then
- VAR=`java conftest $1`
+ VAR=`java -classpath . conftest $1`
else
- VAR=`$JPATH/bin/java conftest $1`
+ VAR=`$JPATH/bin/java -classpath . conftest $1`
fi
echo $VAR 1>&6
echo $VAR
@@ -241,8 +242,8 @@ EOF
echo 1>&2
echo " WARNING: Older libc on linux detected. Patching a local copy of jni_md.h" 1>&2
echo 1>&2
- ln -s `find $JPATH/include -name jni.h` .
- cp `find $JPATH/include -name typedefs_md.h` .
+ ln -s `find $JAVAINCLUDEDIR -name jni.h` .
+ cp `find $JAVAINCLUDEDIR -name typedefs_md.h` .
# not pretty. could be cleaned up
patch << EOF
--- typedefs_md.h Tue Jan 11 14:17:08 2000
@@ -433,15 +434,24 @@ fix_comm_jar()
fi;
}
-JAVAINCLUDE="-I \$(JPATH)/include"
+[ case $OS_NAME in
+ Mac\ OS\ X)
+ JAVAINCLUDEDIR=$JPATH/../../../Headers
+ ;;
+ *)
+ JAVAINCLUDEDIR=$JPATH/include
+ ;;
+esac ]
+
+JAVAINCLUDE="-I \$(JAVAINCLUDEDIR)"
if test "$CC" = "gcc" || test "$CC"="egcs"; then
case $JAVA_VENDOR in
Tran*)
find_java_native_include jni.h
- JAVAH="\$(JPATH)/bin/kaffeh \$(CLASSPATH) -d \$(DEST) -jni"
- JAVAC="\$(JPATH)/bin/javac \$(CLASSPATH) -d \$(TOP)/ -O"
+ JAVAH="\$(JPATH)/bin/kaffeh -classpath \$(CLASSPATH) -d \$(DEST) -jni"
+ JAVAC="\$(JPATH)/bin/javac -classpath \$(CLASSPATH) -d \$(TOP)/ -O"
JAR="\$(JPATH)/bin/jar"
- JAVADOC="\$(JPATH)/bin/javadoc \$(CLASSPATH)"
+ JAVADOC="\$(JPATH)/bin/javadoc -classpath \$(CLASSPATH)"
CFLAGS="$CFLAGS -D_BSD_SOURCE"
JAVAINCLUDE=""
JAVAH_FIX="if test ! -d \$(target_alias);then mkdir \$(target_alias);fi;"
@@ -450,8 +460,8 @@ if test "$CC" = "gcc" || test "$CC"="egcs"; then
;;
*)
find_java_native_include jni_md.h
- JAVAH="\$(JPATH)/bin/javah \$(CLASSPATH) -d \$(DEST) -jni"
- JAVAC="\$(JPATH)/bin/javac \$(CLASSPATH) -d \$(TOP)/ -O"
+ JAVAH="\$(JPATH)/bin/javah -classpath \$(CLASSPATH) -d \$(DEST) -jni"
+ JAVAC="\$(JPATH)/bin/javac -classpath \$(CLASSPATH) -d \$(TOP)/ -O"
JAR="\$(JPATH)/bin/jar"
JAVADOC="\$(JPATH)/bin/javadoc"
CFLAGS="$CFLAGS -D_BSD_SOURCE"
@@ -474,17 +484,18 @@ fi
Linux)
check_kernel_headers
check_java_headers
+ CFLAGS="$CFLAGS -D__need_timespec"
case $JAVA_VERSION in
1.2*|1.3*|1.4*)
fix_parameters $JPATH/jre/lib/javax.comm.properties
fix_comm_jar $JPATH/jre/lib/ext/comm.jar
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:"`find $JPATH/ -name comm.jar |head -n1`
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:"`find $JPATH/ -name comm.jar |head -n1`
JHOME=$JPATH"/jre/lib/ext"
RXTX_PATH="\$(JPATH)/jre/lib/\$(OS_ARCH)"
;;
- 1.*)
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:"` \
+ 1.1*)
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:"` \
if [ -d $JPATH/share/kaffe/ ]; then
find $JPATH/share/kaffe/ -name [cK]lasses.[jz][ai][rp]
elif [ -d $JPATH/lib/ ]; then
@@ -517,6 +528,9 @@ Linux)
esac
# Cross Compilers
+ echo ----------------------------
+ echo $target_os
+ echo ----------------------------
case $target_os in
linux*)
;;
@@ -530,6 +544,12 @@ Linux)
;;
freebsd*)
;;
+ solaris*)
+ TARGETLIB="\$(target_alias)/libSerial.la"
+ echo ----------------------------
+ echo $target_os
+ echo ----------------------------
+ ;;
esac
;;
@@ -537,17 +557,48 @@ Linux)
RXTX_PATH="\$(prefix)/lib"
JHOME=$JPATH/"lib"
CFLAGS="$CFLAGS -D_NO_POSIX=1 -D_NO_XOPEN4=1"
- TARGETLIB="\$(target_alias)/libSerial.la"
+ TARGETLIB="\$(target_alias)/libSerial.la \
+ \$(target_alias)/libParallel.la"
case $JAVA_VERSION in
- 1.2*|1.3*)
+ 1.2*|1.3*|1.4*)
fix_parameters $JPATH/jre/lib/javax.comm.properties
fix_comm_jar $JPATH/jre/lib/ext/comm.jar
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:"`find $JPATH/ -name comm.jar |head -n1`
+ RXTX_PATH="\$(JPATH)/jre/lib/\$(OS_ARCH)"
+ JHOME=$JPATH/"jre/lib/ext"
;;
- 1.*)
+ 1.1*)
check_prefix
fix_parameters $JPATH/lib/javax.comm.properties
fix_comm_jar $JPATH/lib/comm.jar
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar"
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:"` \
+ if [ -d $JPATH/share/kaffe/ ]; then
+ find $JPATH/share/kaffe/ -name [cK]lasses.[jz][ai][rp]
+ elif [ -d $JPATH/lib/ ]; then
+ find $JPATH/lib/ -name [cK]lasses.[jz][ai][rp]
+ fi`":"`
+ if [ -d $JPATH/share/kaffe/ ]; then
+ find $JPATH/share/kaffe/ -name comm.jar
+ elif [ -d $JPATH/lib/ ]; then
+ find $JPATH/lib/ -name comm.jar
+ fi`
+
+ if test x"$RXTX_PATH" = x;then
+ # We are not using Kaffe
+ fix_comm_jar $JPATH/lib/comm.jar
+ #fix_parameters $JPATH/lib/javax.comm.properties
+ check_prefix
+ RXTX_PATH="\$(prefix)/lib/"
+ JAVAH_FIX="if [ ! -d com ]; then if [ ! -f \$(JPATH)/lib/comm.jar ]; then echo \"Please install comm.jar from CommAPI in \$(JPATH)/java/lib/ 1>&2\"; else mkdir -p com/sun/comm;\$(JAR) -xf \$(JPATH)/lib/comm.jar; fi; fi;";
+ else
+ # Kaffe
+ fix_comm_jar $JPATH/share/kaffe/comm.jar
+ CLASSPATH=$CLASSPATH:`find $JHOME -name comm.jar`
+ echo "Warning! Kaffe's comm.jar does not support rxtx"
+ echo "See INSTALL for details"
+ fi;
+ RXTX_PATH="\$(prefix)/lib"
+ JHOME=$JPATH/"lib"
;;
*)
;;
@@ -557,7 +608,7 @@ Linux)
Irix*)
JHOME=$JPATH/"lib"
CFLAGS="$CFLAGS -I/usr/include"
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
RXTX_PATH="\$(JPATH)/lib/\$(OS_ARCH)"
TARGETLIB="\$(target_alias)/libSerial.la"
;;
@@ -571,7 +622,7 @@ HP-UX)
fix_parameters $JPATH/jre/lib/javax.comm.properties
fix_comm_jar $JPATH/jre/lib/ext/comm.jar
JHOME=$JPATH"/jre/lib/ext"
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/jre/lib/ext/comm.jar:$CLASSPATH"
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/jre/lib/ext/comm.jar:$CLASSPATH"
RXTX_PATH="\$(JPATH)/jre/lib/\$(OS_ARCH)"
echo WARNING $JAVA_VERSION is untested please email this message to TrentJarvi@yahoo.com and let me know if it works.
;;
@@ -579,14 +630,14 @@ HP-UX)
fix_parameters $JPATH/lib/javax.comm.properties
fix_comm_jar $JPATH/lib/comm.jar
JHOME=$JPATH/"lib"
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
RXTX_PATH="\$(prefix)/lib/"
;;
*)
fix_parameters $JPATH/lib/javax.comm.properties
fix_comm_jar $JPATH/lib/comm.jar
JHOME=$JPATH"/lib"
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
RXTX_PATH="\$(prefix)/lib/"
echo WARNING $JAVA_VERSION is untested please email this message to TrentJarvi@yahoo.com and let me know if it works.
;;
@@ -616,7 +667,7 @@ BeOS)
JHOME=$JPATH"/share/kaffe"
RXTX_PATH="\$(JPATH)/lib/"
CFLAGS="$CFLAGS -D_NO_POSIX=1 -D_NO_XOPEN4=1"
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/../src:\$(JPATH)/share/kaffe/Klasses.jar:\$(JPATH)/lib/comm.jar:$CLASSPATH"
+ CLASSPATH=".:\$(TOP):\$(TOP)/../src:\$(JPATH)/share/kaffe/Klasses.jar:\$(JPATH)/lib/comm.jar:$CLASSPATH"
TARGETLIB="\$(target_alias)/libSerial.la"
EXTENSION="cpp"
LDFLAGS="-ldevice"
@@ -638,8 +689,8 @@ WIN32)
CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:`find $JPATH/ -name comm.jar |head -n1`:$CLASSPATH"
JHOME=$JPATH"/jre/lib/ext"
;;
- 1.*)
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
+ 1.1*)
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
RXTX_PATH="\$(prefix)/lib/"
#JAVAH_FIX="if [ ! -d com ]; then if [ ! -f \$(JPATH)/lib/comm.jar ]; then echo \"Please install comm.jar from CommAPI in \$(JPATH)/java/lib/ 1>&2\"; else mkdir -p com/sun/comm;\$(JAR) -xf \$(JPATH)/lib/comm.jar; fi; fi;"
JHOME=$JPATH/"lib"
@@ -665,92 +716,84 @@ Mac\ OS\ X)
TARGETLIB="\$(target_alias)/libSerial.la"
RXTX_PATH="/usr/lib/java"
JHOME=$JPATH"/lib/ext"
- LDFLAGS="$LDFLAGS -framework JavaVM -install_name libSerial.jnilib"
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/ext/comm.jar:$CLASSPATH"
-# sigh auto*/libtool only like one library extension and mac os x likes a few
-# email trentjarvi@yahoo.com if you know a nicer fix.
- LIBTOOL_FIX="sed s/dynlib/jnilib/g libtool > tmp; mv tmp libtool; chmod +x libtool;"
+ CFLAGS="$CFLAGS -bundle"
+ LDFLAGS="$LDFLAGS -module -framework JavaVM -framework IOKit -framework CoreFoundation"
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/ext/comm.jar:$CLASSPATH"
+ # email trentjarvi@yahoo.com if you know a nicer fix.
+ LIBTOOL_FIX="sed s/echo\ so/echo\ jnilib/g libtool > tmp; mv tmp libtool; chmod +x libtool;"
;;
Solaris*)
+ LDFLAGS="-lposix4"
+ TARGETLIB="\$(target_alias)/libSerial.la"
+ JHOME=$JPATH/"lib"
+ CFLAGS="$CFLAGS -D_NO_POSIX=1 -D_NO_XOPEN4=1"
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
+
case $JAVA_VERSION in
1.2*|1.3*|1.4*)
fix_parameters $JPATH/jre/lib/javax.comm.properties
- TARGETLIB="\$(target_alias)/libSerial.la"
RXTX_PATH="\$(JPATH)/jre/lib/\$(OS_ARCH)"
- JHOME=$JPATH/"lib"
- CFLAGS="$CFLAGS -D_NO_POSIX=1 -D_NO_XOPEN4=1"
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
;;
- 1.*)
+ 1.1*)
fix_parameters $JPATH/lib/javax.comm.properties
- TARGETLIB="\$(target_alias)/libSerial.la"
RXTX_PATH="\$(JPATH)/lib/"
- JHOME=$JPATH/"lib"
- CFLAGS="$CFLAGS -D_NO_POSIX=1 -D_NO_XOPEN4=1"
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
;;
esac
;;
OS*2)
# Place marker only
- TARGETLIB="\$(target_alias)/libSerial.la \
- \$(target_alias)/libfuser.la"
+ TARGETLIB="\$(target_alias)/libSerial.la"
RXTX_PATH="\$(JPATH)/jre/lib/\$(OS_ARCH)"
JHOME=$JPATH/"lib"
CFLAGS="$CFLAGS -D_NO_POSIX=1 -D_NO_XOPEN4=1"
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
;;
AIX)
- TARGETLIB="\$(target_alias)/libSerial.la \
- \$(target_alias)/libfuser.la"
+ TARGETLIB="\$(target_alias)/libSerial.la"
RXTX_PATH="\$(JPATH)/jre/lib/\$(OS_ARCH)"
JHOME=$JPATH/"lib"
CFLAGS="$CFLAGS -D_NO_POSIX=1 -D_NO_XOPEN4=1"
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
;;
Digital\ Unix)
- TARGETLIB="\$(target_alias)/libSerial.la \
- \$(target_alias)/libfuser.la"
+ TARGETLIB="\$(target_alias)/libSerial.la"
RXTX_PATH="\$(JPATH)/jre/lib/\$(OS_ARCH)"
JHOME=$JPATH/"lib"
CFLAGS="$CFLAGS -D_NO_POSIX=1 -D_NO_XOPEN4=1 -pthread"
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
;;
NetWare*)
# Place marker only
- TARGETLIB="\$(target_alias)/libSerial.la \
- \$(target_alias)/libfuser.la"
+ TARGETLIB="\$(target_alias)/libSerial.la"
RXTX_PATH="\$(JPATH)/jre/lib/\$(OS_ARCH)"
JHOME=$JPATH/"lib"
CFLAGS="$CFLAGS -D_NO_POSIX=1 -D_NO_XOPEN4=1"
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
;;
MPE*)
- TARGETLIB="\$(target_alias)/libSerial.la \
- \$(target_alias)/libfuser.la"
+ TARGETLIB="\$(target_alias)/libSerial.la"
RXTX_PATH="\$(JPATH)/jre/lib/\$(OS_ARCH)"
JHOME=$JPATH/"lib"
CFLAGS="$CFLAGS -D_NO_POSIX=1 -D_NO_XOPEN4=1"
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
;;
*)
- echo test *!!!
TARGETLIB="\$(target_alias)/libSerial.la"
RXTX_PATH="\$(JPATH)/jre/lib/\$(OS_ARCH)"
JHOME=$JPATH/"lib"
CFLAGS="$CFLAGS -D_NO_POSIX=1 -D_NO_XOPEN4=1"
- CLASSPATH="-classpath .:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
+ CLASSPATH=".:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/lib/comm.jar:$CLASSPATH"
;;
esac ]
View
740 src/SerialImp.c
@@ -72,6 +72,28 @@
#if defined(__sun__)
# include <sys/filio.h>
# include <sys/mkdev.h>
+
+/*----------------------------------------------------------
+cfmakeraw
+
+ accept: termios to be set to raw
+ perform: initializes the termios structure.
+ return: int 0 on success
+ exceptions: none
+ comments: this is how linux cfmakeraw works.
+ termios(3) manpage
+----------------------------------------------------------*/
+
+int cfmakeraw ( struct termios *term )
+{
+ term->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
+ term->c_oflag &= ~OPOST;
+ term->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
+ term->c_cflag &= ~(CSIZE|PARENB);
+ term->c_cflag |= CS8;
+ return( 0 );
+}
+
#endif /* __sun__ */
#if defined(__hpux__)
# include <sys/modem.h>
@@ -128,8 +150,14 @@ JNIEXPORT void JNICALL RXTXPort(Initialize)(
/* POSIX signal handling functions */
#if !defined(WIN32)
- struct sigaction handler;
+ struct sigaction handler, ignorer;
+
+ ignorer.sa_handler = SIG_IGN;
+
sigaction( SIGIO, NULL, &handler );
+ sigaction( SIGINT, NULL, NULL );
+ signal( SIGIO, SIG_IGN );
+
if( !handler.sa_handler ) signal( SIGIO, SIG_IGN );
#endif /* !WIN32 */
#if defined(DEBUG) && defined(__linux__)
@@ -170,13 +198,27 @@ JNIEXPORT jint JNICALL RXTXPort(open)(
struct termios ttyset;
int fd;
const char *filename = (*env)->GetStringUTFChars( env, jstr, 0 );
+ char message[80];
+
+ /*
+ LOCK is one of three functions defined in SerialImp.h
- if (!fhs_lock(filename))
+ uucp_lock Solaris
+ fhs_lock Linux
+ system_does_not_lock Win32
+ */
+
+ if ( LOCK( filename) )
{
(*env)->ReleaseStringUTFChars( env, jstr, filename );
- printf("locking has failed\n");
+ fprintf( stderr, "locking has failed for %s\n", filename );
goto fail;
}
+ else
+ {
+ sprintf( message, "locking worked for %s\n", filename );
+ report( message );
+ }
do {
fd=open (filename, O_RDWR | O_NOCTTY | O_NONBLOCK );
@@ -206,6 +248,8 @@ JNIEXPORT jint JNICALL RXTXPort(open)(
fcntl( fd, F_SETFL, FASYNC );
#endif /* FASYNC */
+ sprintf( message, "fd returned is %i\n", fd );
+ report( message );
return (jint)fd;
fail:
@@ -230,12 +274,20 @@ JNIEXPORT void JNICALL RXTXPort(nativeClose)( JNIEnv *env,
int fd = get_java_var( env, jobj,"fd","I" );
const char *filename = (*env)->GetStringUTFChars( env, jstr, 0 );
+ /*
+ UNLOCK is one of three functions defined in SerialImp.h
+
+ uucp_unlock Solaris
+ fhs_unlock Linux
+ system_does_not_unlock Win32
+ */
+
if (fd > 0)
{
do {
result=close (fd);
} while (result < 0 && errno==EINTR);
- fhs_unlock(filename);
+ UNLOCK(filename);
}
(*env)->ReleaseStringUTFChars( env, jstr, filename );
return;
@@ -566,10 +618,15 @@ JNIEXPORT void JNICALL RXTXPort(writeArray)( JNIEnv *env,
{
int fd = get_java_var( env, jobj,"fd","I" );
int result=0,total=0,i;
-
unsigned char *bytes = (unsigned char *)malloc( count );
-
jbyte *body = (*env)->GetByteArrayElements( env, jbarray, 0 );
+#if defined ( __sun__ )
+ struct timespec retspec, tspec;
+
+ retspec.tv_sec = 0;
+ retspec.tv_nsec = 50000;
+#endif /* __sun */
+
for( i = 0; i < count; i++ ) bytes[ i ] = body[ i + offset ];
(*env)->ReleaseByteArrayElements( env, jbarray, body, 0 );
do {
@@ -579,11 +636,30 @@ JNIEXPORT void JNICALL RXTXPort(writeArray)( JNIEnv *env,
}
} while ((total<count)||(result < 0 && errno==EINTR));
free( bytes );
+ /*
+ 50 ms sleep to make sure read can get in
+
+ what I think is happening here is the data writen is causing
+ signals, the event loop can't select with data available
+
+ I think things like BlackBox with 2 ports open are getting
+ signals for both the reciever and transmitter since they
+ are the same PID.
+
+ Things just start spinning out of control after that.
+ */
+#if defined (__sun__ )
+ //do {
+ // tspec = retspec;
+ nanosleep( &tspec, &retspec );
+ //} while( tspec.tv_nsec != 0 );
+#else
+ usleep(50000);
+#endif /* __sun__ */
if( result < 0 ) throw_java_exception( env, IO_EXCEPTION,
"writeArray", strerror( errno ) );
}
-
/*----------------------------------------------------------
RXTXPort.drain
@@ -1113,7 +1189,6 @@ JNIEXPORT void JNICALL RXTXPort(eventLoop)( JNIEnv *env, jobject jobj )
{
int fd, ret, change;
fd_set rfds;
- struct timeval tv_sleep;
unsigned int mflags, omflags;
jboolean interrupted = 0;
#if defined TIOCSERGETLSR
@@ -1129,6 +1204,12 @@ JNIEXPORT void JNICALL RXTXPort(eventLoop)( JNIEnv *env, jobject jobj )
#if defined(TIOCSERGETLSR)
int has_tiocsergetlsr = 1;
#endif /* TIOCSERGETLSR */
+ struct timeval tv_sleep;
+#if defined (__sun__)
+ struct timespec retspec, tspec;
+ retspec.tv_sec = 0;
+ retspec.tv_nsec = 100000000;
+#endif /* __sun__ */
fd = get_java_var(env, jobj, "fd", "I");
@@ -1210,7 +1291,7 @@ JNIEXPORT void JNICALL RXTXPort(eventLoop)( JNIEnv *env, jobject jobj )
osis = sis;
}
#endif /* TIOCGICOUNT */
- /* A Portable implementation */
+ /* A Portable implementation */
if( ioctl( fd, TIOCMGET, &mflags ) ) break;
@@ -1229,11 +1310,31 @@ JNIEXPORT void JNICALL RXTXPort(eventLoop)( JNIEnv *env, jobject jobj )
omflags = mflags;
ioctl( fd, FIONREAD, &change );
+ /*
+ 50 ms sleep to make sure read can get in
+
+ what I think is happening here is the data writen is causing
+ signals, the event loop can't select with data available
+
+ I think things like BlackBox with 2 ports open are getting
+ signals for both the reciever and transmitter since they
+ are the same PID.
+
+ Things just start spinning out of control after that.
+ */
if( change )
{
if(!send_event( env, jobj, SPE_DATA_AVAILABLE, 1 ))
{
- usleep(100000); /* select wont block */
+ /* select wont block */
+#if defined (__sun__ )
+ // do {
+ // tspec = retspec;
+ nanosleep( &tspec, &retspec );
+ // } while( tspec.tv_nsec != 0 );
+#else
+ usleep(100000);
+#endif /* __sun__ */
}
}
}
@@ -1252,8 +1353,12 @@ RXTXCommDriver.testRead
support for non serial ports Trent
----------------------------------------------------------*/
-JNIEXPORT jboolean JNICALL RXTXCommDriver(testRead)(JNIEnv *env,
- jobject jobj, jstring tty_name, jint port_type )
+JNIEXPORT jboolean JNICALL RXTXCommDriver(testRead)(
+ JNIEnv *env,
+ jobject jobj,
+ jstring tty_name,
+ jint port_type
+)
{
struct termios ttyset;
char c;
@@ -1261,7 +1366,15 @@ JNIEXPORT jboolean JNICALL RXTXCommDriver(testRead)(JNIEnv *env,
const char *name = (*env)->GetStringUTFChars(env, tty_name, 0);
int ret = JNI_TRUE;
- if (!fhs_lock(name))
+ /*
+ LOCK is one of three functions defined in SerialImp.h
+
+ uucp_lock Solaris
+ fhs_lock Linux
+ system_does_not_lock Win32
+ */
+
+ if ( LOCK( name ) )
{
(*env)->ReleaseStringUTFChars(env, tty_name, name);
return JNI_FALSE;
@@ -1270,13 +1383,14 @@ JNIEXPORT jboolean JNICALL RXTXCommDriver(testRead)(JNIEnv *env,
/* CLOCAL eliminates open blocking on modem status lines */
/*
if ((fd = open(name, O_RDONLY | CLOCAL)) <= 0) {
+ fprintf( stderr "testRead() open failed\n" );
ret = JNI_FALSE;
goto END;
}
*/
do {
- fd=open (name, O_RDWR | O_NOCTTY | O_NONBLOCK );
- } while (fd < 0 && errno==EINTR);
+ fd=open ( name, O_RDWR | O_NOCTTY | O_NONBLOCK );
+ } while ( fd < 0 && errno==EINTR );
if( fd < 0 )
{
ret = JNI_FALSE;
@@ -1294,14 +1408,16 @@ JNIEXPORT jboolean JNICALL RXTXCommDriver(testRead)(JNIEnv *env,
}
/* save, restore later */
- if ((saved_flags = fcntl(fd, F_GETFL)) < 0) {
+ if ( ( saved_flags = fcntl(fd, F_GETFL ) ) < 0) {
+ fprintf( stderr, "testRead() fcntl(F_GETFL) failed\n" );
ret = JNI_FALSE;
goto END;
}
- memcpy(&saved_termios, &ttyset, sizeof(struct termios));
+ memcpy( &saved_termios, &ttyset, sizeof( struct termios ) );
- if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) {
+ if ( fcntl( fd, F_SETFL, O_NONBLOCK ) < 0 ) {
+ fprintf( stderr, "testRead() fcntl(F_SETFL) failed\n" );
ret = JNI_FALSE;
goto END;
}
@@ -1309,16 +1425,18 @@ JNIEXPORT jboolean JNICALL RXTXCommDriver(testRead)(JNIEnv *env,
cfmakeraw(&ttyset);
ttyset.c_cc[VMIN] = ttyset.c_cc[VTIME] = 0;
- if (tcsetattr(fd, TCSANOW, &ttyset) < 0) {
+ if ( tcsetattr( fd, TCSANOW, &ttyset) < 0 ) {
+ fprintf( stderr, "testRead() tcsetattr failed\n" );
ret = JNI_FALSE;
- tcsetattr(fd, TCSANOW, &saved_termios);
+ tcsetattr( fd, TCSANOW, &saved_termios );
goto END;
}
- if (read(fd, &c, 1) < 0)
+ if ( read( fd, &c, 1 ) < 0 )
{
#ifdef EWOULDBLOCK
if ( errno != EWOULDBLOCK )
{
+ fprintf( stderr, "testRead() read failed\n" );
ret = JNI_FALSE;
}
#else
@@ -1327,13 +1445,22 @@ JNIEXPORT jboolean JNICALL RXTXCommDriver(testRead)(JNIEnv *env,
}
/* dont walk over unlocked open devices */
- tcsetattr(fd, TCSANOW, &saved_termios);
- fcntl(fd, F_SETFL, saved_flags);
+ tcsetattr( fd, TCSANOW, &saved_termios );
+ fcntl( fd, F_SETFL, saved_flags );
}
+
+ /*
+ UNLOCK is one of three functions defined in SerialImp.h
+
+ uucp_unlock Solaris
+ fhs_unlock Linux
+ system_does_not_unlock Win32
+ */
+
END:
- (*env)->ReleaseStringUTFChars(env, tty_name, name);
- fhs_unlock(name);
- close(fd);
+ UNLOCK(name);
+ (*env)->ReleaseStringUTFChars( env, tty_name, name );
+ close( fd );
return ret;
}
#if defined(__APPLE__)
@@ -1356,19 +1483,19 @@ createSerialIterator(io_iterator_t *serialIterator)
CFMutableDictionaryRef classesToMatch;
if ((kernResult=IOMasterPort(NULL, &masterPort)) != KERN_SUCCESS)
{
- printf("IOMasterPort returned %d\n", kernResult);
- return kernResult;
+ printf("IOMasterPort returned %d\n", kernResult);
+ return kernResult;
}
if ((classesToMatch = IOServiceMatching(kIOSerialBSDServiceValue)) == NULL)
{
- printf("IOServiceMatching returned NULL\n");
- return kernResult;
+ printf("IOServiceMatching returned NULL\n");
+ return kernResult;
}
CFDictionarySetValue(classesToMatch, CFSTR(kIOSerialBSDTypeKey), CFSTR(kIOSerialBSDRS232Type));
kernResult = IOServiceGetMatchingServices(masterPort, classesToMatch, serialIterator);
if (kernResult != KERN_SUCCESS)
{
- printf("IOServiceGetMatchingServices returned %d\n", kernResult);
+ printf("IOServiceGetMatchingServices returned %d\n", kernResult);
}
return kernResult;
}
@@ -1762,13 +1889,14 @@ void report(char *msg)
#endif /* DEBUG */
}
+#ifndef WIN32
/*----------------------------------------------------------
fhs_lock
accept: The name of the device to try to lock
termios struct
perform: Create a lock file if there is not one already.
- return: 0 on failure 1 on success
+ return: 1 on failure 0 on success
exceptions: none
comments: This is for linux and freebsd only currently. I see SVR4 does
this differently and there are other proposed changes to the
@@ -1776,9 +1904,57 @@ void report(char *msg)
more reading:
+----------------------------------------------------------*/
+int fhs_lock( const char *filename )
+{
+ /*
+ * There is a zoo of lockdir possibilities
+ * Its possible to check for stale processes with most of them.
+ * for now we will just check for the lockfile on most
+ * Problem lockfiles will be dealt with. Some may not even be in use.
+ *
+ */
+ int fd,i;
+ char lockinfo[12], message[80];
+ char file[80], *p;
+
+ i = strlen( filename );
+ p = ( char * ) filename + i;
+ /* FIXME need to handle subdirectories /dev/cua/... */
+ while( *( p - 1 ) != '/' && i-- != 1 ) p--;
+ sprintf( file, "%s/LCK..%s", LOCKDIR, p );
+ if ( check_lock_status( filename ) )
+ {
+ fprintf(stderr, "fhs_lock() lockstatus fail\n");
+ return 1;
+ }
+ fd = open( file, O_CREAT | O_WRONLY | O_EXCL, 0666 );
+ if( fd < 0 )
+ {
+ fprintf(stderr,
+ "RXTX fhs_lock() Error: creating lock file: %s\n",
+ file );
+ return 1;
+ }
+ sprintf( lockinfo, "%10d\n",(int) getpid() );
+ write( fd, lockinfo, 11 );
+ close( fd );
+ return 0;
+}
+/*----------------------------------------------------------
+ uucp_lock
+
+ accept: char * filename. Device to be locked
+ perform: Try to get a uucp_lock
+ return: int 0 on success
+ exceptions: none
+ comments:
The File System Hierarchy Standard
http://www.pathname.com/fhs/
+ UUCP Lock Files
+ http://docs.freebsd.org/info/uucp/uucp.info.UUCP_Lock_Files.html
+
FSSTND
ftp://tsx-11.mit.edu/pub/linux/docs/linux-standards/fsstnd/
@@ -1788,175 +1964,435 @@ void report(char *msg)
"UNIX Network Programming", W. Richard Stevens,
Prentice-Hall, 1990, pages 96-101.
+ There is much to do here.
+
+ 1) UUCP style locks (done)
+ /var/spool/uucp
+ 2) SVR4 locks
+ /var/spool/locks
+ 3) FSSTND locks (done)
+ /var/lock
+ 4) handle stale locks (done except kermit locks)
+ 5) handle minicom lockfile contents (FSSTND?)
+ " 16929 minicom root\n" (done)
+ 6) there are other Lock conventions that use Major and Minor
+ numbers...
+ 7) Stevens recommends LCK..<pid>
+
+ most are caught above. If they turn out to be problematic
+ rather than an exercise, we will handle them.
+
----------------------------------------------------------*/
-int fhs_lock( const char *filename )
+int uucp_lock( const char *filename )
{
-#ifdef LOCKFILES
- int i,j,fd, pid;
- char lockinfo[12], file[80], pid_buffer[20], message[80],*p;
+ char lockfilename[80], lockinfo[12], message[80];
+ char name[80];
+ int fd;
struct stat buf;
- struct stat buf2;
- const char *lockdirs[]={ "/etc/locks", "/usr/spool/kermit",
- "/usr/spool/locks", "/usr/spool/uucp", "/usr/spool/uucp/",
- "/usr/spool/uucp/LCK", "/var/lock", "/var/lock/modem",
- "/var/spool/lock", "/var/spool/locks", "/var/spool/uucp",NULL
- };
- struct group *g=getgrnam("uucp");
- struct passwd *user=getpwuid(geteuid());
- /* This checks if the effective user is in group uucp so we can
- * create lock files. If not we give them a warning and bail.
- * If its root we just skip the test.
- */
- if(strcmp(user->pw_name,"root"))
+ sprintf( message, "uucp_lock( %s );\n", filename );
+ report( message );
+
+ if ( check_lock_status( filename ) )
+ {
+ report( "RXTX uucp check_lock_status true\n" );
+ return 1;
+ }
+ if ( stat( LOCKDIR, &buf ) != 0 )
+ {
+ report("RXTX uucp_lock() could not find lock directory.\n");
+ return 1;
+ }
+ if ( stat( filename, &buf ) != 0 )
{
- while(*g->gr_mem)
+ report("RXTX uucp_lock() could not find device.\n");
+ printf("device was %s\n", name);
+ return 1;
+ }
+ sprintf( lockfilename, "%s/LK.%03d.%03d.%03d",
+ LOCKDIR,
+ (int) major( buf.st_dev ),
+ (int) major( buf.st_rdev ),
+ (int) minor( buf.st_rdev )
+ );
+ sprintf( lockinfo, "%10d\n", (int) getpid() );
+ if ( stat( lockfilename, &buf ) == 0 )
+ {
+ fprintf( stderr, "RXTX uucp_lock() %s is there\n",
+ lockfilename );
+ return 1;
+ }
+ fd = open( lockfilename, O_CREAT | O_WRONLY | O_EXCL, 0666 );
+ if( fd < 0 )
+ {
+ fprintf( stderr,
+ "RXTX uucp_lock() Error: creating lock file: %s\n",
+ lockfilename );
+ return 1;
+ }
+ write( fd, lockinfo,11 );
+ close( fd );
+ return 0;
+}
+
+
+/*----------------------------------------------------------
+ check_lock_status
+
+ accept: the lock name in question
+ perform: Make sure everything is sane
+ return: 0 on success
+ exceptions: none
+ comments:
+----------------------------------------------------------*/
+int check_lock_status( const char *filename )
+{
+ struct stat buf;
+ /* First, can we find the directory? */
+
+ if ( stat( LOCKDIR, &buf ) != 0 )
+ {
+ report("could not find lock directory.\n");
+ return 1;
+ }
+
+ /* OK. Are we able to write to it? */
+
+ if ( check_group_uucp() )
+ {
+ report("No permission to create lock file\n");
+ return 1;
+ }
+
+ /* is the device alread locked */
+
+ if ( is_device_locked( filename ) )
+ {
+ report("device is locked by another application\n");
+ return 1;
+ }
+ return 0;
+
+}
+
+/*----------------------------------------------------------
+ fhs_unlock
+
+ accept: The name of the device to unlock
+ perform: delete the lock file
+ return: none
+ exceptions: none
+ comments: This is for linux only currently. I see SVR4 does this
+ differently and there are other proposed changes to the
+ Filesystem Hierachy Standard
+----------------------------------------------------------*/
+void fhs_unlock( const char *filename )
+{
+ char file[80],*p;
+ int i;
+
+ i = strlen( filename );
+ p = ( char * ) filename + i;
+ /* FIXME need to handle subdirectories /dev/cua/... */
+ while( *( p - 1 ) != '/' && i-- != 1 ) p--;
+ sprintf( file, "%s/LCK..%s", LOCKDIR, p );
+
+ if( !check_lock_pid( file ) )
+ {
+ unlink(file);
+ }
+}
+
+/*----------------------------------------------------------
+ uucp_unlock
+
+ accept: char *filename the device that is locked
+ perform: remove the uucp lockfile if it exists
+ return: none
+ exceptions: none
+ comments: http://docs.freebsd.org/info/uucp/uucp.info.UUCP_Lock_Files.html
+----------------------------------------------------------*/
+void uucp_unlock( const char *filename )
+{
+ struct stat buf;
+ char file[80],*p, message[80];
+ int i;
+ /* FIXME */
+
+ sprintf( message, "uucp_unlock( %s );\n", filename );
+ report( message );
+ i = strlen(filename);
+ p = (char *) filename+i;
+ while( *(p-1) != '/' && i-- != 0) p--;
+ if ( stat( filename, &buf ) != 0 )
+ {
+ /* hmm the file is not there? */
+ report("uucp() unlock no such device\n");
+ return;
+ }
+ sprintf( file, LOCKDIR"/LK.%03d.%03d.%03d",
+ (int) major( buf.st_dev ),
+ (int) major( buf.st_rdev ),
+ (int) minor( buf.st_rdev )
+ );
+ if ( stat( file, &buf ) != 0 )
+ {
+ /* hmm the file is not there? */
+ report("uucp() unlock no such lockfile\n");
+ return;
+ }
+ if( !check_lock_pid( file ) )
+ {
+ sprintf( message, "uucp unlinking %s\n", file );
+ report( message );
+ unlink(file);
+ }
+ else
+ {
+ sprintf( message, "uucp unlinking failed %s\n", file );
+ report( message );
+ }
+}
+
+/*----------------------------------------------------------
+ check_lock_pid
+
+ accept: the name of the lockfile
+ perform: make sure the lock file is ours.
+ return: 0 on success
+ exceptions: none
+ comments:
+----------------------------------------------------------*/
+int check_lock_pid( const char *file )
+{
+ int fd;
+ char pid_buffer[12];
+
+ fd=open( file, O_RDONLY );
+ if ( fd < 0 )
+ {
+ return( 1 );
+ }
+ if ( read( fd, pid_buffer, 11 ) < 0 )
+ {
+ close( fd );
+ return( 1 );
+ }
+ close( fd );
+ if ( atol( pid_buffer ) != getpid() )
+ {
+ return( 1 );
+ }
+ return( 0 );
+}
+/*----------------------------------------------------------
+ check_group_uucp
+
+ accept: none
+ perform: check if the user is root or in group uucp
+ return: 0 on success
+ exceptions: none
+ comments:
+ This checks if the effective user is in group uucp so we can
+ create lock files. If not we give them a warning and bail.
+ If its root we just skip the test.
+----------------------------------------------------------*/
+int check_group_uucp()
+{
+ struct group *g = getgrnam( "uucp" );
+ struct passwd *user = getpwuid( geteuid() );
+
+ if( strcmp( user->pw_name, "root" ) )
+ {
+ while( *g->gr_mem )
{
- if(!strcmp(*g->gr_mem,user->pw_name))
+ if( !strcmp( *g->gr_mem, user->pw_name ) )
+ {
break;
+ }
*g->gr_mem++;
}
- if(!*g->gr_mem)
+ if( !*g->gr_mem )
{
- printf(UUCP_ERROR);
- return 0;
+ printf( UUCP_ERROR );
+ return 1;
}
}
+ return 0;
+}
- /* no lock dir? just return success */
+/*----------------------------------------------------------
+ is_device_locked
- if (stat(LOCKDIR,&buf)!=0)
- {
- report("could not find lock directory.\n");
- return 1;
- }
+ accept: char * filename. The device in question including the path.
+ perform: see if one of the many possible lock files is aready there
+ if there is a stale lock, remove it.
+ return: 1 if the device is locked or somethings wrong.
+ 0 if its possible to create our own lock file.
+ exceptions: none
+ comments: check if the device is already locked
+----------------------------------------------------------*/
+int is_device_locked( const char *filename )
+{
+ const char *lockdirs[] = { "/etc/locks", "/usr/spool/kermit",
+ "/usr/spool/locks", "/usr/spool/uucp", "/usr/spool/uucp/",
+ "/usr/spool/uucp/LCK", "/var/lock", "/var/lock/modem",
+ "/var/spool/lock", "/var/spool/locks", "/var/spool/uucp",NULL
+ };
+ const char *lockprefixes[] = { "LK..", "lk..", "LK." };
+ char *p, file[80], pid_buffer[20], message[80];
+ int i = 0, j, k, fd , pid;
+ struct stat buf;
+ struct stat buf2;
- /*
- * There is a zoo of lockdir possibilities
- * Its possible to check for stale processes with most of them.
- * for now we will just check for the lockfile on most
- * Problem lockfiles will be dealt with. Some may not even be in use.
- *
- */
+ i = strlen( filename );
+ p = ( char * ) filename+i;
+ while( *( p-1 ) != '/' && i-- !=1 ) p--;
+ sprintf( file, "%s/%s%s", LOCKDIR, LOCKFILEPREFIX, p );
- j=0;
- while(lockdirs[j])
+ while( lockdirs[i] )
{
- if (stat(lockdirs[j],&buf2) == 0)
+ /*
+ Look for lockfiles in all known places other than the
+ defined lock directory for this system
+ */
+ if( ( stat( file, &buf2 ) == 0 ) &&
+ strncmp( lockdirs[i], LOCKDIR, strlen( lockdirs[i] ) )
+ )
{
-
- if((buf2.st_dev != buf.st_dev)
- || (buf2.st_ino != buf.st_ino))
+ if ( ( buf2.st_dev != buf.st_dev ) ||
+ ( buf2.st_ino != buf.st_ino ) )
{
- i=strlen(filename);
- p=(char *) filename+i;
- while(*(p-1)!='/' && i-- !=1) p--;
- sprintf(file,"%s/LCK..%s",lockdirs[j],p);
- if(stat(file,&buf)==0)
+ j = strlen( filename );
+ p = ( char * ) filename + j;
+
+ /*
+ FIXME
+ SCO Unix use lowercase all the time
+ I'm not sure if the define is correct
+ taj
+ */
+ while( *( p-1 ) != '/' && j-- != 1 )
{
- printf("---------------------------\n");
- printf(UNEXPECTED_LOCK_FILE, file);
- printf("---------------------------\n");
- return 0;
+#if defined ( __sco__ )
+ *p = tolower(*p);
+#endif /* __sco__ */
+ p--;
+ }
+ k=0;
+ while ( lockprefixes[k] )
+ {
+ /* FHS style */
+ sprintf( file, "%s/%s%s", lockdirs[i],
+ lockprefixes[k++], p );
+ if( stat( file, &buf ) == 0 )
+ {
+ fprintf( stderr, UNEXPECTED_LOCK_FILE );
+ return 1;
+ }
+
+ /* UUCP style */
+ sprintf( file, "%s/%s%03d.%03d.%03d",
+ lockdirs[i],
+ lockprefixes[k++],
+ (int) major( buf.st_dev ),
+ (int) major( buf.st_rdev ),
+ (int) minor( buf.st_rdev )
+ );
+ if( stat( file, &buf ) == 0 )
+ {
+ fprintf( stderr, UNEXPECTED_LOCK_FILE );
+ return 1;
+ }
}
}
}
- j++;
+ i++;
}
-
- /*
- check if the device is already locked
- There is much to do here.
-
- 1) UUCP style locks
- /var/spool/uucp
- 2) SVR4 locks
- /var/spool/locks
- 3) FSSTND locks
- /var/lock (done)
- 4) handle stale locks (done except kermit locks)
- 5) handle minicom lockfile contents (FSSTND?)
- " 16929 minicom root\n" (done)
- 6) there are other Lock conventions that use Major and Minor
- numbers...
- 7) Stevens recommends LCK..<pid>
- most are caught above. If they turn out to be problematic rather than
- an exercise, we will handle them.
+ /*
+ OK. We think there are no unexpect lock files for this device
+ Lets see if there any stale lock files that need to be
+ removed.
*/
+
+#ifdef FHS
+ /* FHS standard locks */
+ i = strlen( filename );
+ p = ( char * ) filename + i;
+ while( *(p-1) != '/' && i-- != 1) p--;
+ sprintf( file, "%s/%s%s", LOCKDIR, LOCKFILEPREFIX, p );
+#else
+ /* UUCP standard locks */
+ if ( stat( filename, &buf ) != 0 )
+ {
+ report("RXTX is_device_locked() could not find device.\n");
+ return 1;
+ }
+ sprintf( file, "%s/LK.%03d.%03d.%03d",
+ LOCKDIR,
+ (int) major( buf.st_dev ),
+ (int) major( buf.st_rdev ),
+ (int) minor( buf.st_rdev )
+ );
- i=strlen(filename);
- p=(char *) filename+i;
- while(*(p-1)!='/' && i-- !=1) p--;
- sprintf(file,"%s/LCK..%s",LOCKDIR,p);
+#endif /* FHS */
- if(stat(file,&buf)==0)
+ if( stat( file, &buf )==0 )
{
+
/* check if its a stale lock */
- fd=open(file,O_RDONLY);
- read(fd,pid_buffer,11);
- close(fd);
- sscanf(pid_buffer, "%d", &pid);
+ fd=open( file, O_RDONLY );
+ read( fd, pid_buffer, 11 );
+ close( fd );
+ sscanf( pid_buffer, "%d", &pid );
- if( kill((pid_t) pid, 0) && errno==ESRCH )
+ if( kill( (pid_t) pid, 0 ) && errno==ESRCH )
{
- fprintf(stderr,
- "RXTX Warning: Removing stale lock file.\n");
- if(unlink(file) != 0)
+ fprintf( stderr,
+ "RXTX Warning: Removing stale lock file. %s\n",
+ file );
+ if( unlink( file ) != 0 )
{
- snprintf(message, 80, "RXTX Error: Unable to \
+ snprintf( message, 80, "RXTX Error: Unable to \
remove stale lock file: %s\n",
file
);
- fprintf(stderr, message);
- return 0;
+ report( message );
+ return 1;
}
}
- else return 0;
- }
- fd=open(file, O_CREAT | O_WRONLY | O_EXCL, 0666);
- if(fd < 0)
- {
- snprintf(message, 80,
- "RXTX Error: Unable to create lock file: %s\n\n", file);
- fprintf(stderr, message);
- return 0;
}
- sprintf(lockinfo,"%10d\n",getpid());
- write(fd, lockinfo,11);
- close(fd);
- return 1;
+ return 0;
+}
+#endif /* WIN32 */
-#else /* FIXME... This needs to work on all systems that use Lock Files */
- return 1;
-#endif /* LOCKFILES */
+/*----------------------------------------------------------
+ system_does_not_lock
+ accept: the filename the system thinks should be locked.
+ perform: avoid trying to create lock files on systems that dont use them
+ return: 0 for success ;)
+ exceptions: none
+ comments: OS's like Win32 may not have lock files.
+----------------------------------------------------------*/
+int system_does_not_lock( const char * filename )
+{
+ return 0;
}
/*----------------------------------------------------------
- fhs_unlock
+ system_does_not_unlock
- accept: The name of the device to unlock
- perform: delete the lock file
+ accept: the filename the system thinks should be locked.
+ perform: avoid trying to create lock files on systems that dont use them
return: none
exceptions: none
- comments: This is for linux only currently. I see SVR4 does this
- differently and there are other proposed changes to the
- Filesystem Hierachy Standard
+ comments: OS's like Win32 may not have lock files.
----------------------------------------------------------*/
-void fhs_unlock( const char *filename )
+void system_does_not_unlock( const char * filename )
{
-#ifdef LOCKFILES
- char file[80],*p;
- int i;
-
- i=strlen(filename);
- p=(char *) filename+i;
- while(*(p-1)!='/' && i-- !=0) p--;
- sprintf(file,"%s/LCK..%s",LOCKDIR,p);
-
- unlink(file);
-#endif /* LOCKFILES */
+ return;
}
/*----------------------------------------------------------
View
17 src/SerialImp.h
@@ -66,51 +66,62 @@
#if defined(__linux__)
# define DEVICEDIR "/dev/"
# define LOCKDIR "/var/lock"
+# define LOCKFILEPREFIX "LCK.."
# define FHS
#endif /* __linux__ */
#if defined(__sgi__) || defined(sgi)
# define DEVICEDIR "/dev/"
# define LOCKDIR "/usr/spool/uucp"
+# define LOCKFILEPREFIX "LK."
# define UUCP
#endif /* __sgi__ || sgi */
#if defined(__FreeBSD__)
# define DEVICEDIR "/dev/"
-# define LOCKDIR "/var/spool/uucp/"
+# define LOCKDIR "/var/spool/uucp"
+# define LOCKFILEPREFIX "LK."
# define UUCP
#endif
#if defined(__APPLE__)
# define DEVICEDIR "/dev/"
-# define LOCKDIR "/var/spool/uucp/"
+# define LOCKDIR "/var/spool/uucp"
+# define LOCKFILEPREFIX "LK."
+# define UUCP
#endif /* __FreeBSD__ */
#if defined(__NetBSD__)
# define DEVICEDIR "/dev/"
# define LOCKDIR "/usr/spool/uucp"
+# define LOCKFILEPREFIX "LK."
# define UUCP
#endif /* __NetBSD__ */
#if defined(__hpux__)
/* modif cath */
# define DEVICEDIR "/dev/"
# define LOCKDIR "/usr/spool/uucp"
+# define LOCKFILEPREFIX "LK."
# define UUCP
#endif /* __hpux__ */
#if defined(__osf__) /* Digital Unix */
# define DEVICEDIR "/dev/"
# define LOCKDIR ""
+# define LOCKFILEPREFIX "LK."
# define UUCP
#endif /* __osf__ */
#if defined(__sun__) /* Solaris */
# define DEVICEDIR "/dev/"
# define LOCKDIR "/var/spool/locks"
+# define LOCKFILEPREFIX "LK."
# define UUCP
-#endif /* solaris */
+#endif /* __sun__ */
#if defined(__BEOS__)
# define DEVICEDIR "/dev/ports/"
# define LOCKDIR ""
+# define LOCKFILEPREFIX ""
# define UUCP
#endif /* __BEOS__ */
#if defined(WIN32)
# define DEVICEDIR ""
# define LOCKDIR ""
+# define LOCKFILEPREFIX ""
#endif /* WIN32 */
/* That should be all you need to look at in this file for porting */
View
8 src/gnu/io/RXTXCommDriver.java
@@ -348,6 +348,14 @@ else if(osName.equals("NetBSD")) // FIXME this is probably wrong