Date: Sun, 19 Nov 1995 15:47:01 -0500 From: john@jwlab.feith.com (John Wehle) Message-Id: <199511192047.PAA08622@jwlab.FEITH.COM> To: ptolemy-hackers@messier.EECS.Berkeley.EDU Subject: Ptolemy 0.5.2 patches for FreeBSD 2.1 Content-Type: text Sender: owner-ptolemy-hackers@EECS.Berkeley.EDU Precedence: bulk As a side effect of adding support for FreeBSD 2.1 the following problems with octtools have been fixed: 1) RPCfread which is defined in Xpackages/rpc/rpc.c as well as vem/rpc/rpc.c didn't increment "ptr". 2) RPCProcessFileWriteRequest which is defined in vem/rpc/serverNet.c didn't test for EWOULDBLOCK correctly. 3) RPCVEMRequest didn't handle RPC_CLEAN_EXIT_FUNCTION correctly. It would close down the stream and then try to flush the closed (therefore nonexistent) stream. Enjoy! -- John Wehle (john@feith.com) PS: Please note that I'm not currently a member of this mailing list so if you want me to respond to something you'll have to email me directly. -------------8<-------------------8<---------------------8<--------------- #!/bin/sh # This is a shell archive (produced by GNU sharutils 4.1). # To extract the files from this archive, save it to some FILE, remove # everything before the `!/bin/sh' line above, then type `sh FILE'. # # Made on 1995-11-19 15:20 EST by . # Source directory was `/local/home/john/tmp'. # # Existing files will *not* be overwritten unless `-c' is specified. # # This shar contains: # length mode name # ------ ---------- ------------------------------------------ # 14230 -rw-r--r-- PatchJLW01a # 2453 -rw-r--r-- PatchJLW01b # touch -am 1231235999 $$.touch >/dev/null 2>&1 if test ! -f 1231235999 && test -f $$.touch; then shar_touch=touch else shar_touch=: echo echo 'WARNING: not restoring timestamps. Consider getting and' echo "installing GNU \`touch', distributed in GNU File Utilities..." echo fi rm -f 1231235999 $$.touch # # ============= PatchJLW01a ============== if test -f 'PatchJLW01a' && test X"$1" != X"-c"; then echo 'x - skipping PatchJLW01a (file already exists)' else echo 'x - extracting PatchJLW01a (text)' sed 's/^X//' << 'SHAR_EOF' > 'PatchJLW01a' && *** ./bin/ptarch.ORIGINAL Sat Nov 4 18:28:48 1995 --- ./bin/ptarch Sat Nov 4 18:53:56 1995 *************** *** 103,108 **** --- 103,112 ---- X echo nbsd.386 X exit 0 ;; X + i[34]86:FreeBSD:*:*) + echo freebsd + exit 0 ;; + X esac X X #echo '(No uname command or uname output not recognized.)' 1>&2 *** /dev/null Sun Nov 19 09:24:19 1995 --- ./mk/config-freebsd.mk Fri Nov 10 13:15:15 1995 *************** *** 0 **** --- 1,111 ---- + # Copyright (c) 1990- The Regents of the University of California. + # All rights reserved. + # + # Permission is hereby granted, without written agreement and without + # license or royalty fees, to use, copy, modify, and distribute this + # software and its documentation for any purpose, provided that the + # above copyright notice and the following two paragraphs appear in all + # copies of this software. + # + # IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY + # FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + # ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF + # THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF + # SUCH DAMAGE. + # + # THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE + # PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF + # CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, + # ENHANCEMENTS, OR MODIFICATIONS. + # + # PT_COPYRIGHT_VERSION_2 + # COPYRIGHTENDKEY + # + # + # @(#)config-freebsd.mk + # + # Programmer: John Wehle + # john@feith.com + # -------------------------------------------------------------------- + # | Please see the file ``config-default.mk'' in this directory! | + # -------------------------------------------------------------------- + include $(ROOT)/mk/config-default.mk + + # Get the g++ definitions; we override some below. + include $(ROOT)/mk/config-g++.mk + + # + # Programs to use + # + RANLIB = ranlib + # Use gcc everywhere including in octtools + CC = gcc + CPLUSPLUS = g++ -I$(ROOT)/src/compat/freebsd + + OCTTOOLS_MM_LIB= + OCT_CC = gcc $(OCTTOOLS_MM_LIB) + + SYSTEMDEF= -Dfreebsd + OPTIMIZER= -O2 -m486 -pipe + #OPTIMIZER= -O2 -m486 -fomit-frame-pointer -pipe + + # Under gcc-2.7.0, you will need to add -fno-for-scope to $WARNINGS + WARNINGS = -Wall -Wcast-align #-Wcast-qual + GPPFLAGS = $(SYSTEMDEF) $(WARNINGS) $(EXTRA_OPTIMIZER) $(OPTIMIZER) $(MEMLOG) + CFLAGS = $(SYSTEMDEF) $(WARNINGS) $(EXTRA_OPTIMIZER) $(OPTIMIZER) $(MEMLOG) \ + -fwritable-strings + GNULIB = /usr/lib + + # + # Variables for the linker + # + + # Flag that gcc expects to create statically linked binaries. + # Binaries that are shipped should be statically linked. + CC_STATIC = -static + + SYSLIBS=-lg++ -lm -lc -lcompat + + LINKFLAGS=-L$(LIBDIR) -Xlinker -S -Xlinker -x -static + LINKFLAGS_D=-L$(LIBDIR) -g -static + + # octtools/attache uses this + TERMLIB_LIBSPEC = -ltermcap + + # ptcl and pigiRPc use this for cuserid.o when CGTarget is used + # only defined in this config file + COMPATLIB = -lcompat + + # + # Directories to use + # + X11_INCSPEC = -I/usr/X11R6/include + X11INCL = -I/usr/X11R6/include + X11_LIBSPEC = -L/usr/X11R6/lib -lX11 + + # Use -lSM -lICE for X11R6, don't use then for X11R5 + X11EXT_LIBSPEC=-lXext -lSM -lICE + #X11EXT_LIBSPEC=-lXext + + # Variables for Pure Inc tools (purify, purelink, quantify) + # Most users don't have Pure Inc tools, so we leave them out for release + #COLLECTOR = -collector=$(ROOT)/gnu/sun4/lib/gcc-lib/sun4/2.5.8/ld + #PURELINK = purelink $(COLLECTOR) + #PURIFY = purelink $(COLLECTOR) purify + #QUANTIFY = purelink $(COLLECTOR) quantify + + COLLECTOR = + PURELINK = + PURIFY = + QUANTIFY = + + # Variable for the Ariel DSP56000 board + # Most users don't have the Ariel board, so we leave the code out + #S56DIR = $(ROOT)/vendors/s56dsp + S56DIR = + + # Used to compile xv. Use -traditional to avoid varargs problems + XV_CC = gcc -traditional $(X11_INCSPEC) $(X11_LIBSPEC) + XMKMF = xmkmf *** /dev/null Sun Nov 19 09:24:19 1995 --- ./src/compat/freebsd/minmax.h Sat Nov 4 23:46:16 1995 *************** *** 0 **** --- 1,46 ---- + /* + Copyright (c) 1990-1995 The Regents of the University of California. + All rights reserved. + + Permission is hereby granted, without written agreement and without + license or royalty fees, to use, copy, modify, and distribute this + software and its documentation for any purpose, provided that the + above copyright notice and the following two paragraphs appear in all + copies of this software. + + IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY + FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF + THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + + THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE + PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF + CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, + ENHANCEMENTS, OR MODIFICATIONS. + + PT_COPYRIGHT_VERSION_2 + COPYRIGHTENDKEY + */ + // @(#)minmax.h 1.2 3/2/95 + #ifndef _minmax_h + #define _minmax_h 1 + + // min and max functions, to match those defined in the libg++ minmax.h. + + // with templates we will need only + // template inline T min(T a, T b) {return (a < b ? a : b);} + // template inline T max(T a, T b) {return (a > b ? a : b);} + + inline double min(double a, double b) {return (a < b ? a : b);} + inline float min(float a, float b) {return (a < b ? a : b);} + inline int min(int a, int b) {return (a < b ? a : b);} + inline unsigned min(unsigned a, unsigned b) {return (a < b ? a : b);} + inline double max(double a, double b) {return (a > b ? a : b);} + inline float max(float a, float b) {return (a > b ? a : b);} + inline int max(int a, int b) {return (a > b ? a : b);} + inline unsigned max(unsigned a, unsigned b) {return (a > b ? a : b);} + + #endif *** ./src/compat/ptolemy/compat.h.ORIGINAL Wed May 24 12:46:23 1995 --- ./src/compat/ptolemy/compat.h Sat Nov 4 20:14:46 1995 *************** *** 53,58 **** --- 53,62 ---- X #define PTALPHA X #endif X + #if defined(freebsd) + #define PTFREEBSD + #endif + X #if defined(hpux) || defined(__hpux) X /* HP PA, cfront or g++ */ X #define PTHPPA *************** *** 136,142 **** X #endif /* PTSUN4_CFRONT or PTHPPA_CFRONT or non-ansi cc*/ X #endif /* ! VOLATILE */ X ! #if !defined(PTLINUX) && !defined(PTNBSD_386) X #if defined(USG) && ! defined(PTHPPA) && ! defined(PTAIX) X extern int sprintf(); X #else --- 140,146 ---- X #endif /* PTSUN4_CFRONT or PTHPPA_CFRONT or non-ansi cc*/ X #endif /* ! VOLATILE */ X ! #if !defined(PTLINUX) && !defined(PTNBSD_386) && !defined(PTFREEBSD) X #if defined(USG) && ! defined(PTHPPA) && ! defined(PTAIX) X extern int sprintf(); X #else *************** *** 162,168 **** X #endif X #endif /* PTLINUX */ X ! #if defined(__GNUC__) && !defined(PTNBSD_386) X X #include /* Get the decl for FILE. sigh. X * Also get sprintf() for linux. */ --- 166,172 ---- X #endif X #endif /* PTLINUX */ X ! #if defined(__GNUC__) && !defined(PTNBSD_386) && !defined(PTFREEBSD) X X #include /* Get the decl for FILE. sigh. X * Also get sprintf() for linux. */ *************** *** 298,304 **** X X X #ifdef NEED_SYS_ERRLIST ! #ifdef PTNBSD_386 X extern const char *const sys_errlist[]; X #else X extern char *sys_errlist[]; --- 302,308 ---- X X X #ifdef NEED_SYS_ERRLIST ! #if defined(PTNBSD_386) || defined(PTFREEBSD) X extern const char *const sys_errlist[]; X #else X extern char *sys_errlist[]; *************** *** 368,385 **** X X /* Use SystemV curses? See octtools/attache/io.c X */ ! #if defined(PTHPPA) || defined(SYSV) || defined(PTLINUX) || defined(PTALPHA) X #define USE_SYSV_CURSES X #endif X X /* Do we need to defined stricmp()? See octtools/installColors/installColors.c X */ ! #if defined(PT_ULTRIX) || defined(PTHPPA) || defined(PTIRIX5) || defined(PTSOL2) || defined(PTLINUX) || defined(PTALPHA) || defined(PTNBSD_386) || defined(PTAIX) X #define NEED_STRICMP X #endif X X /* Do we have termios.h? See octtools/Xpackages/iv/ivGetLine.c */ ! #if defined(PTHPPA) || defined(SYSV) || defined(PTIRIX5) || defined(PTLINUX) X #define HAS_TERMIOS X #endif X --- 372,389 ---- X X /* Use SystemV curses? See octtools/attache/io.c X */ ! #if defined(PTHPPA) || defined(SYSV) || defined(PTLINUX) || defined(PTALPHA) || defined(PTFREEBSD) X #define USE_SYSV_CURSES X #endif X X /* Do we need to defined stricmp()? See octtools/installColors/installColors.c X */ ! #if defined(PT_ULTRIX) || defined(PTHPPA) || defined(PTIRIX5) || defined(PTSOL2) || defined(PTLINUX) || defined(PTALPHA) || defined(PTNBSD_386) || defined(PTAIX) || defined(PTFREEBSD) X #define NEED_STRICMP X #endif X X /* Do we have termios.h? See octtools/Xpackages/iv/ivGetLine.c */ ! #if defined(PTHPPA) || defined(SYSV) || defined(PTIRIX5) || defined(PTLINUX) || defined(PTFREEBSD) X #define HAS_TERMIOS X #endif X *** ./src/domains/thor/pepp/comdefs.h.ORIGINAL Sun Mar 5 21:14:33 1995 --- ./src/domains/thor/pepp/comdefs.h Sun Nov 5 00:52:20 1995 *************** *** 57,63 **** X #define PEPPCPPENV "PEPPCPP" X #endif X ! #ifdef PTNBSD_386 X #define ssignal(A,B) signal(A,B(A)) X #define gsignal(A) signal(A,SIG_DFL) X #endif --- 57,63 ---- X #define PEPPCPPENV "PEPPCPP" X #endif X ! #if defined(PTNBSD_386) || defined(PTFREEBSD) X #define ssignal(A,B) signal(A,B(A)) X #define gsignal(A) signal(A,SIG_DFL) X #endif *** ./src/kernel/State.h.ORIGINAL Sun Mar 5 21:58:50 1995 --- ./src/kernel/State.h Sat Nov 4 23:09:54 1995 *************** *** 53,59 **** X X extern int sys_nerr; X ! #ifdef netbsd_i386 X extern const char *const sys_errlist[]; X #else X extern char *sys_errlist[]; --- 53,59 ---- X X extern int sys_nerr; X ! #if defined(netbsd_i386) || defined(freebsd) X extern const char *const sys_errlist[]; X #else X extern char *sys_errlist[]; *** ./src/kernel/Linker.sysdep.h.ORIGINAL Mon Apr 24 00:27:42 1995 --- ./src/kernel/Linker.sysdep.h Thu Nov 9 03:41:32 1995 *************** *** 103,109 **** X X // The loader should do incremental linking; use a 4.3/Sun-style loader X // or use the Gnu loader. ! #if defined(PTIRIX5) || defined (PTIRIX5) || defined (PTLINUX) || defined(PTNBSD_386) X // For USE_DLOPEN, we need ld so we can process .o files into .so files X #define LOADER "/usr/bin/ld" X #else --- 103,109 ---- X X // The loader should do incremental linking; use a 4.3/Sun-style loader X // or use the Gnu loader. ! #if defined(PTIRIX5) || defined (PTIRIX5) || defined (PTLINUX) || defined(PTNBSD_386) || defined(PTFREEBSD) X // For USE_DLOPEN, we need ld so we can process .o files into .so files X #define LOADER "/usr/bin/ld" X #else *************** *** 131,137 **** X #if defined(PTAIX) X #define NM_PROGRAM "/usr/ucb/nm" X #else ! #if defined(PTIRIX5) || defined (PTLINUX) || defined(PTNBSD_386) X #define NM_PROGRAM "/usr/bin/nm" X #else X #ifdef PTSOL2 --- 131,137 ---- X #if defined(PTAIX) X #define NM_PROGRAM "/usr/ucb/nm" X #else ! #if defined(PTIRIX5) || defined (PTLINUX) || defined(PTNBSD_386) || defined(PTFREEBSD) X #define NM_PROGRAM "/usr/bin/nm" X #else X #ifdef PTSOL2 *************** *** 183,191 **** X #ifdef PTHPPA X inline size_t getpagesize() { return 4096;} X #else ! #if defined(PTLINUX) || defined(PTALPHA) || defined(PTNBSD_386) X #include ! #else /* PTLINUX || PTALPHA || PTNBSD_386 */ X #ifdef __GNUG__ X #ifdef PTIRIX5 X #if defined(__SYSTYPE_SVR4) || defined(SYSTYPE_SVR4) --- 183,191 ---- X #ifdef PTHPPA X inline size_t getpagesize() { return 4096;} X #else ! #if defined(PTLINUX) || defined(PTALPHA) || defined(PTNBSD_386) || defined(PTFREEBSD) X #include ! #else /* PTLINUX || PTALPHA || PTNBSD_386 || PTFREEBSD */ X #ifdef __GNUG__ X #ifdef PTIRIX5 X #if defined(__SYSTYPE_SVR4) || defined(SYSTYPE_SVR4) *************** *** 421,427 **** X #endif X #endif X ! #if defined(PTLINUX) || defined(PTNBSD_386) X #define STRUCT_DEFS exec header X #define READHEAD_FAIL (read (fd, (char*) &header, sizeof(header)) <= 0) X #define OBJ_READ_SIZE ((size_t)(header.a_text + header.a_data)) --- 421,427 ---- X #endif X #endif X ! #if defined(PTLINUX) || defined(PTNBSD_386) || defined(PTFREEBSD) X #define STRUCT_DEFS exec header X #define READHEAD_FAIL (read (fd, (char*) &header, sizeof(header)) <= 0) X #define OBJ_READ_SIZE ((size_t)(header.a_text + header.a_data)) *** ./src/kernel/ptsignals.cc.ORIGINAL Fri Mar 24 19:37:13 1995 --- ./src/kernel/ptsignals.cc Sun Nov 5 22:37:26 1995 *************** *** 88,93 **** --- 88,94 ---- X */ X X + #include X #include X #include "compat.h" X *** ./src/pigilib/pigiLoader.cc.ORIGINAL Sat Nov 4 18:29:26 1995 --- ./src/pigilib/pigiLoader.cc Sun Nov 5 03:07:18 1995 *************** *** 39,45 **** --- 39,47 ---- X X **************************************************************************/ X + #if !defined(freebsd) X #define NEED_SYS_ERRLIST // compat.h uses this. + #endif X #include X #include X #include *************** *** 75,80 **** --- 77,86 ---- X X #ifdef PTALPHA X #define ARCH "alpha" + #endif + + #ifdef PTFREEBSD + #define ARCH "freebsd" X #endif X X #ifdef PTHPPA *** /dev/null Sun Nov 19 09:24:19 1995 --- ./src/utils/ptplay/ptplay.freebsd Thu Nov 9 23:16:08 1995 *************** *** 0 **** --- 1,9 ---- + #! /bin/sh + # + # The FreeBSD ptplay program should cat the speech file to /dev/audio, not + # /dev/dsp. It is /dev/audio that is designed to accept 8-bit mu-law + # speech (Sun audio files): /dev/dsp plays linear speech, so while using + # it results in intelligible output it is distorted. + + cat $1 >/dev/audio + SHAR_EOF $shar_touch -am 1119151895 'PatchJLW01a' && chmod 0644 'PatchJLW01a' || echo 'restore of PatchJLW01a failed' shar_count="`wc -c < 'PatchJLW01a'`" test 14230 -eq "$shar_count" || echo "PatchJLW01a: original size 14230, current size $shar_count" fi # ============= PatchJLW01b ============== if test -f 'PatchJLW01b' && test X"$1" != X"-c"; then echo 'x - skipping PatchJLW01b (file already exists)' else echo 'x - extracting PatchJLW01b (text)' sed 's/^X//' << 'SHAR_EOF' > 'PatchJLW01b' && *** ./src/octtools/Xpackages/rpc/rpc.c.ORIGINAL Thu Mar 2 18:51:26 1995 --- ./src/octtools/Xpackages/rpc/rpc.c Wed Nov 8 23:26:50 1995 *************** *** 1449,1454 **** --- 1449,1455 ---- X } X return (size * count - len) / size; X } + ptr += num_read; X len -= num_read; X } while (len); X *** ./src/octtools/vem/rpc/serverNet.c.ORIGINAL Thu Mar 2 18:56:54 1995 --- ./src/octtools/vem/rpc/serverNet.c Sun Nov 5 20:01:24 1995 *************** *** 824,831 **** X /* read until EOF, EWOULDBLOCK or an error */ X for (;;) { X count = read(socket, buffer, sizeof(buffer)); ! if ((count == 0) && (errno == EWOULDBLOCK)) return; ! if (count <= 0) { X (void) close(fd); X (void) close(socket); X RPC_FD_CLR(socket, RPCFileRequest); --- 824,831 ---- X /* read until EOF, EWOULDBLOCK or an error */ X for (;;) { X count = read(socket, buffer, sizeof(buffer)); ! if ((count == 0) || (count < 0 && errno == EWOULDBLOCK)) return; ! if (count < 0) { X (void) close(fd); X (void) close(socket); X RPC_FD_CLR(socket, RPCFileRequest); *** ./src/octtools/vem/rpc/rpc.c.ORIGINAL Thu Mar 2 18:56:51 1995 --- ./src/octtools/vem/rpc/rpc.c Wed Nov 8 23:20:33 1995 *************** *** 1431,1436 **** --- 1431,1437 ---- X } X return (size * count - len) / size; X } + ptr += num_read; X len -= num_read; X } while (len); X *** ./src/octtools/vem/rpc/serverVem.c.ORIGINAL Sun Mar 5 21:39:17 1995 --- ./src/octtools/vem/rpc/serverVem.c Thu Nov 9 00:50:17 1995 *************** *** 1811,1816 **** --- 1811,1825 ---- X X case RPC_CLEAN_EXIT_FUNCTION: X status = RPCcleanExit(application, receiveStream); + if (status == RPC_OK) { + + /* + * At this point the connection has been shut + * down so go ahead and return. + */ + + return status; + } X break; X X case RPC_X_GET_DEFAULT_FUNCTION: *** ./src/octtools/vem/rpc/vemRPC.c.ORIGINAL Thu Mar 2 18:57:01 1995 --- ./src/octtools/vem/rpc/vemRPC.c Sat Nov 4 20:25:08 1995 *************** *** 565,571 **** --- 565,573 ---- X Pointer pointer; X /* HP-UX does not support siglist */ X #if ! defined(NO_SYS_SIGLIST) /* NO_SYS_SIGLIST should be in compat.h */ + #if !defined(PTFREEBSD) X extern char *sys_siglist[]; + #endif X #endif X X if (spot == (vemPoint *) 0) { SHAR_EOF $shar_touch -am 1119151995 'PatchJLW01b' && chmod 0644 'PatchJLW01b' || echo 'restore of PatchJLW01b failed' shar_count="`wc -c < 'PatchJLW01b'`" test 2453 -eq "$shar_count" || echo "PatchJLW01b: original size 2453, current size $shar_count" fi exit 0 ------------------------------------------------------------------------- | Feith Systems | Voice: 1-215-646-8000 | Email: john@feith.com | | John Wehle | Fax: 1-215-540-5495 | | ------------------------------------------------------------------------- ---------------------------------------------------------------------------- Posted to the ptolemy-hackers mailing list. Please send administrative mail for this list to: ptolemy-hackers-request@ptolemy.eecs.berkeley.edu