Changeset 14288


Ignore:
Timestamp:
Sep 20, 2010, 2:57:25 AM (9 years ago)
Author:
gb
Message:

l1-boot-2.lisp:
In INITIALIZE-INTERACTIVE-STREAMS: ensure that *STDOUT*, *STDERR*, and

(if it's disjoint) *TERMINAL-OUTPUT* are auto-flushed.

linux-files.lisp:
#+windows-target Define GET-LAST-WINDOWS-ERROR, so that #_GetLastError
can be called from code that may have to run before the FFI is
initialized.
When prompting the user to type :Y, force output. (This may run on the
housekeeping thread, so that output may not get autoflushed.)

l0-cfm-support.lisp: if GET-SHARED-LIBRARY fails, signal the error on
the calling thread (even if the #_dlopen/whatever happens on the initial
thread); fixes ticket:742

Location:
trunk/source
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/level-0/l0-cfm-support.lisp

    r14180 r14288  
    332332                         (%null-ptr))))))
    333333    (if (%null-ptr-p link-map)
    334       (error "Error opening shared library ~s: ~a" name (dlerror))
     334      (values nil (dlerror))
    335335      (prog1 (let* ((lib (shlib-from-map-entry link-map)))
    336336               (incf (shlib.opencount lib))
     
    412412         ((= 0 (pref type :signed))
    413413          ;; neither a dylib nor bundle was found
    414           (error "Error opening shared library ~s: ~a" name
    415                  (%get-cstring result)))
    416          (t (error "Unknown error opening shared library ~s." name))))))
     414          (values nil (%get-cstring result)))
     415         (t (values nil "unknown error"))))))
    417416
    418417;;; Walk over all registered entrypoints, invalidating any whose container
     
    593592          (setf (shlib.handle shlib) hmodule)
    594593          shlib)
    595         (error "Can't open shared library ~s" name))))
     594        (values nil (%windows-error-string (get-last-windows-error))))))
    596595
    597596(init-shared-libraries)
     
    983982loaded, signal a SIMPLE-ERROR which contains an often-cryptic message from
    984983the operating system."
    985   (if (or (eq process :current)
    986           (eq process *current-process*)
    987           (and (eq process :initial)
    988                (eq *current-process* *initial-process*)))
    989     (open-shared-library-internal name)
    990     (call-in-process (lambda () (open-shared-library name))
    991                      (if (eq process :initial)
    992                        *initial-process*
    993                        process))))
    994 
    995 
     984    (multiple-value-bind (lib error-string)
     985        (if (or (eq process :current)
     986                (eq process *current-process*)
     987                (and (eq process :initial)
     988                     (eq *current-process* *initial-process*)))
     989          (open-shared-library-internal name)
     990         
     991          (call-in-process (lambda () (open-shared-library-internal  name))
     992                           (if (eq process :initial)
     993                             *initial-process*
     994                             process)))
     995      (or lib
     996          (error "Error opening shared library ~a : ~a." name error-string))))
     997
     998
  • trunk/source/level-1/l1-boot-2.lisp

    r14171 r14288  
    118118                                   #+windows-target (%ptr-to-int
    119119                                                     (#_GetStdHandle #$STD_ERROR_HANDLE))
    120                     :basic t :direction :output :sharing :lock :encoding encoding-name #+windows-target :line-termination #+windows-target :crlf))
     120                                   :basic t :direction :output :sharing :lock :encoding encoding-name #+windows-target :line-termination #+windows-target :crlf))
     121    (add-auto-flush-stream *stdout*)
     122    (add-auto-flush-stream *stderr*)
    121123    (if *batch-flag*
    122124      (let* ((tty-fd
    123                #-windows-target
     125              #-windows-target
    124126               (let* ((fd (fd-open "/dev/tty" #$O_RDWR)))
    125127                 (if (>= fd 0) fd)))
    126128             (can-use-tty #-windows-target (and tty-fd (eql (tcgetpgrp tty-fd) (getpid)))))
    127129        (if can-use-tty
    128           (setq
    129            *terminal-input* (make-fd-stream tty-fd
    130                                             :basic t
    131                                             :direction :input
    132                                             :interactive t
    133                                             :sharing :lock
    134                                             :encoding encoding-name)
    135            *terminal-output* (make-fd-stream tty-fd :basic t :direction :output :sharing :lock :encoding encoding-name)
    136            *terminal-io* (make-echoing-two-way-stream
    137                           *terminal-input* *terminal-output*))
     130          (progn
     131            (setq
     132             *terminal-input* (make-fd-stream tty-fd
     133                                              :basic t
     134                                              :direction :input
     135                                              :interactive t
     136                                              :sharing :lock
     137                                              :encoding encoding-name)
     138             *terminal-output* (make-fd-stream tty-fd :basic t :direction :output :sharing :lock :encoding encoding-name)
     139             *terminal-io* (make-echoing-two-way-stream
     140                            *terminal-input* *terminal-output*))
     141            (add-auto-flush-stream *terminal-output*))
    138142          (progn
    139143            (when tty-fd (fd-close tty-fd))
  • trunk/source/level-1/linux-files.lisp

    r14258 r14288  
    890890
    891891#+windows-target
    892 (defun %windows-error-string (error-number) 
     892(progn
     893(defun get-last-windows-error ()
     894  (#_GetLastError()))
     895
     896(defun %windows-error-string (error-number)
    893897  (rlet ((pbuffer :address (%null-ptr)))
    894898    (if (eql 0
     
    908912        (#_LocalFree p)
    909913        q))))
     914)
    910915       
    911916                     
     
    19451950        (format t "~%~%;;;~%;;; ~a requires access to ~a~%;;; Type (:y ~D) to yield control to this thread.~%;;;~%"
    19461951                *current-process* (shared-resource-name resource)
    1947                 (process-serial-number *current-process*)))
     1952                (process-serial-number *current-process*))
     1953        (force-output t))
    19481954      (with-lock-grabbed ((shared-resource-lock resource))
    19491955        (append-dll-node request (shared-resource-requestors resource)))
Note: See TracChangeset for help on using the changeset viewer.