Skip to content

Commit

Permalink
try keep old behaviror for 🍎
Browse files Browse the repository at this point in the history
  • Loading branch information
xgdgsc authored and vtjnash committed Jul 18, 2023
1 parent 8b02ca4 commit 67bab23
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions stdlib/Mmap/src/Mmap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,10 @@ function mmap(io::IO,
file_desc = gethandle(io)
szfile = convert(Csize_t, len + offset)
requestedSizeLarger = false
if !(io isa Mmap.Anonymous || Sys.isapple())
requestedSizeLarger = szfile > filesize(io)
if !(io isa Mmap.Anonymous)
@static if !Sys.isapple()
requestedSizeLarger = szfile > filesize(io)
end
end
# platform-specific mmapping
@static if Sys.isunix()
Expand All @@ -227,6 +229,9 @@ function mmap(io::IO,
throw(ArgumentError("unable to increase file size to $szfile due to read-only permissions"))
end
end
@static if Sys.isapple()
iswrite && grow && grow!(io, offset, len)
end
# mmap the file
ptr = ccall(:jl_mmap, Ptr{Cvoid}, (Ptr{Cvoid}, Csize_t, Cint, Cint, RawFD, Int64),
C_NULL, mmaplen, prot, flags, file_desc, offset_page)
Expand Down

0 comments on commit 67bab23

Please sign in to comment.