Changeset 11200


Ignore:
Timestamp:
Oct 22, 2008, 11:08:10 AM (11 years ago)
Author:
gb
Message:

Define PATHNAME-ENCODING-NAME and a SETF inverse for it.

Use WITH-FILENAME-CSTRS (which will change) in FD-OPEN.

File:
1 edited

Legend:

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

    r11058 r11200  
    195195
    196196
     197(let* ((pathname-encoding-name ()))
     198  (defun pathname-encoding-name ()
     199    pathname-encoding-name)
     200  (defun set-pathname-encoding-name (new)
     201    #+(or darwin-target windows-target) (declare (ignore new))
     202    #-(or darwin-target windows-target)
     203    (let* ((encoding (ensure-character-encoding new)))
     204      (setq pathname-encoding-name
     205            (unless (eq encoding (get-character-encoding nil))
     206              (character-encoding-name encoding))))))
     207
     208
     209   
    197210(defun fd-open (path flags &optional (create-mode #o666))
    198   (#+darwin-target with-utf-8-cstrs
    199    #+windows-target with-native-utf-16-cstrs
    200    #-(or darwin-target windows-target) with-cstrs
    201    ((p path))
     211  (with-filename-cstrs ((p path))
    202212    (let* ((fd (int-errno-ffcall
     213              (%kernel-import target::kernel-import-lisp-open)
     214              :address p :int flags :mode_t create-mode :int)))
     215    (declare (fixnum fd))
     216    (when (or (= fd (- #$EMFILE))
     217              (= fd (- #$EMFILE)))
     218      (gc)
     219      (drain-termination-queue)
     220      (setq fd (int-errno-ffcall
    203221                (%kernel-import target::kernel-import-lisp-open)
    204222                :address p :int flags :mode_t create-mode :int)))
    205       (declare (fixnum fd))
    206       (when (or (= fd (- #$EMFILE))
    207                 (= fd (- #$EMFILE)))
    208         (gc)
    209         (drain-termination-queue)
    210         (setq fd (int-errno-ffcall
    211                   (%kernel-import target::kernel-import-lisp-open)
    212                            :address p :int flags :mode_t create-mode :int)))
    213       fd)))
     223    fd)))
    214224
    215225(defun fd-chmod (fd mode)
Note: See TracChangeset for help on using the changeset viewer.