added solaris from 0.5.2 but s48_ adapted
This commit is contained in:
parent
7f9aa175d6
commit
366ff18d29
|
@ -0,0 +1,12 @@
|
||||||
|
;;; Flags that control buffering policy.
|
||||||
|
;;; Copyright (c) 1993 by Olin Shivers. See file COPYING.
|
||||||
|
|
||||||
|
;;; These are for the SET-PORT-BUFFERING procedure, essentially a Scheme
|
||||||
|
;;; analog of the setbuf(3S) stdio call. We use the actual stdio values.
|
||||||
|
;;; These constants are not likely to change from stdio lib to stdio lib,
|
||||||
|
;;; but you need to check when you do a port.
|
||||||
|
|
||||||
|
(define-enum-constants bufpol
|
||||||
|
(block 0) ; _IOFBF
|
||||||
|
(line #o100) ; _IOLBF
|
||||||
|
(none 4)) ; _IONBF
|
|
@ -0,0 +1,178 @@
|
||||||
|
;;; Errno constant definitions.
|
||||||
|
;;; Copyright (c) 1993 by Olin Shivers. See file COPYING.
|
||||||
|
;;; Revised for Solaris 1994 by tvb@math.ufl.edu
|
||||||
|
|
||||||
|
;;; These are the correct values for my SparcStation.
|
||||||
|
|
||||||
|
(define errno/2big 7) ; 2big is not a legit Scheme symbol. Lose, lose.
|
||||||
|
|
||||||
|
(define-enum-constants errno
|
||||||
|
;; POSIX:
|
||||||
|
(perm 1) ; Not Super-User
|
||||||
|
(noent 2) ; No Such File Or Directory
|
||||||
|
(srch 3) ; No Such Process
|
||||||
|
(intr 4) ; Interrupted System Call
|
||||||
|
(io 5) ; I/O Error
|
||||||
|
(nxio 6) ; No Such Device Or Address
|
||||||
|
; (2big 7) ; Arg List Too Long
|
||||||
|
(noexec 8) ; Exec Format Error
|
||||||
|
(badf 9) ; Bad File Number
|
||||||
|
(child 10) ; No Children
|
||||||
|
(again 11) ; Resource Temporarily Unavailable
|
||||||
|
(nomem 12) ; Not Enough Core
|
||||||
|
(acces 13) ; Permission Denied
|
||||||
|
(fault 14) ; Bad Address
|
||||||
|
|
||||||
|
(notblk 15) ; Block Device Required
|
||||||
|
|
||||||
|
;; POSIX:
|
||||||
|
(busy 16) ; Mount Device Busy
|
||||||
|
(exist 17) ; File Exists
|
||||||
|
(xdev 18) ; Cross-Device Link
|
||||||
|
(nodev 19) ; No Such Device
|
||||||
|
(notdir 20) ; Not A Directory
|
||||||
|
(isdir 21) ; Is A Directory
|
||||||
|
(inval 22) ; Invalid Argument
|
||||||
|
(nfile 23) ; File Table Overflow
|
||||||
|
(mfile 24) ; Too Many Open Files
|
||||||
|
(notty 25) ; Inappropriate Ioctl For Device
|
||||||
|
;;
|
||||||
|
(txtbsy 26) ; Text File Busy
|
||||||
|
|
||||||
|
;; POSIX:
|
||||||
|
(fbig 27) ; File Too Large
|
||||||
|
(nospc 28) ; No Space Left On Device
|
||||||
|
(spipe 29) ; Illegal Seek
|
||||||
|
(rofs 30) ; Read Only File System
|
||||||
|
(mlink 31) ; Too Many Links
|
||||||
|
(pipe 32) ; Broken Pipe
|
||||||
|
(dom 33) ; Math Arg Out Of Domain Of Func
|
||||||
|
(range 34) ; Math Result Not Representable
|
||||||
|
;;
|
||||||
|
(nomsg 35) ; No Message Of Desired Type
|
||||||
|
(idrm 36) ; Identifier Removed
|
||||||
|
(chrng 37) ; Channel Number Out Of Range
|
||||||
|
(l2nsync 38) ; Level 2 Not Synchronized
|
||||||
|
(l3hlt 39) ; Level 3 Halted
|
||||||
|
(l3rst 40) ; Level 3 Reset
|
||||||
|
(lnrng 41) ; Link Number Out Of Range
|
||||||
|
(unatch 42) ; Protocol Driver Not Attached
|
||||||
|
(nocsi 43) ; No Csi Structure Available
|
||||||
|
(l2hlt 44) ; Level 2 Halted
|
||||||
|
|
||||||
|
;; POSIX:
|
||||||
|
(deadlk 45) ; Deadlock Condition.
|
||||||
|
(nolck 46) ; No Record Locks Available.
|
||||||
|
|
||||||
|
;;
|
||||||
|
(canceled 47) ; Operation Canceled
|
||||||
|
(notsup 48) ; Operation Not Supported
|
||||||
|
|
||||||
|
; Convergent Error Returns
|
||||||
|
(bade 50) ; Invalid Exchange
|
||||||
|
(badr 51) ; Invalid Request Descriptor
|
||||||
|
(xfull 52) ; Exchange Full
|
||||||
|
(noano 53) ; No Anode
|
||||||
|
(badrqc 54) ; Invalid Request Code
|
||||||
|
(badslt 55) ; Invalid Slot
|
||||||
|
(deadlock 56) ; File Locking Deadlock Error
|
||||||
|
|
||||||
|
(bfont 57) ; Bad Font File Fmt
|
||||||
|
|
||||||
|
; Stream Problems
|
||||||
|
(nostr 60) ; Device Not A Stream
|
||||||
|
(nodata 61) ; No Data (for No Delay Io)
|
||||||
|
(time 62) ; Timer Expired
|
||||||
|
(nosr 63) ; Out Of Streams Resources
|
||||||
|
|
||||||
|
(nonet 64) ; Machine Is Not On The Network
|
||||||
|
(nopkg 65) ; Package Not Installed
|
||||||
|
(remote 66) ; The Object Is Remote
|
||||||
|
(nolink 67) ; The Link Has Been Severed
|
||||||
|
(adv 68) ; Advertise Error
|
||||||
|
(srmnt 69) ; Srmount Error
|
||||||
|
|
||||||
|
(comm 70) ; Communication Error On Send
|
||||||
|
(proto 71) ; Protocol Error
|
||||||
|
(multihop 74) ; Multihop Attempted
|
||||||
|
(badmsg 77) ; Trying To Read Unreadable Message
|
||||||
|
(nametoolong 78) ; Path Name Is Too Long (POSIX)
|
||||||
|
(overflow 79) ; Value Too Large To Be Stored In Data Type
|
||||||
|
(notuniq 80) ; Given Log. Name Not Unique
|
||||||
|
(badfd 81) ; F.D. Invalid For This Operation
|
||||||
|
(remchg 82) ; Remote Address Changed
|
||||||
|
|
||||||
|
; Shared Library Problems
|
||||||
|
(libacc 83) ; Can'T Access A Needed Shared Lib.
|
||||||
|
(libbad 84) ; Accessing A Corrupted Shared Lib.
|
||||||
|
(libscn 85) ; .Lib Section In A.Out Corrupted.
|
||||||
|
(libmax 86) ; Attempting To Link In Too Many Libs.
|
||||||
|
(libexec 87) ; Attempting To Exec A Shared Library.
|
||||||
|
(ilseq 88) ; Illegal Byte Sequence.
|
||||||
|
(nosys 89) ; Unsupported File System Operation (POSIX)
|
||||||
|
(loop 90) ; Symbolic Link Loop
|
||||||
|
(restart 91) ; Restartable System Call
|
||||||
|
(strpipe 92) ; If Pipe/Fifo, Don'T Sleep In Stream Head
|
||||||
|
(notempty 93) ; Directory Not Empty (POSIX)
|
||||||
|
(users 94) ; Too Many Users (for Ufs)
|
||||||
|
|
||||||
|
; Bsd Networking Software
|
||||||
|
; Argument Errors
|
||||||
|
(notsock 95) ; Socket Operation On Non-Socket
|
||||||
|
(destaddrreq 96) ; Destination Address Required
|
||||||
|
(msgsize 97) ; Message Too Long
|
||||||
|
(prototype 98) ; Protocol Wrong Type For Socket
|
||||||
|
(noprotoopt 99) ; Protocol Not Available
|
||||||
|
(protonosupport 120) ; Protocol Not Supported
|
||||||
|
(socktnosupport 121) ; Socket Type Not Supported
|
||||||
|
(opnotsupp 122) ; Operation Not Supported On Socket
|
||||||
|
(pfnosupport 123) ; Protocol Family Not Supported
|
||||||
|
(afnosupport 124) ; Address Family Not Supported By
|
||||||
|
; Protocol Family
|
||||||
|
(addrinuse 125) ; Address Already In Use
|
||||||
|
(addrnotavail 126) ; Can'T Assign Requested Address
|
||||||
|
; Operational Errors
|
||||||
|
(netdown 127) ; Network Is Down
|
||||||
|
(netunreach 128) ; Network Is Unreachable
|
||||||
|
(netreset 129) ; Network Dropped Connection Because
|
||||||
|
; Of Reset
|
||||||
|
(connaborted 130) ; Software Caused Connection Abort
|
||||||
|
(connreset 131) ; Connection Reset By Peer
|
||||||
|
(nobufs 132) ; No Buffer Space Available
|
||||||
|
(isconn 133) ; Socket Is Already Connected
|
||||||
|
(notconn 134) ; Socket Is Not Connected
|
||||||
|
; Xenix Has 135 - 142
|
||||||
|
(shutdown 143) ; Can'T Send After Socket Shutdown
|
||||||
|
(toomanyrefs 144) ; Too Many References: Can'T Splice
|
||||||
|
(timedout 145) ; Connection Timed Out
|
||||||
|
(connrefused 146) ; Connection Refused
|
||||||
|
(hostdown 147) ; Host Is Down
|
||||||
|
(hostunreach 148) ; No Route To Host
|
||||||
|
(wouldblock 11) ; (again)
|
||||||
|
(already 149) ; Operation Already In Progress
|
||||||
|
(inprogress 150) ; Operation Now In Progress
|
||||||
|
|
||||||
|
; Sun Network File System
|
||||||
|
(stale 151) ; Stale Nfs File Handle
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; Non-POSIX messages
|
||||||
|
; Some of these Solaris messages are better. Some are stupid.
|
||||||
|
;
|
||||||
|
; Error Solaris POSIX
|
||||||
|
; perm Not super-user Operation not permitted
|
||||||
|
; intr Interrupted system call Interrupted function call
|
||||||
|
; io I/O error Input/output error
|
||||||
|
; badf Bad file number Bad file descriptor
|
||||||
|
; child No children No child processes
|
||||||
|
; nomem Not enough core Not enough space
|
||||||
|
; busy Mount device busy Resource busy
|
||||||
|
; xdev Cross-device link Improper link
|
||||||
|
; nfile File table overflow Too many open files in system
|
||||||
|
; notty Inappropriate ioctl for device Inappropriate I/O control operation
|
||||||
|
; spipe Illegal seek Invalid seek
|
||||||
|
; dom Math arg out of domain of func Domain error
|
||||||
|
; deadlk Deadlock condition Resource deadlock avoided
|
||||||
|
; nolck No record locks available No locks available
|
|
@ -0,0 +1,50 @@
|
||||||
|
;;; Flags for open(2) and fcntl(2).
|
||||||
|
;;; Copyright (c) 1993 by Olin Shivers. See file COPYING.
|
||||||
|
;;; Modified for Solaris by tvb@math.ufl.edu
|
||||||
|
|
||||||
|
(define-enum-constants open
|
||||||
|
(read 0)
|
||||||
|
(write 1)
|
||||||
|
(read+write 2)
|
||||||
|
(append 8)
|
||||||
|
(create #x0100)
|
||||||
|
(exclusive #x0400)
|
||||||
|
(no-control-tty #x800) ;claims to be POSIX
|
||||||
|
(non-blocking #x80) ;claims to be POSIX
|
||||||
|
(truncate #x0200)
|
||||||
|
|
||||||
|
;;; Not POSIX.
|
||||||
|
(no-delay 4)
|
||||||
|
(sync #x10))
|
||||||
|
|
||||||
|
(define open/access-mask
|
||||||
|
(bitwise-ior open/read
|
||||||
|
(bitwise-ior open/write open/read+write)))
|
||||||
|
|
||||||
|
|
||||||
|
(define-enum-constants fcntl
|
||||||
|
(dup-fdes 0) ; F_DUPFD
|
||||||
|
(get-fdes-flags 1) ; F_GETFD
|
||||||
|
(set-fdes-flags 2) ; F_SETFD
|
||||||
|
(get-status-flags 3) ; F_GETFL
|
||||||
|
(set-status-flags 4) ; F_SETFL
|
||||||
|
(get-owner 23) ; F_GETOWN (Not Posix)
|
||||||
|
(set-owner 24) ; F_SETOWN (Not Posix)
|
||||||
|
(get-record-lock 5) ; F_GETLK
|
||||||
|
(set-record-lock-no-block 6) ; F_SETLK
|
||||||
|
(set-record-lock 7)) ; F_SETLKW
|
||||||
|
|
||||||
|
;;; fcntl fdes-flags (F_GETFD)
|
||||||
|
|
||||||
|
(define fdflags/close-on-exec 1)
|
||||||
|
|
||||||
|
;;; fcntl status-flags (F_GETFL)
|
||||||
|
;;; Mostly, these are OPEN/... flags, like OPEN/APPEND.
|
||||||
|
;;; (define fdstatus/... ...)
|
||||||
|
|
||||||
|
;;; fcntl lock values.
|
||||||
|
|
||||||
|
(define-enum-constants lock
|
||||||
|
(read 1) ; F_RDLCK
|
||||||
|
(write 2) ; F_WRLCK
|
||||||
|
(release 3)) ; F_UNLCK
|
|
@ -0,0 +1,3 @@
|
||||||
|
/* OS-dependent support for what is supposed to be the standard ANSI C Library.
|
||||||
|
** Copyright (c) 1996 by Brian D. Carlstrom.
|
||||||
|
*/
|
|
@ -0,0 +1,121 @@
|
||||||
|
;;; Magic Numbers for Networking
|
||||||
|
;;; Copyright (c) 1994 by Brian D. Carlstrom. See file COPYING.
|
||||||
|
|
||||||
|
;;; magic numbers not from header file
|
||||||
|
;;; but from man page
|
||||||
|
;;; why can't unix make up its mind
|
||||||
|
(define shutdown/receives 0)
|
||||||
|
(define shutdown/sends 1)
|
||||||
|
(define shutdown/sends+receives 2)
|
||||||
|
|
||||||
|
;;;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||||
|
;;; BELOW THIS POINT ARE BITS FROM:
|
||||||
|
;;; <sys/socket.h>
|
||||||
|
;;; <sys/un.h>
|
||||||
|
;;; <netinet/in.h>
|
||||||
|
;;; <netinet/tcp.h>
|
||||||
|
;;; <netdb.h>
|
||||||
|
;;;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||||
|
|
||||||
|
;;; ADDRESS FAMILIES -- <sys/socket.h>
|
||||||
|
(define address-family/unspecified 0) ; unspecified
|
||||||
|
(define address-family/unix 1) ; local to host (pipes, portals)
|
||||||
|
(define address-family/internet 2) ; internetwork: UDP, TCP, etc.
|
||||||
|
|
||||||
|
;;; SOCKET TYPES -- <sys/socket.h>
|
||||||
|
(define socket-type/stream 2) ; stream socket
|
||||||
|
(define socket-type/datagram 1) ; datagram socket
|
||||||
|
(define socket-type/raw 3) ; raw-protocol interface
|
||||||
|
;;(define socket-type/rdm 4) ; reliably-delivered message
|
||||||
|
;;(define socket-type/seqpacket 5) ; sequenced packet stream
|
||||||
|
|
||||||
|
;;; PROTOCOL FAMILIES -- <sys/socket.h>
|
||||||
|
(define protocol-family/unspecified 0) ; unspecified
|
||||||
|
(define protocol-family/unix 1) ; local to host (pipes, portals)
|
||||||
|
(define protocol-family/internet 2) ; internetwork: UDP, TCP, etc.
|
||||||
|
|
||||||
|
;;; Well know addresses -- <netinet/in.h>
|
||||||
|
(define internet-address/any #x00000000)
|
||||||
|
(define internet-address/loopback #x7f000001)
|
||||||
|
(define internet-address/broadcast #xffffffff) ; must be masked
|
||||||
|
|
||||||
|
;;; errors from host lookup -- <netdb.h>
|
||||||
|
(define herror/host-not-found 1) ;Authoritative Answer Host not found
|
||||||
|
(define herror/try-again 2) ;Non-Authoritive Host not found, or SERVERFAIL
|
||||||
|
(define herror/no-recovery 3) ;Non recoverable errors, FORMERR, REFUSED, NOTIMP
|
||||||
|
(define herror/no-data 4) ;Valid name, no data record of requested type
|
||||||
|
(define herror/no-address herror/no-data) ;no address, look for MX record
|
||||||
|
|
||||||
|
;;; flags for send/recv -- <sys/socket.h>
|
||||||
|
(define message/out-of-band 1) ; process out-of-band data
|
||||||
|
(define message/peek 2) ; peek at incoming message
|
||||||
|
(define message/dont-route 4) ; send without using routing tables
|
||||||
|
|
||||||
|
;;; protocol level for socket options -- <sys/socket.h>
|
||||||
|
(define level/socket #xffff) ; SOL_SOCKET: options for socket level
|
||||||
|
|
||||||
|
;;; socket options -- <sys/socket.h>
|
||||||
|
(define socket/debug #x0001) ; turn on debugging info recording
|
||||||
|
(define socket/accept-connect #x0002) ; socket has had listen()
|
||||||
|
(define socket/reuse-address #x0004) ; allow local address reuse
|
||||||
|
(define socket/keep-alive #x0008) ; keep connections alive
|
||||||
|
(define socket/dont-route #x0010) ; just use interface addresses
|
||||||
|
(define socket/broadcast #x0020) ; permit sending of broadcast msgs
|
||||||
|
(define socket/use-loop-back #x0040) ; bypass hardware when possible
|
||||||
|
(define socket/linger #x0080) ; linger on close if data present
|
||||||
|
(define socket/oob-inline #x0100) ; leave received OOB data in line
|
||||||
|
(define socket/use-privileged #x4000) ; allocate from privileged port area
|
||||||
|
;(define socket/cant-signal #x8000) ; prevent SIGPIPE on SS_CANTSENDMORE
|
||||||
|
(define socket/send-buffer #x1001) ; send buffer size
|
||||||
|
(define socket/receive-buffer #x1002) ; receive buffer size
|
||||||
|
(define socket/send-low-water #x1003) ; send low-water mark
|
||||||
|
(define socket/receive-low-water #x1004) ; receive low-water mark
|
||||||
|
(define socket/send-timeout #x1005) ; send timeout
|
||||||
|
(define socket/receive-timeout #x1006) ; receive timeout
|
||||||
|
(define socket/error #x1007) ; get error status and clear
|
||||||
|
(define socket/type #x1008) ; get socket type
|
||||||
|
|
||||||
|
;;; ip options -- <netinet/in.h>
|
||||||
|
;(define ip/options 1) ; set/get IP per-packet options
|
||||||
|
;(define ip/time-to-live 2) ; set/get IP time-to-live value
|
||||||
|
|
||||||
|
;;; tcp options -- <netinet/tcp.h>
|
||||||
|
(define tcp/no-delay #x01) ; don't delay send to coalesce packets
|
||||||
|
(define tcp/max-segment #x02) ; set maximum segment size
|
||||||
|
|
||||||
|
;;; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||||
|
;;; OPTION SETS FOR SOCKET-OPTION AND SET-SOCKET-OPTION
|
||||||
|
|
||||||
|
;;; Boolean Options
|
||||||
|
(define options/boolean
|
||||||
|
(list socket/debug
|
||||||
|
socket/accept-connect
|
||||||
|
socket/reuse-address
|
||||||
|
socket/keep-alive
|
||||||
|
socket/dont-route
|
||||||
|
socket/broadcast
|
||||||
|
socket/use-loop-back
|
||||||
|
socket/oob-inline
|
||||||
|
socket/use-privileged
|
||||||
|
; socket/cant-signal
|
||||||
|
tcp/no-delay))
|
||||||
|
|
||||||
|
;;; Integer Options
|
||||||
|
(define options/value
|
||||||
|
(list socket/send-buffer
|
||||||
|
socket/receive-buffer
|
||||||
|
socket/send-low-water
|
||||||
|
socket/receive-low-water
|
||||||
|
socket/error
|
||||||
|
socket/type
|
||||||
|
; ip/time-to-live
|
||||||
|
tcp/max-segment))
|
||||||
|
|
||||||
|
;;; #f or Positive Integer
|
||||||
|
(define options/linger
|
||||||
|
(list socket/linger))
|
||||||
|
|
||||||
|
;;; Real Number
|
||||||
|
(define options/timeout
|
||||||
|
(list socket/send-timeout
|
||||||
|
socket/receive-timeout))
|
|
@ -0,0 +1,160 @@
|
||||||
|
;;; Interfaces and packages for the Sun specific parts of scsh.
|
||||||
|
;;; Copyright (c) 1994 by Olin Shivers. See file COPYING.
|
||||||
|
|
||||||
|
(define-interface solaris-fdflags-extras-interface
|
||||||
|
(export open/no-delay
|
||||||
|
open/sync
|
||||||
|
fcntl/get-owner
|
||||||
|
fcntl/set-owner
|
||||||
|
))
|
||||||
|
|
||||||
|
(define-interface solaris-errno-extras-interface
|
||||||
|
(export errno/addrinuse
|
||||||
|
errno/addrnotavail
|
||||||
|
errno/adv
|
||||||
|
errno/afnosupport
|
||||||
|
errno/already
|
||||||
|
errno/bade
|
||||||
|
errno/badfd
|
||||||
|
errno/badmsg
|
||||||
|
errno/badr
|
||||||
|
errno/badrqc
|
||||||
|
errno/badslt
|
||||||
|
errno/bfont
|
||||||
|
errno/canceled
|
||||||
|
errno/chrng
|
||||||
|
errno/comm
|
||||||
|
errno/connaborted
|
||||||
|
errno/connrefused
|
||||||
|
errno/connreset
|
||||||
|
errno/deadlock
|
||||||
|
errno/destaddrreq
|
||||||
|
errno/hostdown
|
||||||
|
errno/hostunreach
|
||||||
|
errno/idrm
|
||||||
|
errno/ilseq
|
||||||
|
errno/inprogress
|
||||||
|
errno/isconn
|
||||||
|
errno/l2hlt
|
||||||
|
errno/l2nsync
|
||||||
|
errno/l3hlt
|
||||||
|
errno/l3rst
|
||||||
|
errno/libacc
|
||||||
|
errno/libbad
|
||||||
|
errno/libexec
|
||||||
|
errno/libmax
|
||||||
|
errno/libscn
|
||||||
|
errno/lnrng
|
||||||
|
errno/loop
|
||||||
|
errno/msgsize
|
||||||
|
errno/multihop
|
||||||
|
errno/netdown
|
||||||
|
errno/netreset
|
||||||
|
errno/netunreach
|
||||||
|
errno/noano
|
||||||
|
errno/nobufs
|
||||||
|
errno/nocsi
|
||||||
|
errno/nodata
|
||||||
|
errno/nolink
|
||||||
|
errno/nomsg
|
||||||
|
errno/nonet
|
||||||
|
errno/nopkg
|
||||||
|
errno/noprotoopt
|
||||||
|
errno/nosr
|
||||||
|
errno/nostr
|
||||||
|
errno/notblk
|
||||||
|
errno/notconn
|
||||||
|
errno/notsock
|
||||||
|
errno/notsup
|
||||||
|
errno/notuniq
|
||||||
|
errno/opnotsupp
|
||||||
|
errno/overflow
|
||||||
|
errno/pfnosupport
|
||||||
|
errno/proto
|
||||||
|
errno/protonosupport
|
||||||
|
errno/prototype
|
||||||
|
errno/remchg
|
||||||
|
errno/remote
|
||||||
|
errno/restart
|
||||||
|
errno/shutdown
|
||||||
|
errno/socktnosupport
|
||||||
|
errno/srmnt
|
||||||
|
errno/stale
|
||||||
|
errno/strpipe
|
||||||
|
errno/time
|
||||||
|
errno/timedout
|
||||||
|
errno/toomanyrefs
|
||||||
|
errno/txtbsy
|
||||||
|
errno/unatch
|
||||||
|
errno/users
|
||||||
|
errno/wouldblock
|
||||||
|
errno/xfull
|
||||||
|
))
|
||||||
|
|
||||||
|
(define-interface solaris-signals-extras-interface
|
||||||
|
(export signal/bus
|
||||||
|
signal/cld
|
||||||
|
signal/emt
|
||||||
|
signal/freeze
|
||||||
|
signal/io
|
||||||
|
signal/iot
|
||||||
|
signal/lwp
|
||||||
|
signal/poll
|
||||||
|
signal/prof
|
||||||
|
signal/pwr
|
||||||
|
signal/sys
|
||||||
|
signal/thaw
|
||||||
|
signal/trap
|
||||||
|
signal/urg
|
||||||
|
signal/vtalrm
|
||||||
|
signal/waiting
|
||||||
|
signal/winch
|
||||||
|
signal/xcpu
|
||||||
|
signal/xfsz
|
||||||
|
))
|
||||||
|
|
||||||
|
(define-interface solaris-network-extras-interface
|
||||||
|
(export socket/debug
|
||||||
|
socket/accept-connect
|
||||||
|
socket/reuse-address
|
||||||
|
socket/keep-alive
|
||||||
|
socket/dont-route
|
||||||
|
socket/broadcast
|
||||||
|
socket/use-loop-back
|
||||||
|
socket/linger
|
||||||
|
socket/oob-inline
|
||||||
|
socket/use-privileged
|
||||||
|
socket/cant-signal
|
||||||
|
socket/send-buffer
|
||||||
|
socket/receive-buffer
|
||||||
|
socket/send-low-water
|
||||||
|
socket/receive-low-water
|
||||||
|
socket/send-timeout
|
||||||
|
socket/receive-timeout
|
||||||
|
socket/error
|
||||||
|
socket/type
|
||||||
|
ip/options
|
||||||
|
ip/time-to-live
|
||||||
|
tcp/no-delay
|
||||||
|
tcp/max-segment))
|
||||||
|
|
||||||
|
(define-interface solaris-extras-interface
|
||||||
|
(compound-interface solaris-errno-extras-interface
|
||||||
|
solaris-fdflags-extras-interface
|
||||||
|
solaris-network-extras-interface
|
||||||
|
solaris-signals-extras-interface))
|
||||||
|
|
||||||
|
(define-interface solaris-defs-interface
|
||||||
|
(compound-interface solaris-extras-interface
|
||||||
|
sockets-network-interface
|
||||||
|
posix-errno-interface
|
||||||
|
posix-fdflags-interface
|
||||||
|
posix-signals-interface
|
||||||
|
signals-internals-interface))
|
||||||
|
|
||||||
|
(define-structure solaris-defs solaris-defs-interface
|
||||||
|
(open scheme bitwise defenum-package)
|
||||||
|
(files fdflags errno signals netconst))
|
||||||
|
|
||||||
|
(define-interface os-extras-interface solaris-extras-interface)
|
||||||
|
(define os-dependent solaris-defs)
|
|
@ -0,0 +1,54 @@
|
||||||
|
;;; Signal constant definitions for Sun4
|
||||||
|
;;; Copyright (c) 1994 by Olin Shivers. See file COPYING.
|
||||||
|
;;; Modified for Solaris by tvb@math.ufl.edu
|
||||||
|
|
||||||
|
;; Adapted from signal.h - tvb
|
||||||
|
|
||||||
|
(define-enum-constants signal
|
||||||
|
;; POSIX
|
||||||
|
(hup 1) ; Hangup
|
||||||
|
(int 2) ; Interrupt (Rubout)
|
||||||
|
(quit 3) ; Quit (Ascii Fs)
|
||||||
|
(ill 4) ; Illegal Instruction (Not Reset When Caught)
|
||||||
|
;;
|
||||||
|
(trap 5) ; Trace Trap (Not Reset When Caught)
|
||||||
|
(iot 6) ; Iot Instruction
|
||||||
|
(abrt 6) ; Used By Abort, Replace SIGIOT In The Future (POSIX)
|
||||||
|
(emt 7) ; Emt Instruction
|
||||||
|
(fpe 8) ; Floating Point Exception (POSIX)
|
||||||
|
(kill 9) ; Kill (Cannot Be Caught Or Ignored) (POSIX)
|
||||||
|
(bus 10) ; Bus Error
|
||||||
|
(segv 11) ; Segmentation Violation (POSIX)
|
||||||
|
(sys 12) ; Bad Argument To System Call
|
||||||
|
(pipe 13) ; Write On A Pipe With No One To Read It (POSIX)
|
||||||
|
(alrm 14) ; Alarm Clock
|
||||||
|
(term 15) ; Software Termination Signal From Kill (POSIX)
|
||||||
|
(usr1 16) ; User Defined Signal 1 (POSIX)
|
||||||
|
(usr2 17) ; User Defined Signal 2 (POSIX)
|
||||||
|
(cld 18) ; Child Status Change
|
||||||
|
(chld 18) ; Child Status Change Alias (Posix)
|
||||||
|
(pwr 19) ; Power-Fail Restart
|
||||||
|
(winch 20) ; Window Size Change
|
||||||
|
(urg 21) ; Urgent Socket Condition
|
||||||
|
(poll 22) ; Pollable Event Occured
|
||||||
|
(io 22) ; Socket I/O Possible (poll Alias)
|
||||||
|
(stop 23) ; Stop (Cannot Be Caught Or Ignored) (POSIX)
|
||||||
|
(tstp 24) ; User Stop Requested From Tty (POSIX)
|
||||||
|
(cont 25) ; Stopped Process Has Been Continued (POSIX)
|
||||||
|
(ttin 26) ; Background Tty Read Attempted (POSIX)
|
||||||
|
(ttou 27) ; Background Tty Write Attempted (POSIX)
|
||||||
|
(vtalrm 28) ; Virtual Timer Expired
|
||||||
|
(prof 29) ; Profiling Timer Expired
|
||||||
|
(xcpu 30) ; Exceeded Cpu Limit
|
||||||
|
(xfsz 31) ; Exceeded File Size Limit
|
||||||
|
(waiting 32) ; Process's Lwps Are Blocked
|
||||||
|
(lwp 33) ; Special Signal Used By Thread Library
|
||||||
|
(freeze 34) ; Special Signal Used By Cpr
|
||||||
|
(thaw 35) ; Special Signal Used By Cpr
|
||||||
|
(cancel 36) ; Thread cancellation signal used by libthread
|
||||||
|
)
|
||||||
|
|
||||||
|
(define signals-ignored-by-default
|
||||||
|
(list signal/chld signal/cont ; These are Posix.
|
||||||
|
signal/pwr signal/urg signal/winch ; These are Solaris.
|
||||||
|
signal/waiting signal/lwp signal/freeze signal/thaw signal/cancel))
|
|
@ -0,0 +1,102 @@
|
||||||
|
/* Need to turn off synchronous error signals (SIGPIPE, SIGSYS). */
|
||||||
|
|
||||||
|
#include "../scsh_aux.h"
|
||||||
|
|
||||||
|
/* Make sure our exports match up w/the implementation: */
|
||||||
|
#include "../signals1.h"
|
||||||
|
|
||||||
|
/* This table converts Unix signal numbers to S48/scsh interrupt numbers.
|
||||||
|
** If the signal doesn't have an interrupt number, the entry is -1.
|
||||||
|
** (Only asynchronous signals have interrupt numbers.)
|
||||||
|
**
|
||||||
|
** Note that we bake into this table the integer values of the signals --
|
||||||
|
** i.e., we assume that SIGHUP=1, SIGALRM=15, etc. So this definition is
|
||||||
|
** very system-dependent.
|
||||||
|
*/
|
||||||
|
const int sig2int[] = {
|
||||||
|
-1, /* 0 is not a signal */
|
||||||
|
scshint_hup, /* 1: SIGHUP */
|
||||||
|
scshint_keyboard, /* 2: SIGINT */
|
||||||
|
scshint_quit, /* 3: SIGQUIT */
|
||||||
|
-1, /* 4: SIGILL */
|
||||||
|
-1, /* 5: SIGTRAP */
|
||||||
|
-1, /* 6: SIGABRT SIGIOT*/
|
||||||
|
-1, /* 7: SIGEMT */
|
||||||
|
-1, /* 8: SIGFPE */
|
||||||
|
-1, /* 9: SIGKILL */
|
||||||
|
-1, /* 10: SIGBUS */
|
||||||
|
-1, /* 11: SIGSEGV */
|
||||||
|
-1, /* 12: SIGSYS */
|
||||||
|
-1, /* 13: SIGPIPE */
|
||||||
|
scshint_alarm, /* 14: SIGALRM */
|
||||||
|
scshint_term, /* 15: SIGTERM */
|
||||||
|
scshint_usr1, /* 16: SIGUSR1 */
|
||||||
|
scshint_usr2, /* 17: SIGUSR2 */
|
||||||
|
scshint_chld, /* 18: SIGCHLD SIGCHD */
|
||||||
|
scshint_pwr, /* 19: SIGPWR */
|
||||||
|
scshint_winch, /* 20: SIGWINCH */
|
||||||
|
scshint_urg, /* 21: SIGURG */
|
||||||
|
scshint_io, /* 22: SIGIO SIGPOLL */
|
||||||
|
-1, /* 23: SIGSTOP */
|
||||||
|
scshint_tstp, /* 24: SIGTSTP */
|
||||||
|
scshint_cont, /* 25: SIGCONT */
|
||||||
|
-1, /* 26: SIGTTIN */ /* scshint_ttyin */
|
||||||
|
-1, /* 27: SIGTTOU */ /* scshint_ttyou */
|
||||||
|
scshint_vtalrm, /* 28: SIGVTALRM */
|
||||||
|
scshint_prof, /* 29: SIGPROF */
|
||||||
|
scshint_xcpu, /* 30: SIGXCPU */
|
||||||
|
scshint_xfsz /* 31: SIGXFSZ */
|
||||||
|
-1, /* 32: SIGWAITING */
|
||||||
|
-1, /* 33: SIGLWP */
|
||||||
|
-1, /* 34: SIGFREEZE */
|
||||||
|
-1, /* 35: SIGTHAW */
|
||||||
|
-1, /* 36: SIGCANCEL */
|
||||||
|
};
|
||||||
|
|
||||||
|
const int max_sig = 36; /* SIGXFSZ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
scshint_alarm
|
||||||
|
scshint_keyboard
|
||||||
|
scshint_memory_shortage
|
||||||
|
scshint_chld
|
||||||
|
scshint_cont
|
||||||
|
scshint_hup
|
||||||
|
scshint_quit
|
||||||
|
scshint_term
|
||||||
|
scshint_tstp
|
||||||
|
scshint_usr1
|
||||||
|
scshint_usr2
|
||||||
|
scshint_info
|
||||||
|
scshint_io
|
||||||
|
scshint_poll
|
||||||
|
scshint_prof
|
||||||
|
scshint_pwr
|
||||||
|
scshint_urg
|
||||||
|
scshint_vtalrm
|
||||||
|
scshint_winch
|
||||||
|
scshint_xcpu
|
||||||
|
scshint_xfsz
|
||||||
|
|
||||||
|
scshint_alarm
|
||||||
|
scshint_chld
|
||||||
|
scshint_cont
|
||||||
|
scshint_hup
|
||||||
|
scshint_info
|
||||||
|
scshint_io
|
||||||
|
scshint_keyboard
|
||||||
|
scshint_memory_shortage
|
||||||
|
scshint_poll
|
||||||
|
scshint_prof
|
||||||
|
scshint_pwr
|
||||||
|
scshint_quit
|
||||||
|
scshint_term
|
||||||
|
scshint_tstp
|
||||||
|
scshint_urg
|
||||||
|
scshint_usr1
|
||||||
|
scshint_usr2
|
||||||
|
scshint_vtalrm
|
||||||
|
scshint_winch
|
||||||
|
scshint_xcpu
|
||||||
|
scshint_xfsz
|
||||||
|
*/
|
|
@ -0,0 +1,10 @@
|
||||||
|
/* Convert between a lo24/hi integer-pair bitset and a sigset_t value.
|
||||||
|
** These macros are OS-dependent, and must be defined per-OS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define make_sigset(maskp, hi, lo) ((maskp)->__sigbits[0]=((hi)<<24)|(lo))
|
||||||
|
|
||||||
|
/* Not a procedure: */
|
||||||
|
#define split_sigset(mask, hip, lop) \
|
||||||
|
((*(hip)=((mask).__sigbits[0]>>24)&0xff), \
|
||||||
|
(*(lop)=((mask).__sigbits[0]&0xffffff)))
|
|
@ -0,0 +1,88 @@
|
||||||
|
/* Copyright (c) 1994 by Olin Shivers.
|
||||||
|
** Copyright (c) 1994-1995 by Brian D. Carlstrom.
|
||||||
|
**
|
||||||
|
** This file implements the char-ready? procedure for file descriptors
|
||||||
|
** and Scsh's fdports. It is not Posix, so it must be implemented for
|
||||||
|
** each OS to which scsh is ported.
|
||||||
|
**
|
||||||
|
** This version assumes two things:
|
||||||
|
** - the existence of select to tell if there is data
|
||||||
|
** available for the file descriptor.
|
||||||
|
** - the existence of the _cnt field in the stdio FILE struct, telling
|
||||||
|
** if there is any buffered input in the struct.
|
||||||
|
**
|
||||||
|
** Most Unixes have these things, so this file should work for them.
|
||||||
|
** However, Your Mileage May Vary.
|
||||||
|
**
|
||||||
|
** You could also replace the select() with a iotctl(FIONREAD) call, if you
|
||||||
|
** had one but not the other.
|
||||||
|
** -Olin&Brian
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include "libcig.h"
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
/* somewhere around solaris 2.5 this changed to a function */
|
||||||
|
#ifndef fileno
|
||||||
|
#define fileno(p) ((p)->_file)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "stdio_dep.h" /* Make sure the .h interface agrees with the code. */
|
||||||
|
|
||||||
|
/* These two procs return #t if data ready, #f data not ready,
|
||||||
|
** and errno if error.
|
||||||
|
*/
|
||||||
|
|
||||||
|
s48_value char_ready_fdes(int fd)
|
||||||
|
{
|
||||||
|
fd_set readfds;
|
||||||
|
struct timeval timeout;
|
||||||
|
int result;
|
||||||
|
|
||||||
|
FD_ZERO(&readfds);
|
||||||
|
FD_SET(fd,&readfds);
|
||||||
|
|
||||||
|
timeout.tv_sec=0;
|
||||||
|
timeout.tv_usec=0;
|
||||||
|
|
||||||
|
result=select(fd+1, &readfds, NULL, NULL, &timeout);
|
||||||
|
|
||||||
|
if(result == -1 )
|
||||||
|
return(s48_enter_fixnum(errno));
|
||||||
|
if(result)
|
||||||
|
return(S48_TRUE);
|
||||||
|
return(S48_FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
s48_value stream_char_readyp(FILE *f)
|
||||||
|
{
|
||||||
|
int fd = fileno(f);
|
||||||
|
return f->_cnt > 0 ? S48_TRUE : char_ready_fdes(fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setfileno(FILE *fs, int fd)
|
||||||
|
{
|
||||||
|
fileno(fs) = fd;
|
||||||
|
}
|
||||||
|
|
||||||
|
int fbufcount(FILE* fs)
|
||||||
|
{
|
||||||
|
return(fs->_cnt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Returns true if there is no buffered data in stream FS
|
||||||
|
** (or there is no buffering, period.)
|
||||||
|
*/
|
||||||
|
|
||||||
|
int ibuf_empty(FILE *fs) {return fs->_cnt <= 0;}
|
||||||
|
|
||||||
|
|
||||||
|
/* Returns true if the buffer in stream FS is full
|
||||||
|
** (or there is no buffering, period).
|
||||||
|
*/
|
||||||
|
|
||||||
|
int obuf_full(FILE *fs) {return fs->_cnt <= 0;}
|
|
@ -0,0 +1,13 @@
|
||||||
|
/* Exports from stdio_dep.h. */
|
||||||
|
|
||||||
|
s48_value char_ready_fdes(int fd);
|
||||||
|
|
||||||
|
s48_value stream_char_readyp(FILE *f);
|
||||||
|
|
||||||
|
void setfileno(FILE *fs, int fd);
|
||||||
|
|
||||||
|
int fbufcount(FILE* fs);
|
||||||
|
|
||||||
|
int ibuf_empty(FILE *fs);
|
||||||
|
|
||||||
|
int obuf_full(FILE *fs);
|
|
@ -0,0 +1 @@
|
||||||
|
#undef HAVE_DLOPEN
|
|
@ -0,0 +1,8 @@
|
||||||
|
;;; OS-dependent time stuff
|
||||||
|
;;; Copyright (c) 1995 by Olin Shivers. See file COPYING.
|
||||||
|
|
||||||
|
;;; This suffices for BSD systems with the gettimeofday()
|
||||||
|
;;; microsecond-resolution timer.
|
||||||
|
|
||||||
|
(define (ticks/sec) 1000000) ; usec
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
/* OS-dependent support for fine-grained timer.
|
||||||
|
** Copyright (c) 1995 by Olin Shivers.
|
||||||
|
**
|
||||||
|
** We return the current time in seconds and sub-second "ticks" where the
|
||||||
|
** number of ticks/second is OS dependent (and is defined in time_dep.scm).
|
||||||
|
** This definition works on any BSD Unix with the gettimeofday()
|
||||||
|
** microsecond-resolution timer.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include "scheme48.h"
|
||||||
|
#include "../time1.h"
|
||||||
|
|
||||||
|
/* Sux because it's dependent on 32-bitness. */
|
||||||
|
#define hi8(i) (((i)>>24) & 0xff)
|
||||||
|
#define lo24(i) ((i) & 0xffffff)
|
||||||
|
#define comp8_24(hi, lo) (((hi)<<24) + (lo))
|
||||||
|
|
||||||
|
s48_value time_plus_ticks(int *hi_secs, int *lo_secs,
|
||||||
|
int *hi_ticks, int *lo_ticks)
|
||||||
|
{
|
||||||
|
struct timeval t;
|
||||||
|
struct timezone tz;
|
||||||
|
|
||||||
|
if( gettimeofday(&t, &tz) ) return s48_enter_fixnum(errno);
|
||||||
|
|
||||||
|
{ long int secs = t.tv_sec;
|
||||||
|
long int ticks = t.tv_usec;
|
||||||
|
|
||||||
|
*hi_secs = hi8(secs);
|
||||||
|
*lo_secs = lo24(secs);
|
||||||
|
*hi_ticks = hi8(ticks);
|
||||||
|
*lo_ticks = lo24(ticks);
|
||||||
|
}
|
||||||
|
|
||||||
|
return S48_FALSE;
|
||||||
|
}
|
|
@ -0,0 +1,215 @@
|
||||||
|
;;; Constant definitions for tty control code (POSIX termios).
|
||||||
|
;;; Copyright (c) 1995 by Brian Carlstrom. See file COPYING.
|
||||||
|
;;; Largely rehacked by Olin.
|
||||||
|
|
||||||
|
;;; These constants are for Solaris 2.x,
|
||||||
|
;;; and are taken from /usr/include/sys/termio.h
|
||||||
|
;;; and /usr/include/sys/termios.h.
|
||||||
|
|
||||||
|
;;; Non-standard (POSIX, SVR4, 4.3+BSD) things:
|
||||||
|
;;; - Some of the baud rates.
|
||||||
|
|
||||||
|
|
||||||
|
;;; Special Control Characters
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;;; Indices into the c_cc[] character array.
|
||||||
|
|
||||||
|
;;; Name Subscript Enabled by
|
||||||
|
;;; ---- --------- ----------
|
||||||
|
;;; POSIX
|
||||||
|
(define ttychar/eof 4) ; ^d icanon
|
||||||
|
(define ttychar/eol 5) ; icanon
|
||||||
|
(define ttychar/delete-char 2) ; ^? icanon
|
||||||
|
(define ttychar/delete-line 3) ; ^u icanon
|
||||||
|
(define ttychar/interrupt 0) ; ^c isig
|
||||||
|
(define ttychar/quit 1) ; ^\ isig
|
||||||
|
(define ttychar/suspend 10) ; ^z isig
|
||||||
|
(define ttychar/start 8) ; ^q ixon, ixoff
|
||||||
|
(define ttychar/stop 9) ; ^s ixon, ixoff
|
||||||
|
(define ttychar/min 4) ; !icanon ; Not exported
|
||||||
|
(define ttychar/time 5) ; !icanon ; Not exported
|
||||||
|
|
||||||
|
;;; SVR4 & 4.3+BSD
|
||||||
|
(define ttychar/delete-word 14) ; ^w icanon
|
||||||
|
(define ttychar/reprint 12) ; ^r icanon
|
||||||
|
(define ttychar/literal-next 15) ; ^v iexten
|
||||||
|
(define ttychar/discard 13) ; ^o iexten
|
||||||
|
(define ttychar/delayed-suspend 11) ; ^y isig
|
||||||
|
(define ttychar/eol2 6) ; icanon
|
||||||
|
|
||||||
|
;;; 4.3+BSD
|
||||||
|
(define ttychar/status #f) ; ^t icanon
|
||||||
|
|
||||||
|
;;; Length of control-char string -- *Not Exported*
|
||||||
|
(define num-ttychars 19)
|
||||||
|
|
||||||
|
;;; Magic "disable feature" tty character
|
||||||
|
(define disable-tty-char (ascii->char #x00)) ; _POSIX_VDISABLE
|
||||||
|
|
||||||
|
;;; Flags controllling input processing
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
;;; POSIX
|
||||||
|
(define ttyin/ignore-break #o00001) ; ignbrk
|
||||||
|
(define ttyin/interrupt-on-break #o00002) ; brkint
|
||||||
|
(define ttyin/ignore-bad-parity-chars #o00004) ; ignpar
|
||||||
|
(define ttyin/mark-parity-errors #o00010) ; parmrk
|
||||||
|
(define ttyin/check-parity #o00020) ; inpck
|
||||||
|
(define ttyin/7bits #o00040) ; istrip
|
||||||
|
(define ttyin/nl->cr #o00100) ; inlcr
|
||||||
|
(define ttyin/ignore-cr #o00200) ; igncr
|
||||||
|
(define ttyin/cr->nl #o00400) ; icrnl
|
||||||
|
(define ttyin/output-flow-ctl #o02000) ; ixon
|
||||||
|
(define ttyin/input-flow-ctl #o10000) ; ixoff
|
||||||
|
|
||||||
|
;;; SVR4 & 4.3+BSD
|
||||||
|
(define ttyin/xon-any #o4000) ; ixany: Any char restarts after stop
|
||||||
|
(define ttyin/beep-on-overflow #o20000) ; imaxbel: queue full => ring bell
|
||||||
|
|
||||||
|
;;; SVR4
|
||||||
|
(define ttyin/lowercase #o1000) ; iuclc: Map upper-case to lower case
|
||||||
|
|
||||||
|
|
||||||
|
;;; Flags controlling output processing
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
;;; POSIX
|
||||||
|
(define ttyout/enable #o000001) ; opost: enable output processing
|
||||||
|
|
||||||
|
;;; SVR4 & 4.3+BSD
|
||||||
|
(define ttyout/nl->crnl #o000004) ; onlcr: map nl to cr-nl
|
||||||
|
|
||||||
|
;;; 4.3+BSD
|
||||||
|
(define ttyout/discard-eot #f) ; onoeot
|
||||||
|
(define ttyout/expand-tabs #f) ; oxtabs (NOT xtabs)
|
||||||
|
|
||||||
|
;;; SVR4
|
||||||
|
(define ttyout/cr->nl #o000010) ; ocrnl
|
||||||
|
(define ttyout/fill-w/del #o000200) ; ofdel
|
||||||
|
(define ttyout/delay-w/fill-char #o000100) ; ofill
|
||||||
|
(define ttyout/uppercase #o000002) ; olcuc
|
||||||
|
(define ttyout/nl-does-cr #o000040) ; onlret
|
||||||
|
(define ttyout/no-col0-cr #o000020) ; onocr
|
||||||
|
|
||||||
|
;;; Newline delay
|
||||||
|
(define ttyout/nl-delay #o000400) ; mask (nldly)
|
||||||
|
(define ttyout/nl-delay0 #o000000)
|
||||||
|
(define ttyout/nl-delay1 #o000400) ; tty 37
|
||||||
|
|
||||||
|
;;; Horizontal-tab delay
|
||||||
|
(define ttyout/tab-delay #o014000) ; mask (tabdly)
|
||||||
|
(define ttyout/tab-delay0 #o000000)
|
||||||
|
(define ttyout/tab-delay1 #o004000) ; tty 37
|
||||||
|
(define ttyout/tab-delay2 #o010000)
|
||||||
|
(define ttyout/tab-delayx #o014000) ; Expand tabs (xtabs, tab3)
|
||||||
|
|
||||||
|
;;; Carriage-return delay
|
||||||
|
(define ttyout/cr-delay #o003000) ; mask (crdly)
|
||||||
|
(define ttyout/cr-delay0 #o000000)
|
||||||
|
(define ttyout/cr-delay1 #o001000) ; tn 300
|
||||||
|
(define ttyout/cr-delay2 #o002000) ; tty 37
|
||||||
|
(define ttyout/cr-delay3 #o003000) ; concept 100
|
||||||
|
|
||||||
|
;;; Vertical tab delay
|
||||||
|
(define ttyout/vtab-delay #o040000) ; mask (vtdly)
|
||||||
|
(define ttyout/vtab-delay0 #o000000)
|
||||||
|
(define ttyout/vtab-delay1 #o040000) ; tty 37
|
||||||
|
|
||||||
|
;;; Backspace delay
|
||||||
|
(define ttyout/bs-delay #o020000) ; mask (bsdly)
|
||||||
|
(define ttyout/bs-delay0 #o000000)
|
||||||
|
(define ttyout/bs-delay1 #o020000)
|
||||||
|
|
||||||
|
;;; Form-feed delay
|
||||||
|
(define ttyout/ff-delay #o100000) ; mask (ffdly)
|
||||||
|
(define ttyout/ff-delay0 #o000000)
|
||||||
|
(define ttyout/ff-delay1 #o100000)
|
||||||
|
|
||||||
|
(define ttyout/all-delay
|
||||||
|
(bitwise-ior (bitwise-ior (bitwise-ior ttyout/nl-delay ttyout/tab-delay)
|
||||||
|
(bitwise-ior ttyout/cr-delay ttyout/vtab-delay))
|
||||||
|
(bitwise-ior ttyout/bs-delay ttyout/ff-delay)))
|
||||||
|
|
||||||
|
|
||||||
|
;;; Control flags - hacking the serial-line.
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
;;; POSIX
|
||||||
|
(define ttyc/char-size #o00060) ; csize: character size mask
|
||||||
|
(define ttyc/char-size5 #o00000) ; 5 bits (cs5)
|
||||||
|
(define ttyc/char-size6 #o00020) ; 6 bits (cs6)
|
||||||
|
(define ttyc/char-size7 #o00040) ; 7 bits (cs7)
|
||||||
|
(define ttyc/char-size8 #o00060) ; 8 bits (cs8)
|
||||||
|
(define ttyc/2-stop-bits #o00100) ; cstopb: Send 2 stop bits.
|
||||||
|
(define ttyc/enable-read #o00200) ; cread: Enable receiver.
|
||||||
|
(define ttyc/enable-parity #o00400) ; parenb
|
||||||
|
(define ttyc/odd-parity #o01000) ; parodd
|
||||||
|
(define ttyc/hup-on-close #o02000) ; hupcl: Hang up on last close.
|
||||||
|
(define ttyc/no-modem-sync #o04000) ; clocal: Ignore modem lines.
|
||||||
|
|
||||||
|
;;; 4.3+BSD
|
||||||
|
(define ttyc/ignore-flags #f) ; cignore: ignore control flags
|
||||||
|
(define ttyc/CTS-output-flow-ctl #f) ; ccts_oflow: CTS flow control of output
|
||||||
|
(define ttyc/RTS-input-flow-ctl #f) ; crts_iflow: RTS flow control of input
|
||||||
|
(define ttyc/carrier-flow-ctl #f) ; mdmbuf
|
||||||
|
|
||||||
|
;;; Local flags -- hacking the tty driver / user interface.
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
;;; POSIX
|
||||||
|
(define ttyl/visual-delete #o020) ; echoe: Visually erase chars
|
||||||
|
(define ttyl/echo-delete-line #o040) ; echok: Echo nl after line kill
|
||||||
|
(define ttyl/echo #o010) ; echo: Enable echoing
|
||||||
|
(define ttyl/echo-nl #o100) ; echonl: Echo nl even if echo is off
|
||||||
|
(define ttyl/canonical #o002) ; icanon: Canonicalize input
|
||||||
|
(define ttyl/enable-signals #o001) ; isig: Enable ^c, ^z signalling
|
||||||
|
(define ttyl/extended #o100000) ; iexten: Enable extensions
|
||||||
|
(define ttyl/ttou-signal #o400) ; tostop: SIGTTOU on background output
|
||||||
|
(define ttyl/no-flush-on-interrupt #o200) ; noflsh
|
||||||
|
|
||||||
|
;;; SVR4 & 4.3+BSD
|
||||||
|
(define ttyl/visual-delete-line #o04000); echoke: visually erase a line-kill
|
||||||
|
(define ttyl/hardcopy-delete #o02000); echoprt: visual erase for hardcopy
|
||||||
|
(define ttyl/echo-ctl #o01000); echoctl: echo control chars as "^X"
|
||||||
|
(define ttyl/flush-output #o20000); flusho: output is being flushed
|
||||||
|
(define ttyl/reprint-unread-chars #o40000); pendin: retype pending input
|
||||||
|
|
||||||
|
;;; 4.3+BSD
|
||||||
|
(define ttyl/alt-delete-word #f) ; altwerase
|
||||||
|
(define ttyl/no-kernel-status #f) ; nokerninfo: no kernel status on ^T
|
||||||
|
|
||||||
|
;;; SVR4
|
||||||
|
(define ttyl/case-map #o4) ; xcase: canonical upper/lower presentation
|
||||||
|
|
||||||
|
;;; Vector of (speed . code) pairs.
|
||||||
|
|
||||||
|
(define baud-rates '#((0 . 0) (1 . 50) (2 . 75)
|
||||||
|
(3 . 110) (4 . 134) (5 . 150)
|
||||||
|
(6 . 200) (7 . 300) (8 . 600)
|
||||||
|
(9 . 1200) (10 . 1800) (11 . 2400)
|
||||||
|
(12 . 4800) (13 . 9600) (14 . 19200)
|
||||||
|
(15 . 38400)))
|
||||||
|
|
||||||
|
;;; tcflush() constants
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(define %flush-tty/input 0) ; TCIFLUSH
|
||||||
|
(define %flush-tty/output 1) ; TCOFLUSH
|
||||||
|
(define %flush-tty/both 2) ; TCIOFLUSH
|
||||||
|
|
||||||
|
|
||||||
|
;;; tcflow() constants
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(define %tcflow/start-out 1) ; TCOON
|
||||||
|
(define %tcflow/stop-out 0) ; TCOOFF
|
||||||
|
(define %tcflow/start-in 3) ; TCION
|
||||||
|
(define %tcflow/stop-in 2) ; TCIOFF
|
||||||
|
|
||||||
|
|
||||||
|
;;; tcsetattr() constants
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(define %set-tty-info/now 21518) ; TCSANOW Make change immediately.
|
||||||
|
(define %set-tty-info/drain 21519) ; TCSADRAIN Drain output, then change.
|
||||||
|
(define %set-tty-info/flush 21520) ; TCSAFLUSH Drain output, flush input.
|
|
@ -0,0 +1,40 @@
|
||||||
|
;;; Scsh routines for analysing exit codes returned by WAIT.
|
||||||
|
;;; Copyright (c) 1994 by Olin Shivers. See file COPYING.
|
||||||
|
;;;
|
||||||
|
;;; 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 NeXTSTEP.
|
||||||
|
;;;
|
||||||
|
;;; I could have done a portable version by making C calls for this,
|
||||||
|
;;; but it's such overkill.
|
||||||
|
|
||||||
|
|
||||||
|
;;; If process terminated normally, return the exit code, otw #f.
|
||||||
|
|
||||||
|
(define (status:exit-val status)
|
||||||
|
(and (zero? (bitwise-and #xFF status))
|
||||||
|
(bitwise-and #xFF (arithmetic-shift status -8))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;; If the process was suspended, return the suspending signal, otw #f.
|
||||||
|
|
||||||
|
(define (status:stop-sig status)
|
||||||
|
(and (not (zero? (bitwise-and status #x40)))
|
||||||
|
(bitwise-and #x7F (arithmetic-shift status -8))))
|
||||||
|
|
||||||
|
|
||||||
|
;;; If the process terminated abnormally,
|
||||||
|
;;; return the terminating signal, otw #f.
|
||||||
|
|
||||||
|
(define (status:term-sig status)
|
||||||
|
(and (not (zero? (bitwise-and status #xFF))) ; Didn't exit.
|
||||||
|
(zero? (bitwise-and status #x40)) ; Not suspended.
|
||||||
|
(bitwise-and status #x7F)))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;; Flags.
|
||||||
|
(define wait/poll #o100) ; Don't hang if nothing to wait for.
|
||||||
|
(define wait/stopped-children 4) ; Report on suspended subprocs, too.
|
Loading…
Reference in New Issue