Changeset 4895
- Timestamp:
- Jul 23, 2006, 12:12:42 AM (18 years ago)
- Location:
- trunk/ccl/level-1
- Files:
-
- 4 edited
-
l1-boot-2.lisp (modified) (2 diffs)
-
l1-sockets.lisp (modified) (5 diffs)
-
l1-streams.lisp (modified) (13 diffs)
-
l1-sysio.lisp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/level-1/l1-boot-2.lisp
r4890 r4895 83 83 (def-ccl-pointers fd-streams () 84 84 (setq *stdin* (make-fd-stream 0 85 : private nil85 :sharing :lock 86 86 :direction :input 87 87 :interactive (not *batch-flag*))) 88 (setq *stdout* (make-fd-stream 1 :direction :output : private nil))89 90 (setq *stderr* (make-fd-stream 2 :direction :output : private nil))88 (setq *stdout* (make-fd-stream 1 :direction :output :sharing :lock)) 89 90 (setq *stderr* (make-fd-stream 2 :direction :output :sharing :lock)) 91 91 (if *batch-flag* 92 92 (let* ((tty-fd (let* ((fd (fd-open "/dev/tty" #$O_RDWR))) … … 98 98 :direction :input 99 99 :interactive t 100 : private nil)101 *terminal-output* (make-fd-stream tty-fd :direction :output : private nil)100 :sharing :lock) 101 *terminal-output* (make-fd-stream tty-fd :direction :output :sharing :lock) 102 102 *terminal-io* (make-echoing-two-way-stream 103 103 *terminal-input* *terminal-output*)) -
trunk/ccl/level-1/l1-sockets.lisp
r4890 r4895 569 569 keepalive reuse-address nodelay broadcast linger 570 570 local-port local-host backlog class out-of-band-inline 571 local-filename remote-filename private)571 local-filename remote-filename sharing) 572 572 "Create and return a new socket." 573 573 (declare (dynamic-extent keys)) … … 575 575 keepalive reuse-address nodelay broadcast linger 576 576 local-port local-host backlog class out-of-band-inline 577 local-filename remote-filename private))577 local-filename remote-filename sharing)) 578 578 (ecase address-family 579 579 ((:file) (apply #'make-file-socket keys)) … … 666 666 667 667 668 (defun make-tcp-stream (fd &key format eol (class 'tcp-stream) private&allow-other-keys)668 (defun make-tcp-stream (fd &key format eol (class 'tcp-stream) sharing &allow-other-keys) 669 669 (declare (ignore eol)) ;??? 670 670 (let ((element-type (ecase format … … 677 677 :direction :io 678 678 :element-type element-type 679 : private private)))680 681 (defun make-file-socket-stream (fd &key format eol (class 'file-socket-stream) private&allow-other-keys)679 :sharing sharing))) 680 681 (defun make-file-socket-stream (fd &key format eol (class 'file-socket-stream) sharing &allow-other-keys) 682 682 (declare (ignore eol)) ;??? 683 683 (let ((element-type (ecase format … … 690 690 :direction :io 691 691 :element-type element-type 692 : private private)))692 :sharing sharing))) 693 693 694 694 (defun make-tcp-listener-socket (fd &rest keys &key backlog &allow-other-keys) -
trunk/ccl/level-1/l1-streams.lisp
r4893 r4895 275 275 (defmethod close ((stream stream) &key abort) 276 276 (declare (ignore abort)) 277 (with-slots ((closed closed)) stream 278 (unless closed 279 (setf closed t)))) 277 (open-stream-p stream)) 280 278 281 279 … … 420 418 421 419 (defmacro with-ioblock-input-locked ((ioblock) &body body) 422 `(if (check-ioblock-owner ,ioblock) 423 (progn ,@body) 424 (with-ioblock-lock-grabbed ((locally (declare (optimize (speed 3) (safety 0))) 420 (let* ((lock (gensym))) 421 `(let* ((,lock (locally (declare (optimize (speed 3) (safety 0))) 422 (ioblock-inbuf-lock ,ioblock)))) 423 (if ,lock 424 (with-ioblock-lock-grabbed ((locally (declare (optimize (speed 3) (safety 0))) 425 425 (ioblock-inbuf-lock ,ioblock))) 426 ,@body))) 426 ,@body) 427 (progn 428 (check-ioblock-owner ,ioblock) 429 ,@body))))) 430 427 431 428 432 (defmacro with-ioblock-output-locked ((ioblock) &body body) 429 `(if (check-ioblock-owner ,ioblock) 430 (progn ,@body) 431 (with-ioblock-lock-grabbed ((locally (declare (optimize (speed 3) (safety 0))) 433 (let* ((lock (gensym))) 434 `(let* ((,lock (locally (declare (optimize (speed 3) (safety 0))) 435 (ioblock-inbuf-lock ,ioblock)))) 436 (if ,lock 437 (with-ioblock-lock-grabbed ((locally (declare (optimize (speed 3) (safety 0))) 432 438 (ioblock-outbuf-lock ,ioblock))) 433 ,@body))) 439 ,@body) 440 (progn 441 (check-ioblock-owner ,ioblock) 442 ,@body))))) 434 443 435 444 (defmacro with-ioblock-output-locked-maybe ((ioblock) &body body) 436 `(if (check-ioblock-owner ,ioblock) 437 (progn ,@body) 438 (with-ioblock-lock-grabbed-maybe ((locally (declare (optimize (speed 3) (safety 0))) 439 (ioblock-outbuf-lock ,ioblock))) 440 ,@body))) 445 (let* ((lock (gensym))) 446 `(let* ((,lock (locally (declare (optimize (speed 3) (safety 0))) 447 (ioblock-inbuf-lock ,ioblock)))) 448 (if ,lock 449 (with-ioblock-lock-grabbed-maybe ((locally (declare (optimize (speed 3) (safety 0))) 450 (ioblock-outbuf-lock ,ioblock))) 451 ,@body) 452 (progn 453 (check-ioblock-owner ,ioblock) 454 ,@body))))) 441 455 442 456 (defun %ioblock-advance (ioblock read-p) … … 484 498 (setf (io-buffer-idx buf) (the fixnum (1+ idx))) 485 499 (schar (io-buffer-buffer buf) idx)))) 500 501 (declaim (inline %private-ioblock-tyi)) 502 (defun %private-ioblock-tyi (ioblock) 503 (declare (optimize (speed 3) (safety 0))) 504 (check-ioblock-owner ioblock) 505 (if (ioblock-untyi-char ioblock) 506 (prog1 (ioblock-untyi-char ioblock) 507 (setf (ioblock-untyi-char ioblock) nil)) 508 (let* ((buf (ioblock-inbuf ioblock)) 509 (idx (io-buffer-idx buf)) 510 (limit (io-buffer-count buf))) 511 (declare (fixnum idx limit)) 512 (when (= idx limit) 513 (unless (%ioblock-advance ioblock t) 514 (return-from %private-ioblock-tyi (if (ioblock-eof ioblock) :eof))) 515 (setq idx (io-buffer-idx buf) 516 limit (io-buffer-count buf))) 517 (setf (io-buffer-idx buf) (the fixnum (1+ idx))) 518 (schar (io-buffer-buffer buf) idx)))) 519 520 (declaim (inline %locked-ioblock-tyi)) 521 (defun %locked-ioblock-tyi (ioblock) 522 (declare (optimize (speed 3) (safety 0))) 523 (with-ioblock-lock-grabbed ((locally (declare (optimize (speed 3) (safety 0))) 524 (ioblock-inbuf-lock ioblock))) 525 (if (ioblock-untyi-char ioblock) 526 (prog1 (ioblock-untyi-char ioblock) 527 (setf (ioblock-untyi-char ioblock) nil)) 528 (let* ((buf (ioblock-inbuf ioblock)) 529 (idx (io-buffer-idx buf)) 530 (limit (io-buffer-count buf))) 531 (declare (fixnum idx limit)) 532 (when (= idx limit) 533 (unless (%ioblock-advance ioblock t) 534 (return-from %locked-ioblock-tyi (if (ioblock-eof ioblock) :eof))) 535 (setq idx (io-buffer-idx buf) 536 limit (io-buffer-count buf))) 537 (setf (io-buffer-idx buf) (the fixnum (1+ idx))) 538 (schar (io-buffer-buffer buf) idx))))) 486 539 487 540 (declaim (inline %ioblock-tyy-no-hang)) … … 926 979 element-shift 927 980 interactive 928 private 981 (sharing :private) 982 character-p 929 983 &allow-other-keys) 930 984 (declare (ignorable element-shift)) 985 (when sharing 986 (unless (or (eq sharing :private) 987 (eq sharing :lock)) 988 (if (eq sharing :external) 989 (setq sharing nil) 990 (report-bad-arg sharing '(member nil :private :lock :external))))) 931 991 (let* ((ioblock (or (let* ((ioblock (stream-ioblock stream nil))) 932 992 (when ioblock … … 934 994 ioblock)) 935 995 (stream-create-ioblock stream)))) 936 (when private996 (when (eq sharing :private) 937 997 (setf (ioblock-owner ioblock) *current-process*)) 938 998 (when insize … … 945 1005 :size in-size-in-octets 946 1006 :limit insize)) 947 ( unless private1007 (when (eq sharing :lock) 948 1008 (setf (ioblock-inbuf-lock ioblock) (make-lock))) 1009 (if character-p 1010 (setf (ioblock-read-char-function ioblock) 1011 (case sharing 1012 (:private '%private-ioblock-tyi) 1013 (:lock '%locked-ioblock-tyi) 1014 (t '%ioblock-tyi)))) 949 1015 (setf (ioblock-element-shift ioblock) (max 0 (ceiling (log (/ in-size-in-octets insize) 2)))) 950 1016 ))) … … 967 1033 :limit outsize 968 1034 :size out-size-in-octets)) 969 ( unless private1035 (when (eq sharing :lock) 970 1036 (setf (ioblock-outbuf-lock ioblock) (make-lock))) 971 1037 (setf (ioblock-element-shift ioblock) (max 0 (ceiling (log (/ out-size-in-octets outsize) 2)))) … … 1025 1091 (element-type 'character) 1026 1092 (class 'fd-stream) 1027 ( private t))1093 (sharing :private)) 1028 1094 (let* ((in-p (member direction '(:io :input))) 1029 1095 (out-p (member direction '(:io :output))) … … 1044 1110 (select-stream-force-output-function class)) 1045 1111 :close-function 'fd-stream-close 1046 :private private))) 1112 :sharing sharing 1113 :character-p char-p))) 1047 1114 1048 1115 ;;; Fundamental streams. … … 1133 1200 fundamental-binary-stream 1134 1201 binary-input-stream) 1202 ()) 1203 1204 (defclass binary-output-stream (output-stream binary-stream) 1135 1205 ()) 1136 1206 … … 1633 1703 (when (slot-value s 'string) 1634 1704 (setf (slot-value s 'string) nil) 1635 (call-next-method)1636 1705 t)) 1637 1706 … … 2543 2612 (class *default-file-stream-class*) 2544 2613 (elements-per-buffer *elements-per-buffer*) 2545 ( private t))2614 (sharing :private)) 2546 2615 "Return a stream which reads from or writes to FILENAME. 2547 2616 Defined keywords: … … 2563 2632 class 2564 2633 external-format 2565 private))2634 sharing)) 2566 2635 (retry-open () 2567 2636 :report (lambda (stream) (format stream "Retry opening ~s" filename)) -
trunk/ccl/level-1/l1-sysio.lisp
r4890 r4895 509 509 class 510 510 external-format 511 private)511 sharing) 512 512 513 513 (let* ((temp-name nil) … … 570 570 :element-type element-type 571 571 :elements-per-buffer elements-per-buffer 572 : private private)572 :sharing sharing) 573 573 (let* ((in-p (member direction '(:io :input))) 574 574 (out-p (member direction '(:io :output))) … … 614 614 :device fd 615 615 :external-format real-external-format 616 : private private))616 :sharing sharing)) 617 617 (ioblock (stream-ioblock fstream))) 618 618 (setf (stream-filename fstream) (namestring pathname)
Note:
See TracChangeset
for help on using the changeset viewer.
