@@ -39,7 +39,7 @@ fileflags(::IO) = MAP_SHARED
3939# ##
4040
4141# Raw call to mmap syscall
42- function _mmap (ptr:: Ptr{Cvoid} , len:: Int ,
42+ function _sys_mmap (ptr:: Ptr{Cvoid} , len:: Int ,
4343 prot:: MmapProtection , flags:: MmapFlags ,
4444 fd:: RawFD , offset:: Int64 )
4545
@@ -53,7 +53,7 @@ function _mmap(ptr::Ptr{Cvoid}, len::Int,
5353 return ret
5454end
5555
56- function _unmap ! (ptr:: Ptr{Cvoid} , len:: Int )
56+ function _sys_unmap ! (ptr:: Ptr{Cvoid} , len:: Int )
5757 ret = ccall (:munmap , Cint, (Ptr{Cvoid}, Csize_t), ptr, len)
5858 Base. systemerror (" munmap" , ret != 0 )
5959 return
6262# Low-level form which mirrors a raw mmap, but constructs a Julia array of given
6363# dimension(s) at a specific offset within a file (includes accounting for page alignment
6464# requirement).
65- function mmap (:: Type{Array{T}} , dims:: NTuple{N,Integer} ,
65+ function _mmap (:: Type{Array{T}} , dims:: NTuple{N,Integer} ,
6666 prot:: MmapProtection , flags:: MmapFlags ,
6767 fd:: RawFD , offset:: Integer ) where {T, N}
6868 isbitstype (T) || throw (ArgumentError (" unable to mmap type $T ; must satisfy `isbitstype(T) == true`" ))
@@ -75,19 +75,19 @@ function mmap(::Type{Array{T}}, dims::NTuple{N,Integer},
7575 page_pad = rem (Int64 (offset), PAGESIZE)
7676 mmaplen:: Int = len + page_pad
7777
78- ptr = _mmap (C_NULL , mmaplen, prot, flags, fd, Int64 (offset) - page_pad)
78+ ptr = _sys_mmap (C_NULL , mmaplen, prot, flags, fd, Int64 (offset) - page_pad)
7979 aptr = convert (Ptr{T}, ptr + page_pad)
8080 array = unsafe_wrap (Array{T,N}, aptr, dims)
81- finalizer (_ -> _unmap ! (ptr, mmaplen), array)
81+ finalizer (_ -> _sys_unmap ! (ptr, mmaplen), array)
8282 return array
8383end
84- function mmap (:: Type{Array{T}} , len:: Int , prot:: MmapProtection , flags:: MmapFlags ,
84+ function _mmap (:: Type{Array{T}} , len:: Int , prot:: MmapProtection , flags:: MmapFlags ,
8585 fd:: RawFD , offset:: Int ) where {T}
86- return mmap (Array{T}, (Int (len),), prot, flags, fd, offset)
86+ return _mmap (Array{T}, (Int (len),), prot, flags, fd, offset)
8787end
8888
8989# Higher-level interface which takes an IO object and sets default flag values.
90- function mmap (io:: IO , :: Type{Array{T}} , dims:: NTuple{N,Integer} ;
90+ function mmap (io:: IO , :: Type{<: Array{T}} , dims:: NTuple{N,Integer} ;
9191 offset:: Union{Integer,Nothing} = nothing ,
9292 prot:: Union{MmapProtection,Nothing} = nothing ,
9393 flags:: Union{MmapFlags,Nothing} = nothing ,
@@ -107,9 +107,9 @@ function mmap(io::IO, ::Type{Array{T}}, dims::NTuple{N,Integer};
107107
108108 grow && iswritable (io) && grow! (io, offset, len)
109109
110- return mmap (Array{T}, dims, prot, flags, gethandle (io), offset)
110+ return _mmap (Array{T}, dims, prot, flags, gethandle (io), offset)
111111end
112- function mmap (io:: IO , :: Type{Array{T}} , len:: Integer ;
112+ function mmap (io:: IO , :: Type{<: Array{T}} , len:: Integer ;
113113 offset:: Union{Integer,Nothing} = nothing ,
114114 prot:: Union{MmapProtection,Nothing} = nothing ,
115115 flags:: Union{MmapFlags,Nothing} = nothing ,
@@ -118,7 +118,7 @@ function mmap(io::IO, ::Type{Array{T}}, len::Integer;
118118 return mmap (io, Array{T}, (len,);
119119 offset = offset, prot = prot, flags = flags, grow = grow)
120120end
121- function mmap (io:: IO , :: Type{Array{T}} = Array{UInt8};
121+ function mmap (io:: IO , :: Type{<: Array{T}} = Array{UInt8};
122122 offset:: Union{Integer,Nothing} = nothing ,
123123 prot:: Union{MmapProtection,Nothing} = nothing ,
124124 flags:: Union{MmapFlags,Nothing} = nothing ,
@@ -129,7 +129,7 @@ function mmap(io::IO, ::Type{Array{T}} = Array{UInt8};
129129end
130130
131131# Mapping of files
132- function mmap (file:: AbstractString , :: Type{Array{T}} , dims:: NTuple{N,Integer} ;
132+ function mmap (file:: AbstractString , :: Type{<: Array{T}} , dims:: NTuple{N,Integer} ;
133133 offset:: Union{Integer,Nothing} = nothing ,
134134 prot:: Union{MmapProtection,Nothing} = nothing ,
135135 flags:: Union{MmapFlags,Nothing} = nothing ,
@@ -154,7 +154,7 @@ function mmap(file::AbstractString, ::Type{Array{T}}, dims::NTuple{N,Integer};
154154 offset = offset, prot = prot, flags = flags, grow = grow)
155155 end
156156end
157- function mmap (file:: AbstractString , :: Type{Array{T}} , len:: Integer ;
157+ function mmap (file:: AbstractString , :: Type{<: Array{T}} , len:: Integer ;
158158 offset:: Union{Integer,Nothing} = nothing ,
159159 prot:: Union{MmapProtection,Nothing} = nothing ,
160160 flags:: Union{MmapFlags,Nothing} = nothing ,
@@ -164,7 +164,7 @@ function mmap(file::AbstractString, ::Type{Array{T}}, len::Integer;
164164 offset = offset, prot = prot, flags = flags, grow = grow)
165165end
166166# Default mapping of the [rest of] given file
167- function mmap (file:: AbstractString , :: Type{Array{T}} = Array{UInt8};
167+ function mmap (file:: AbstractString , :: Type{<: Array{T}} = Array{UInt8};
168168 offset:: Union{Integer,Nothing} = nothing ,
169169 prot:: Union{MmapProtection,Nothing} = nothing ,
170170 flags:: Union{MmapFlags,Nothing} = nothing ,
@@ -175,7 +175,7 @@ function mmap(file::AbstractString, ::Type{Array{T}} = Array{UInt8};
175175end
176176
177177# form to construct anonymous memory maps
178- function mmap (:: Type{Array{T}} , dims:: NTuple{N,Integer} ;
178+ function mmap (:: Type{<: Array{T}} , dims:: NTuple{N,Integer} ;
179179 prot:: Union{MmapProtection,Nothing} = nothing ,
180180 flags:: Union{MmapFlags,Nothing} = nothing
181181 ) where {T, N}
@@ -184,7 +184,7 @@ function mmap(::Type{Array{T}}, dims::NTuple{N,Integer};
184184 return mmap (Anonymous (), Array{T}, dims;
185185 offset = Int64 (0 ), prot = prot, flags = flags, grow = false )
186186end
187- function mmap (:: Type{Array{T}} , len:: Integer ;
187+ function mmap (:: Type{<: Array{T}} , len:: Integer ;
188188 prot:: Union{MmapProtection,Nothing} = nothing ,
189189 flags:: Union{MmapFlags,Nothing} = nothing
190190 ) where {T}
0 commit comments