diff --git a/extra/io/mmap/mmap.factor b/extra/io/mmap/mmap.factor index 59246115cf..a07443783c 100755 --- a/extra/io/mmap/mmap.factor +++ b/extra/io/mmap/mmap.factor @@ -21,7 +21,10 @@ M: mapped-file set-nth-unsafe INSTANCE: mapped-file sequence -HOOK: io-backend ( path length -- mmap ) +HOOK: (mapped-file) io-backend ( path length -- mmap ) + +: ( path length -- mmap ) + >r normalize-path r> (mapped-file) ; HOOK: close-mapped-file io-backend ( mmap -- ) diff --git a/extra/io/unix/mmap/mmap.factor b/extra/io/unix/mmap/mmap.factor index 332c1927c8..72ff107f8f 100755 --- a/extra/io/unix/mmap/mmap.factor +++ b/extra/io/unix/mmap/mmap.factor @@ -10,8 +10,8 @@ IN: io.unix.mmap >r f -roll r> open-r/w [ 0 mmap ] keep over MAP_FAILED = [ close (io-error) ] when ; -M: unix ( path length -- obj ) - swap normalize-path >r +M: unix (mapped-file) ( path length -- obj ) + swap >r dup PROT_READ PROT_WRITE bitor MAP_FILE MAP_SHARED bitor r> mmap-open f mapped-file boa ; diff --git a/extra/io/windows/mmap/mmap.factor b/extra/io/windows/mmap/mmap.factor index 96b68d5a6d..dc29405b12 100755 --- a/extra/io/windows/mmap/mmap.factor +++ b/extra/io/windows/mmap/mmap.factor @@ -61,7 +61,6 @@ M: wince with-privileges nip call ; : mmap-open ( path access-mode create-mode flProtect access -- handle handle address ) - >r >r >r >r normalize-path r> r> r> r> { "SeCreateGlobalPrivilege" "SeLockMemoryPrivilege" } [ >r >r 0 open-file dup f r> 0 0 f CreateFileMapping [ win32-error=0/f ] keep @@ -71,7 +70,7 @@ M: wince with-privileges dup close-later ] with-privileges ; -M: windows ( path length -- mmap ) +M: windows (mapped-file) ( path length -- mmap ) [ swap GENERIC_WRITE GENERIC_READ bitor