Hacked I/O system so that ports set/clear their

fd's CLOEXEC bit when they become unrevealed/revealed.
This commit is contained in:
shivers 1996-09-12 01:42:58 +00:00
parent dfda637610
commit aed6c163b8
4 changed files with 36 additions and 76 deletions

View File

@ -7,12 +7,7 @@
;;; These constants are not likely to change from stdio lib to stdio lib, ;;; These constants are not likely to change from stdio lib to stdio lib,
;;; but you need to check when you do a port. ;;; but you need to check when you do a port.
(define-syntax define-bufpols (define-enum-constants bufpol
(syntax-rules ()
((define-bufpols form ...)
(begin (define-enum-constant "bufpol" . form) ...))))
(define-bufpols
(block 0) ; _IOFBF (block 0) ; _IOFBF
(line 1) ; _IOLBF (line 1) ; _IOLBF
(none 2)) ; _IONBF (none 2)) ; _IONBF

View File

@ -5,14 +5,9 @@
;;; These are the correct values for BSD4.4-Lite-based systems ;;; These are the correct values for BSD4.4-Lite-based systems
;;; such as NetBSD 1.0 and FreeBSD 2.0. ;;; such as NetBSD 1.0 and FreeBSD 2.0.
(define-syntax define-errnos
(syntax-rules ()
((define-errnos form ...)
(begin (define-enum-constant "errno" . form) ...))))
(define errno/2big 7) ; 2big is not a legit Scheme symbol. Lose, lose. (define errno/2big 7) ; 2big is not a legit Scheme symbol. Lose, lose.
(define-errnos (define-enum-constants errno
;; POSIX: ;; POSIX:
(perm 1) ; Operation not permitted (perm 1) ; Operation not permitted
(noent 2) ; No such file or directory (noent 2) ; No such file or directory

View File

@ -2,12 +2,7 @@
;;; Copyright (c) 1993 by Olin Shivers. ;;; Copyright (c) 1993 by Olin Shivers.
;;; Copyright (c) 1994 by Brian D. Carlstrom ;;; Copyright (c) 1994 by Brian D. Carlstrom
(define-syntax define-open-flags (define-enum-constants open
(syntax-rules ()
((define-opens form ...)
(begin (define-enum-constant "open" . form) ...))))
(define-open-flags
;; POSIX ;; POSIX
(read #x0000) (read #x0000)
(write #x0001) (write #x0001)
@ -16,8 +11,8 @@
(append #x0008) ; set append mode (append #x0008) ; set append mode
;; BSD4.4-Lite ;; BSD4.4-Lite
(shlock #x0010) ; open with shared file lock (shared-lock #x0010) ; open with shared file lock
(exlock #x0020) ; open with exclusive file lock (exclusive-lock #x0020) ; open with exclusive file lock
(async #x0040) ; signal pgrep when data ready (async #x0040) ; signal pgrep when data ready
(fsync #x0080) ; synchronus writes (fsync #x0080) ; synchronus writes
@ -27,60 +22,34 @@
(exclusive #x0800) ; error if already exists (exclusive #x0800) ; error if already exists
(no-control-tty #x0000)) ; don't assign controlling terminal (no-control-tty #x0000)) ; don't assign controlling terminal
(define open/access-mask (define open/access-mask
(bitwise-ior open/read (bitwise-ior open/read
(bitwise-ior open/write open/read+write))) (bitwise-ior open/write open/read+write)))
;;;; fcntl ;;; fcntl() commands
;;;; Rough sketch only. Will define a separate proc for each fcntl command. (define-enum-constants fcntl
; (dup-fdes 0) ; F_DUPFD
;;;; fcntl commands (get-fdes-flags 1) ; F_GETFD
;dup (set-fdes-flags 2) ; F_SETFD
; (get-status-flags 3) ; F_GETFL
;get-flags ; Only gives close-on-exec bit. (set-status-flags 4) ; F_SETFL
;set-flags (get-owner 5) ; F_GETOWN (Not POSIX)
; (set-owner 6) ; F_SETOWN (Not POSIX)
;get-status ; Returns open flags + get-status flags (below) (get-record-lock 7) ; F_GETLK
;set-status ; Can set: append, sync, async, nbio, nonblocking, no-delay (set-record-lock-noblock 8) ; F_SETLK
; (set-record-lock 9)) ; F_SETLKW
;get-lock
;set-lock
;nonblocking-set-lock
;
;get-record-lock
;set-record-lock
;
;get-owner ; Not POSIX
;set-owner ; Not POSIX
;remote-set-lock ; Not POSIX
;nonblocking-remote-set-lock ; Not POSIX
;remote-get-lock ; Not POSIX
;
;;;; Flags
;
;close-on-exec ; get-flags
;
;async ; get-status
;no-delay ; get-status
;nbio ; get-status
;
;;; These are internal; they are not part of the supported scsh interface.
(define fcntl/close-on-exec 1) ;;; fcntl fdes-flags (F_GETFD)
(define fcntl/dupfd 0) (define fdflags/close-on-exec 1)
(define fcntl/get-fd-flags 1)
(define fcntl/set-fd-flags 2)
(define fcntl/get-file-flags 3)
(define fcntl/set-file-flags 4)
(define fcntl/get-owner 5) ; Not POSIX
(define fcntl/set-owner 6) ; Not POSIX
(define fcntl/get-record-lock 7) ; F_GETLK
(define fcntl/set-record-lock-noblock 8) ; F_SETLK
(define fcntl/set-record-lock 9) ; F_SETLKW
(define lock/read 1) ; F_RDLCK ;;; fcntl status-flags (F_GETFL)
(define lock/release 2) ; F_UNLCK ;;; Mostly, these are OPEN/... flags, like OPEN/APPEND.
(define lock/write 3) ; F_WRLCK ;;; (define fdstatus/... ...)
;;; fcntl lock values.
(define-enum-constants lock
(read 1) ; F_RDLCK
(release 2) ; F_UNLCK
(write 3)) ; F_WRLCK

View File

@ -2,12 +2,7 @@
;;; Copyright (c) 1994 by Olin Shivers. ;;; Copyright (c) 1994 by Olin Shivers.
;;; Copyright (c) 1994 by Brian D. Carlstrom. ;;; Copyright (c) 1994 by Brian D. Carlstrom.
(define-syntax define-signals (define-enum-constants signal
(syntax-rules ()
((define-signals form ...)
(begin (define-enum-constant "signal" . form) ...))))
(define-signals
;; POSIX ;; POSIX
(hup 1) ; hangup (hup 1) ; hangup
(int 2) ; interrupt (int 2) ; interrupt
@ -71,3 +66,9 @@
(usr1 30) ; user defined signal 1 (usr1 30) ; user defined signal 1
(usr2 31) ; user defined signal 2 (usr2 31) ; user defined signal 2
) )
(define signals-ignored-by-default
(list signal/alrm signal/hup signal/int signal/quit ; These are
signal/term signal/usr1 signal/usr2 ; Posix.
signal/info signal/prof signal/vtalrm ; These are
signal/xcpu signal/xfsz signal/io)) ; BSD-specific.