Changeset 15367 for trunk/abcl/contrib/abcl-introspect/util.lisp
- Timestamp:
- 08/13/20 19:24:25 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/contrib/abcl-introspect/util.lisp
r15356 r15367 22 22 (java:jnew-array-from-array "byte" array)))) 23 23 24 25 24 (export '(write-class 26 25 read-class) 27 26 :extensions) 28 27 28 ;;; Determining the underlying unix file descriptor depends on 29 ;;; navigating private member structures dependent on the hosting 30 ;;; JVMs wrapping of native socket. The JAVA package currently does 31 ;;; not have a means for such aggressive intropsection, so we add it 32 ;;; as a utility here 33 ;;; 34 ;;; TODO test under :msdog 35 ;;; TODO Should be in socket.lisp 36 (defun stream-unix-fd (stream) 37 "Return the integer of the underlying unix file descriptor for STREAM 38 39 Added by ABCL-INTROSPECT." 40 (check-type stream 'system::socket-stream) 41 (flet ((get-java-fields (object fields) ;; Thanks to Cyrus Harmon 42 (reduce (lambda (x y) 43 (jss:get-java-field x y t)) 44 fields 45 :initial-value object)) 46 (jvm-version () 47 (read 48 (make-string-input-stream 49 (java:jstatic "getProperty" "java.lang.System" 50 "java.specification.version"))))) 51 (ignore-errors 52 (get-java-fields (java:jcall "getWrappedInputStream" ;; TODO: define this as a constant 53 (two-way-stream-input-stream stream)) 54 (if (< (jvm-version) 14) 55 '("in" "ch" "fdVal") 56 '("in" "this$0" "sc" "fd" "fd")))))) 57 58 (export '(stream-unix-fd) :extensions)
Note: See TracChangeset
for help on using the changeset viewer.