I saw your announcement for scsh and noticed that NetBSD was a
supported platform. I thought a FreeBSD port should just ``fall right
out.'' I was wrong.
Apparantly, the NetBSD porting effort was too NetBSD-specific and
wasn't done in terms of the 4.4 Berkeleyisms that are common to both
NetBSD and FreeBSD.
I humbly offer these patches to scsh-0.4.0 that enable it to build,
run, and pass its checks on FreeBSD. It should still work on NetBSD,
too, although you may want to double check that since I don't have
access to such a system.
Thanks for an intriguing product.
diff -r -c scsh-0.4.0/Makefile.in scsh-0.4.0-freebsd/Makefile.in
*** scsh-0.4.0/Makefile.in Wed Nov 1 01:16:38 1995
--- scsh-0.4.0-freebsd/Makefile.in Thu Nov 2 07:39:13 1995
***************
*** 56,62 ****
# really needed if you want to build the linker or rebuild initial.image.
include $(srcdir)/filenames.make
#
! #NetBSD make wants to see this instead: (or use GNU make on BSD. -bri)
#.include "$(srcdir)/filenames.make"
--- 56,62 ----
# really needed if you want to build the linker or rebuild initial.image.
include $(srcdir)/filenames.make
#
! #NetBSD+FreeBSD make wants to see this instead: (or use GNU make on BSD. -bri)
#.include "$(srcdir)/filenames.make"
***************
*** 102,108 ****
SCSHOBJS = \
scsh/dirstuff1.o \
scsh/fdports1.o \
! scsh/flock.o scsh/flock1.o \
scsh/jcontrol2.o scsh/jcontrol1.o \
scsh/machine/stdio_dep.o \
scsh/machine/time_dep1.o \
--- 102,108 ----
SCSHOBJS = \
scsh/dirstuff1.o \
scsh/fdports1.o \
! scsh/flock.o scsh/flock1.o \
scsh/jcontrol2.o scsh/jcontrol1.o \
scsh/machine/stdio_dep.o \
scsh/machine/time_dep1.o \
***************
*** 169,175 ****
scsh/select1.h scsh/userinfo1.h
include $(srcdir)/scsh/machine/Makefile.inc
! #NetBSD make wants to see this instead: (or use GNU make on BSD. -bri)
#.include "$(srcdir)/scsh/machine/Makefile.inc"
$(VM): main.o $(OBJS) $(AIX_P)
--- 169,175 ----
scsh/select1.h scsh/userinfo1.h
include $(srcdir)/scsh/machine/Makefile.inc
! #NetBSD+FreeBSD make wants to see this instead: (or use GNU make on BSD. -bri)
#.include "$(srcdir)/scsh/machine/Makefile.inc"
$(VM): main.o $(OBJS) $(AIX_P)
diff -r -c scsh-0.4.0/RELEASE scsh-0.4.0-freebsd/RELEASE
*** scsh-0.4.0/RELEASE Tue Oct 31 20:00:55 1995
--- scsh-0.4.0-freebsd/RELEASE Thu Nov 2 07:39:51 1995
***************
*** 71,76 ****
--- 71,77 ----
Unix platforms. We currently have scsh implementations for
AIX,
CXUX,
+ FreeBSD,
HP-UX,
IRIX,
Linux,
diff -r -c scsh-0.4.0/configure scsh-0.4.0-freebsd/configure
*** scsh-0.4.0/configure Tue Oct 31 16:16:20 1995
--- scsh-0.4.0-freebsd/configure Thu Nov 2 07:40:58 1995
***************
*** 859,865 ****
;;
! ## NetBSD (maybe FreeBSD and 386BSD also)
*-*-*bsd* )
dir=bsd
;;
--- 859,865 ----
;;
! ## NetBSD, FreeBSD (maybe 386BSD also)
*-*-*bsd* )
dir=bsd
;;
diff -r -c scsh-0.4.0/configure.in scsh-0.4.0-freebsd/configure.in
*** scsh-0.4.0/configure.in Tue Oct 31 16:16:22 1995
--- scsh-0.4.0-freebsd/configure.in Thu Nov 2 07:41:11 1995
***************
*** 251,257 ****
SCSH_LINUX_ELF
;;
! ## NetBSD (maybe FreeBSD and 386BSD also)
*-*-*bsd* )
dir=bsd
;;
--- 251,257 ----
SCSH_LINUX_ELF
;;
! ## NetBSD, FreeBSD (maybe 386BSD also)
*-*-*bsd* )
dir=bsd
;;
diff -r -c scsh-0.4.0/dynload.c scsh-0.4.0-freebsd/dynload.c
*** scsh-0.4.0/dynload.c Fri Oct 13 21:32:31 1995
--- scsh-0.4.0-freebsd/dynload.c Thu Nov 2 07:41:55 1995
***************
*** 29,35 ****
#include <stdlib.h>
#include <unistd.h>
! #ifdef __NetBSD__
#include <nlist.h>
#include <link.h>
#else
--- 29,35 ----
#include <stdlib.h>
#include <unistd.h>
! #if defined(__NetBSD__) || defined(__FreeBSD__)
#include <nlist.h>
#include <link.h>
#else
***************
*** 96,102 ****
return -1;
};
newhandle=dlopen(pathname, S48_DLOPEN_MODE);
! #if defined(__NetBSD__)
if (newhandle == -1) {
fprintf(stderr, " dynamic_load of %s can't dlopen %s",
sharedobjname, pathname);
--- 96,102 ----
return -1;
};
newhandle=dlopen(pathname, S48_DLOPEN_MODE);
! #if defined(__NetBSD__) || defined(__FreeBSD__)
if (newhandle == -1) {
fprintf(stderr, " dynamic_load of %s can't dlopen %s",
sharedobjname, pathname);
diff -r -c scsh-0.4.0/scsh/bsd/errno.scm scsh-0.4.0-freebsd/scsh/bsd/errno.scm
*** scsh-0.4.0/scsh/bsd/errno.scm Fri Oct 13 21:33:53 1995
--- scsh-0.4.0-freebsd/scsh/bsd/errno.scm Thu Nov 2 07:47:33 1995
***************
*** 2,8 ****
;;; Copyright (c) 1993 by Olin Shivers.
;;; Copyright (c) 1994 by Brian D. Carlstrom.
! ;;; These are the correct values for NetBSD 1.0 systems.
(define-syntax define-errnos
(syntax-rules ()
--- 2,9 ----
;;; Copyright (c) 1993 by Olin Shivers.
;;; Copyright (c) 1994 by Brian D. Carlstrom.
! ;;; These are the correct values for BSD4.4-Lite-based systems
! ;;; such as NetBSD 1.0 and FreeBSD 2.0.
(define-syntax define-errnos
(syntax-rules ()
***************
*** 23,36 ****
(noexec 8) ; Exec format error
(badf 9) ; Bad file descriptor
(child 10) ; No child processes
! ;; NetBSD
(deadlk 11) ; Resource deadlock avoided
;; POSIX:
(nomem 12) ; Not enough space
(acces 13) ; Permission denied
(fault 14) ; Bad address
! ;; NetBSD
(notblk 15) ; Block device required
;; POSIX
--- 24,37 ----
(noexec 8) ; Exec format error
(badf 9) ; Bad file descriptor
(child 10) ; No child processes
! ;; BSD4.4-Lite
(deadlk 11) ; Resource deadlock avoided
;; POSIX:
(nomem 12) ; Not enough space
(acces 13) ; Permission denied
(fault 14) ; Bad address
! ;; BSD4.4-Lite
(notblk 15) ; Block device required
;; POSIX
***************
*** 44,50 ****
(nfile 23) ; Too many open files in system
(mfile 24) ; Too many open files
(notty 25) ; Inappropriate I/O control operation
! ;; NetBSD
(txtbsy 26) ; Text file busy
;; POSIX
(fbig 27) ; File too large
--- 45,51 ----
(nfile 23) ; Too many open files in system
(mfile 24) ; Too many open files
(notty 25) ; Inappropriate I/O control operation
! ;; BSD4.4-Lite
(txtbsy 26) ; Text file busy
;; POSIX
(fbig 27) ; File too large
***************
*** 62,68 ****
;; POSIX
(again 35) ; Resource temporarily unavaile (note overlap)
! ;; NetBSD
;; non-blocking and interrupt i/o
(wouldblock 35) ; Operation would block
(inprogress 36) ; Operation now in progress
--- 63,69 ----
;; POSIX
(again 35) ; Resource temporarily unavaile (note overlap)
! ;; BSD4.4-Lite
;; non-blocking and interrupt i/o
(wouldblock 35) ; Operation would block
(inprogress 36) ; Operation now in progress
***************
*** 103,116 ****
;; POSIX:
(nametoolong 63) ; File name too long
! ;; NetBSD
(hostdown 64) ; Host is down
(hostunreach 65) ; No route to host
;; POSIX:
(notempty 66) ; Directory not empty
! ;; NetBSD
;; quotas & mush
(proclim 67) ; Too many processes
(users 68) ; Too many users
--- 104,117 ----
;; POSIX:
(nametoolong 63) ; File name too long
! ;; BSD4.4-Lite
(hostdown 64) ; Host is down
(hostunreach 65) ; No route to host
;; POSIX:
(notempty 66) ; Directory not empty
! ;; BSD4.4-Lite
;; quotas & mush
(proclim 67) ; Too many processes
(users 68) ; Too many users
***************
*** 130,136 ****
;; POSIX
(nosys 78) ; Function not implemented
! ;; NetBSD
(ftype 79) ; Inappropriate file type or format
(auth 80) ; Authentication error
(needauth 81) ; Need authenticator
--- 131,137 ----
;; POSIX
(nosys 78) ; Function not implemented
! ;; BSD4.4-Lite
(ftype 79) ; Inappropriate file type or format
(auth 80) ; Authentication error
(needauth 81) ; Need authenticator
diff -r -c scsh-0.4.0/scsh/bsd/fdflags.scm
scsh-0.4.0-freebsd/scsh/bsd/fdflags.scm
*** scsh-0.4.0/scsh/bsd/fdflags.scm Fri Oct 13 21:33:54 1995
--- scsh-0.4.0-freebsd/scsh/bsd/fdflags.scm Thu Nov 2 07:47:36 1995
***************
*** 15,21 ****
(nonblocking #x0004) ; no delay
(append #x0008) ; set append mode
! ;; NetBSD
(shlock #x0010) ; open with shared file lock
(exlock #x0020) ; open with exclusive file lock
(async #x0040) ; signal pgrep when data ready
--- 15,21 ----
(nonblocking #x0004) ; no delay
(append #x0008) ; set append mode
! ;; BSD4.4-Lite
(shlock #x0010) ; open with shared file lock
(exlock #x0020) ; open with exclusive file lock
(async #x0040) ; signal pgrep when data ready
diff -r -c scsh-0.4.0/scsh/bsd/netconst.scm
scsh-0.4.0-freebsd/scsh/bsd/netconst.scm
*** scsh-0.4.0/scsh/bsd/netconst.scm Fri Oct 13 21:33:54 1995
--- scsh-0.4.0-freebsd/scsh/bsd/netconst.scm Thu Nov 2 07:48:57 1995
***************
*** 113,119 ****
socket/broadcast
socket/use-loop-back
socket/oob-inline
! socket/reuse-port ;netbsd
; socket/use-privileged
; socket/cant-signal
tcp/no-delay))
--- 113,119 ----
socket/broadcast
socket/use-loop-back
socket/oob-inline
! socket/reuse-port ;BSD4.4-Lite
; socket/use-privileged
; socket/cant-signal
tcp/no-delay))
diff -r -c scsh-0.4.0/scsh/bsd/packages.scm
scsh-0.4.0-freebsd/scsh/bsd/packages.scm
*** scsh-0.4.0/scsh/bsd/packages.scm Fri Oct 13 21:33:54 1995
--- scsh-0.4.0-freebsd/scsh/bsd/packages.scm Thu Nov 2 07:50:31 1995
***************
*** 1,8 ****
! ;;; Interfaces and packages for the NetBSD specific parts of scsh.
;;; Copyright (c) 1994 by Olin Shivers.
;;; Copyright (c) 1994 by Brian D. Carlstrom.
! (define-interface netbsd-fdflags-extras-interface
(export open/shlock
open/exlock
open/async
--- 1,8 ----
! ;;; Interfaces and packages for the BSD4.4-Lite specific parts of scsh.
;;; Copyright (c) 1994 by Olin Shivers.
;;; Copyright (c) 1994 by Brian D. Carlstrom.
! (define-interface bsd44lite-fdflags-extras-interface
(export open/shlock
open/exlock
open/async
***************
*** 10,16 ****
fcntl/get-owner
fcntl/set-owner))
! (define-interface netbsd-errno-extras-interface
(export errno/deadlk
errno/notblk
errno/txtbsy
--- 10,16 ----
fcntl/get-owner
fcntl/set-owner))
! (define-interface bsd44lite-errno-extras-interface
(export errno/deadlk
errno/notblk
errno/txtbsy
***************
*** 59,65 ****
errno/needauth
errno/last))
! (define-interface netbsd-signals-extras-interface
(export signal/trap
signal/emt
signal/bus
--- 59,65 ----
errno/needauth
errno/last))
! (define-interface bsd44lite-signals-extras-interface
(export signal/trap
signal/emt
signal/bus
***************
*** 74,80 ****
signal/winch
signal/info))
! (define-interface netbsd-network-extras-interface
(export socket/debug
socket/accept-connect
socket/reuse-address
--- 74,80 ----
signal/winch
signal/info))
! (define-interface bsd44lite-network-extras-interface
(export socket/debug
socket/accept-connect
socket/reuse-address
***************
*** 84,90 ****
socket/use-loop-back
socket/linger
socket/oob-inline
! socket/reuse-port ;netbsd
; socket/use-privileged
; socket/cant-signal
socket/send-buffer
--- 84,90 ----
socket/use-loop-back
socket/linger
socket/oob-inline
! socket/reuse-port ;bsd44lite
; socket/use-privileged
; socket/cant-signal
socket/send-buffer
***************
*** 95,101 ****
socket/receive-timeout
socket/error
socket/type
! ;;; all ip/* but ip/options and ip/time-to-live netbsd only
ip/options
ip/header-included
ip/type-of-service
--- 95,101 ----
socket/receive-timeout
socket/error
socket/type
! ;;; all ip/* but ip/options and ip/time-to-live bsd44lite only
ip/options
ip/header-included
ip/type-of-service
***************
*** 117,138 ****
message/wait-all
message/dont-wait))
! (define-interface netbsd-extras-interface
! (compound-interface netbsd-errno-extras-interface
! netbsd-fdflags-extras-interface
! netbsd-network-extras-interface
! netbsd-signals-extras-interface))
! (define-interface netbsd-defs-interface
! (compound-interface netbsd-extras-interface
sockets-network-interface
posix-errno-interface
posix-fdflags-interface
posix-signals-interface))
! (define-structure netbsd-defs netbsd-defs-interface
(open scheme bitwise defenum-package)
(files fdflags errno signals netconst))
! (define-interface os-extras-interface netbsd-extras-interface)
! (define os-dependent netbsd-defs)
--- 117,138 ----
message/wait-all
message/dont-wait))
! (define-interface bsd44lite-extras-interface
! (compound-interface bsd44lite-errno-extras-interface
! bsd44lite-fdflags-extras-interface
! bsd44lite-network-extras-interface
! bsd44lite-signals-extras-interface))
! (define-interface bsd44lite-defs-interface
! (compound-interface bsd44lite-extras-interface
sockets-network-interface
posix-errno-interface
posix-fdflags-interface
posix-signals-interface))
! (define-structure bsd44lite-defs bsd44lite-defs-interface
(open scheme bitwise defenum-package)
(files fdflags errno signals netconst))
! (define-interface os-extras-interface bsd44lite-extras-interface)
! (define os-dependent bsd44lite-defs)
diff -r -c scsh-0.4.0/scsh/bsd/signals.scm
scsh-0.4.0-freebsd/scsh/bsd/signals.scm
*** scsh-0.4.0/scsh/bsd/signals.scm Fri Oct 13 21:33:54 1995
--- scsh-0.4.0-freebsd/scsh/bsd/signals.scm Thu Nov 2 07:52:17 1995
***************
*** 1,4 ****
! ;;; Signal constant definitions for NetBSD
;;; Copyright (c) 1994 by Olin Shivers.
;;; Copyright (c) 1994 by Brian D. Carlstrom.
--- 1,4 ----
! ;;; Signal constant definitions for BSD4.4-Lite
;;; Copyright (c) 1994 by Olin Shivers.
;;; Copyright (c) 1994 by Brian D. Carlstrom.
***************
*** 14,40 ****
(quit 3) ; quit
(ill 4) ; illegal instruction (not reset when caught)
! ;; NetBSD
(trap 5) ; trace trap (not reset when caught)
;; POSIX
(iot 6) ; IOT instruction
(abrt 6) ; used by abort, replace SIGIOT in the future
! ;; NetBSD
(emt 7) ; EMT instruction
;; POSIX
(fpe 8) ; floating point exception
(kill 9) ; kill (cannot be caught or ignored)
! ;; NetBSD
(bus 10) ; bus error
;; POSIX
(segv 11) ; segmentation violation
! ;; NetBSD
(sys 12) ; bad argument to system call
;; POSIX
--- 14,40 ----
(quit 3) ; quit
(ill 4) ; illegal instruction (not reset when caught)
! ;; BSD4.4-Lite
(trap 5) ; trace trap (not reset when caught)
;; POSIX
(iot 6) ; IOT instruction
(abrt 6) ; used by abort, replace SIGIOT in the future
! ;; BSD4.4-Lite
(emt 7) ; EMT instruction
;; POSIX
(fpe 8) ; floating point exception
(kill 9) ; kill (cannot be caught or ignored)
! ;; BSD4.4-Lite
(bus 10) ; bus error
;; POSIX
(segv 11) ; segmentation violation
! ;; BSD4.4-Lite
(sys 12) ; bad argument to system call
;; POSIX
***************
*** 42,48 ****
(alrm 14) ; alarm clock
(term 15) ; software termination signal from kill
! ;; NetBSD
(urg 16) ; urgent condition on IO channel
;; POSIX
--- 42,48 ----
(alrm 14) ; alarm clock
(term 15) ; software termination signal from kill
! ;; BSD4.4-Lite
(urg 16) ; urgent condition on IO channel
;; POSIX
***************
*** 51,64 ****
(cont 19) ; continue a stopped process
(chld 20) ; to parent on child stop or exit
! ;; NetBSD
(cld 20) ; System V name for SIGCHLD
;; POSIX
(ttin 21) ; to readers pgrp upon background tty read
(ttou 22) ; like TTIN for output if (tp->t_local<OSTOP)
! ;; NetBSD
(io 23) ; input/output possible signal
(xcpu 24) ; exceeded CPU time limit
(xfsz 25) ; exceeded file size limit
--- 51,64 ----
(cont 19) ; continue a stopped process
(chld 20) ; to parent on child stop or exit
! ;; BSD4.4-Lite
(cld 20) ; System V name for SIGCHLD
;; POSIX
(ttin 21) ; to readers pgrp upon background tty read
(ttou 22) ; like TTIN for output if (tp->t_local<OSTOP)
! ;; BSD4.4-Lite
(io 23) ; input/output possible signal
(xcpu 24) ; exceeded CPU time limit
(xfsz 25) ; exceeded file size limit
diff -r -c scsh-0.4.0/scsh/bsd/tty-consts.scm
scsh-0.4.0-freebsd/scsh/bsd/tty-consts.scm
*** scsh-0.4.0/scsh/bsd/tty-consts.scm Tue Oct 31 18:12:26 1995
--- scsh-0.4.0-freebsd/scsh/bsd/tty-consts.scm Thu Nov 2 07:53:05 1995
***************
*** 4,10 ****
;;; Constants from NetBSD header files substituted by Bill Sommerfeld
;;; These constants are for NetBSD 1.1 pre-alpha
! ;;; and are taken from /usr/include/sys/termios.h.
;;; Non-standard (POSIX, SVR4, 4.3+BSD) things:
;;; - Some of the baud rates.
--- 4,11 ----
;;; Constants from NetBSD header files substituted by Bill Sommerfeld
;;; These constants are for NetBSD 1.1 pre-alpha
! ;;; and are taken from /usr/include/sys/termios.h. These should
! ;;; work with any BSD4.4-Lite derived system (such as FreeBSD).
;;; Non-standard (POSIX, SVR4, 4.3+BSD) things:
;;; - Some of the baud rates.
diff -r -c scsh-0.4.0/scsh/bsd/waitcodes.scm
scsh-0.4.0-freebsd/scsh/bsd/waitcodes.scm
*** scsh-0.4.0/scsh/bsd/waitcodes.scm Fri Oct 13 21:33:54 1995
--- scsh-0.4.0-freebsd/scsh/bsd/waitcodes.scm Thu Nov 2 07:53:20 1995
***************
*** 4,10 ****
;;; To port these to a new OS, consult /usr/include/sys/wait.h,
;;; and check the WIFEXITED, WEXITSTATUS, WIFSTOPPED, WSTOPSIG,
;;; WIFSIGNALED, and WTERMSIG macros for the magic fields they use.
! ;;; These definitions are for NetBSD.
;;;
;;; I could have done a portable version by making C calls for this,
;;; but it's such overkill.
--- 4,10 ----
;;; To port these to a new OS, consult /usr/include/sys/wait.h,
;;; and check the WIFEXITED, WEXITSTATUS, WIFSTOPPED, WSTOPSIG,
;;; WIFSIGNALED, and WTERMSIG macros for the magic fields they use.
! ;;; These definitions are for BSD4.4-Lite.
;;;
;;; I could have done a portable version by making C calls for this,
;;; but it's such overkill.
diff -r -c scsh-0.4.0/scsh/syscalls1.c scsh-0.4.0-freebsd/scsh/syscalls1.c
*** scsh-0.4.0/scsh/syscalls1.c Thu Oct 26 07:34:33 1995
--- scsh-0.4.0-freebsd/scsh/syscalls1.c Thu Nov 2 07:55:43 1995
***************
*** 501,512 ****
--- 501,514 ----
char *errno_msg(int i)
{
/* temp hack until we figure out what to do about losing sys_errlist's */
+ #if (!defined(BSD) || (BSD < 199306))
extern
#ifdef HAVE_CONST_SYS_ERRLIST
const
#endif
char *sys_errlist[];
extern int sys_nerr;
+ #endif
return ( i < 0 || i > sys_nerr ) ? NULL /* i.e., #f */
: (char*) sys_errlist[i];
}
diff -r -c scsh-0.4.0/unix.c scsh-0.4.0-freebsd/unix.c
*** scsh-0.4.0/unix.c Fri Oct 13 21:32:33 1995
--- scsh-0.4.0-freebsd/unix.c Thu Nov 2 07:44:10 1995
***************
*** 175,181 ****
#elif defined(__linux__)
if (stream->_IO_read_ptr < stream->_IO_read_end)
return 1;
! #elif defined(__NetBSD__)
if (stream->_r)
return 1;
#else
--- 175,181 ----
#elif defined(__linux__)
if (stream->_IO_read_ptr < stream->_IO_read_end)
return 1;
! #elif defined(BSD) && (BSD >= 199306)
if (stream->_r)
return 1;
#else
|