Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions base/sysinfo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export BINDIR,
MACHINE,
KERNEL,
JIT,
PAGESIZE,
cpu_info,
cpu_summary,
sysimage_target,
Expand Down Expand Up @@ -144,6 +145,13 @@ Note: Included in the detailed system information via `versioninfo(verbose=true)
"""
global JIT::String

"""
Sys.PAGESIZE::Clong

A number providing the pagesize of the given OS. Common values being 4kb or 64kb on Linux.
"""
global PAGESIZE::Clong

function __init__()
env_threads = nothing
if haskey(ENV, "JULIA_CPU_THREADS")
Expand All @@ -162,6 +170,7 @@ function __init__()
global SC_CLK_TCK = ccall(:jl_SC_CLK_TCK, Clong, ())
global CPU_NAME = ccall(:jl_get_cpu_name, Ref{String}, ())
global JIT = ccall(:jl_get_JIT, Ref{String}, ())
global PAGESIZE = Int(Sys.isunix() ? ccall(:jl_getpagesize, Clong, ()) : ccall(:jl_getallocationgranularity, Clong, ()))
__init_build()
nothing
end
Expand Down
3 changes: 1 addition & 2 deletions stdlib/Mmap/src/Mmap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ Low level module for mmap (memory mapping of files).
module Mmap

import Base: OS_HANDLE, INVALID_OS_HANDLE
using Sys: PAGESIZE

export mmap

const PAGESIZE = Int(Sys.isunix() ? ccall(:jl_getpagesize, Clong, ()) : ccall(:jl_getallocationgranularity, Clong, ()))

# for mmaps not backed by files
mutable struct Anonymous <: IO
name::String
Expand Down
1 change: 1 addition & 0 deletions stdlib/Mmap/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ A2 = mmap(s, Matrix{Int}, (m,n))
seek(s, 0)
A3 = mmap(s, Matrix{Int}, (m,n), convert(Int64, 2*sizeof(Int)))
@test A == A3
seek(s, 0)
A4 = mmap(s, Matrix{Int}, (m,150), convert(Int64, (2+150*m)*sizeof(Int)))
@test A[:, 151:end] == A4
close(s)
Expand Down