diff --git a/base/deprecated.jl b/base/deprecated.jl index d4f817492a544..ba6118bacafe5 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -455,8 +455,6 @@ end @deprecate (convert(::Type{Integer}, x::Enum{T}) where {T<:Integer}) Integer(x) @deprecate (convert(::Type{T}, x::Enum{T2}) where {T<:Integer,T2<:Integer}) T(x) -@deprecate convert(dt::Type{<:Integer}, ip::IPAddr) dt(ip) - function (::Type{T})(arg) where {T} if applicable(convert, T, arg) sig = which(convert, (Type{T}, typeof(arg))).sig @@ -678,15 +676,6 @@ end Broadcast.dotview(A::AbstractArray{<:AbstractArray}, args::Integer...) = getindex(A, args...) # Upon removing deprecations, also enable the @testset "scalar .=" in test/broadcast.jl -@noinline function getaddrinfo(callback::Function, host::AbstractString) - depwarn("`getaddrinfo` with a callback function is deprecated, wrap code in `@async` instead for deferred execution.", :getaddrinfo) - @async begin - r = getaddrinfo(host) - callback(r) - end - nothing -end - # indexing with A[true] will throw an argument error in the future function to_index(i::Bool) depwarn("indexing with Bool values is deprecated. Convert the index to an integer first with `Int(i)`.", (:getindex, :setindex!, :view)) diff --git a/base/exports.jl b/base/exports.jl index e3d946d7b85dc..5686a256670b4 100644 --- a/base/exports.jl +++ b/base/exports.jl @@ -622,6 +622,8 @@ export uppercase, # text output + IOContext, + displaysize, dump, print, println, @@ -710,6 +712,7 @@ export put!, isready, fetch, + bind, # missing values coalesce, @@ -800,39 +803,20 @@ export exit, ntuple, -# IP address stuff - @ip_str, - IPAddr, - IPv4, - IPv6, - # I/O and events - accept, - bind, close, - connect, countlines, eachline, eof, fd, fdio, flush, - getaddrinfo, - getalladdrinfo, - getnameinfo, gethostname, - getipaddr, - getpeername, - getsockname, htol, hton, - IOContext, - displaysize, ismarked, isopen, isreadonly, - listen, - listenany, ltoh, mark, bytesavailable, @@ -855,21 +839,18 @@ export redirect_stderr, redirect_stdin, redirect_stdout, - recv, - recvfrom, reset, seek, seekend, seekstart, - send, skip, skipchars, take!, truncate, unmark, + unsafe_read, + unsafe_write, write, - TCPSocket, - UDPSocket, # multimedia I/O AbstractDisplay, @@ -972,9 +953,7 @@ export unsafe_copyto!, unsafe_load, unsafe_pointer_to_objref, - unsafe_read, unsafe_store!, - unsafe_write, # implemented in Random module rand, diff --git a/base/libuv.jl b/base/libuv.jl index 2cdcb5c961348..16cf7e1b0ab51 100644 --- a/base/libuv.jl +++ b/base/libuv.jl @@ -91,10 +91,6 @@ function reinit_stdio() global uv_jl_connectioncb = cfunction(uv_connectioncb, Cvoid, Tuple{Ptr{Cvoid}, Cint}) global uv_jl_connectcb = cfunction(uv_connectcb, Cvoid, Tuple{Ptr{Cvoid}, Cint}) global uv_jl_writecb_task = cfunction(uv_writecb_task, Cvoid, Tuple{Ptr{Cvoid}, Cint}) - global uv_jl_getaddrinfocb = cfunction(uv_getaddrinfocb, Cvoid, Tuple{Ptr{Cvoid}, Cint, Ptr{Cvoid}}) - global uv_jl_getnameinfocb = cfunction(uv_getnameinfocb, Cvoid, Tuple{Ptr{Cvoid}, Cint, Cstring, Cstring}) - global uv_jl_recvcb = cfunction(uv_recvcb, Cvoid, Tuple{Ptr{Cvoid}, Cssize_t, Ptr{Cvoid}, Ptr{Cvoid}, Cuint}) - global uv_jl_sendcb = cfunction(uv_sendcb, Cvoid, Tuple{Ptr{Cvoid}, Cint}) global uv_jl_return_spawn = cfunction(uv_return_spawn, Cvoid, Tuple{Ptr{Cvoid}, Int64, Int32}) global uv_jl_asynccb = cfunction(uv_asynccb, Cvoid, Tuple{Ptr{Cvoid}}) global uv_jl_timercb = cfunction(uv_timercb, Cvoid, Tuple{Ptr{Cvoid}}) diff --git a/base/precompile.jl b/base/precompile.jl index 74cf106f3aaf5..20bac3faebea6 100644 --- a/base/precompile.jl +++ b/base/precompile.jl @@ -14,22 +14,8 @@ precompile(Tuple{typeof(Base.convert), Type{Ptr{Int32}}, Ptr{UInt8}}) precompile(Tuple{Type{Base.Multimedia.TextDisplay}, Base.TTY}) precompile(Tuple{typeof(Base._start)}) precompile(Tuple{typeof(Base.copyto!), Array{String, 1}, Int64, Array{Any, 1}, Int64, Int64}) -precompile(Tuple{typeof(Base.finalizer), typeof(Base.uvfinalize), Base.TCPServer}) -precompile(Tuple{Type{Base.TCPServer}, Ptr{Cvoid}, Int64}) precompile(Tuple{typeof(Base.show), Base.IOContext{Base.GenericIOBuffer{Array{UInt8, 1}}}, Int32}) precompile(Tuple{typeof(Base.print), Base.GenericIOBuffer{Array{UInt8, 1}}, Base.Libc.RawFD}) -precompile(Tuple{typeof(Base.uv_status_string), Base.TCPServer}) -precompile(Tuple{typeof(Base._fd), Base.TCPServer}) -precompile(Tuple{typeof(Base.print), Base.GenericIOBuffer{Array{UInt8, 1}}, Type{Base.TCPServer}, String, Base.Libc.RawFD, String, String, String}) -precompile(Tuple{typeof(Base.print), Base.GenericIOBuffer{Array{UInt8, 1}}, Base.TCPServer}) -precompile(Tuple{typeof(Base.isopen), Base.TCPServer}) -precompile(Tuple{typeof(Base.check_open), Base.TCPServer}) -precompile(Tuple{typeof(Base.unpreserve_handle), Base.TCPServer}) -precompile(Tuple{typeof(Base.stream_wait), Base.TCPServer, Base.Condition}) -precompile(Tuple{Type{Base.TCPServer}}) -precompile(Tuple{typeof(Base.close), Base.TCPServer}) -precompile(Tuple{getfield(Base, Symbol("#kw##listen")), Array{Any, 1}, typeof(Base.listen), Base.TCPServer}) -precompile(Tuple{getfield(Base, Symbol("#kw##listen")), Array{Any, 1}, typeof(Base.listen), Base.InetAddr{Base.IPv4}}) precompile(Tuple{typeof(Base.ndigits0z), UInt16}) precompile(Tuple{typeof(Base.dec), UInt16, Int64, Bool}) precompile(Tuple{typeof(Base.Libc.strerror), Int32}) @@ -221,7 +207,6 @@ precompile(Tuple{typeof(Base.sizehint!), Base.Dict{Any, Any}, Int64}) precompile(Tuple{typeof(Base.unsafe_copyto!), Array{Base.Dict{Any, Any}, 1}, Int64, Array{Base.Dict{Any, Any}, 1}, Int64, Int64}) precompile(Tuple{typeof(Base.copyto!), Array{Base.Dict{Any, Any}, 1}, Int64, Array{Base.Dict{Any, Any}, 1}, Int64, Int64}) precompile(Tuple{typeof(Base.print), Base.GenericIOBuffer{Array{UInt8, 1}}, String, Int64, String, Bool}) -precompile(Tuple{typeof(Base.uv_status_string), Base.UDPSocket}) precompile(Tuple{typeof(Base.readuntil), Base.GenericIOBuffer{Array{UInt8, 1}}, UInt8}) precompile(Tuple{typeof(Base.seek), Base.GenericIOBuffer{Array{UInt8, 1}}, Int64}) precompile(Tuple{getfield(Base, Symbol("#kw##readline")), Array{Any, 1}, typeof(Base.readline), Base.GenericIOBuffer{Array{UInt8, 1}}}) @@ -240,7 +225,6 @@ precompile(Tuple{typeof(Core.Compiler.isbits), Base.Sort.QuickSortAlg}) precompile(Tuple{typeof(Base.ht_keyindex2!), Base.Dict{Any, Any}, Symbol}) precompile(Tuple{typeof(Base._setindex!), Base.Dict{Any, Any}, Symbol, Symbol, Int64}) precompile(Tuple{Type{Base.Dict{Any, Any}}, Base.Pair{Symbol, Symbol}, Base.Pair{Symbol, String}, Base.Pair{Symbol, String}, Base.Pair{Symbol, Base.Cmd}, Base.Pair{Symbol, Bool}}) -precompile(Tuple{typeof(Base.listenany), Base.IPv4, UInt16}) precompile(Tuple{typeof(Base.load_juliarc)}) precompile(Tuple{typeof(Base.popfirst!), Array{String, 1}}) precompile(Tuple{typeof(Base.print), Base.IOContext{Base.GenericIOBuffer{Array{UInt8, 1}}}, String, String, Char}) @@ -710,13 +694,10 @@ precompile(Tuple{typeof(Base.convert), Type{Base.Union{Base.Process, Nothing}}, precompile(Tuple{typeof(Base.convert), Type{Base.Union{Bool, Nothing}}, Bool}) precompile(Tuple{typeof(Base.task_done_hook), Task}) precompile(Tuple{typeof(Base.getindex), Tuple{Array{Any, 1}, Tuple{}}, Int64}) -precompile(Tuple{Type{Base.TCPSocket}}) -precompile(Tuple{typeof(Base.getsockname), Base.TCPSocket}) precompile(Tuple{typeof(Base.unsafe_store!), Ptr{Int32}, Int64}) precompile(Tuple{Type{Base.Multimedia.TextDisplay}, Base.PipeEndpoint}) precompile(Tuple{typeof(Core.Compiler.isbits), OutOfMemoryError}) precompile(Tuple{typeof(Core.Compiler.isbits), Tuple{Int64, Int64, Int64, Int64, Int64, Int64, Int64, Int64, Int64, Int64, Int64, Int64, Int64}}) -precompile(Tuple{typeof(Base.getaddrinfo), String}) precompile(Tuple{typeof(Base.uv_status_string), Base.PipeEndpoint}) precompile(Tuple{typeof(Base._fd), Base.PipeEndpoint}) precompile(Tuple{typeof(Base.print), Base.GenericIOBuffer{Array{UInt8, 1}}, Base.PipeEndpoint}) @@ -729,39 +710,17 @@ precompile(Tuple{typeof(Base.uv_write), Base.PipeEndpoint, Ptr{UInt8}, UInt64}) precompile(Tuple{typeof(Base.flush), Base.PipeEndpoint}) precompile(Tuple{typeof(Base.unsafe_write), Base.PipeEndpoint, Ptr{UInt8}, UInt64}) precompile(Tuple{typeof(Base.unsafe_write), Base.PipeEndpoint, Base.RefValue{UInt8}, Int64}) -precompile(Tuple{typeof(Base.uv_status_string), Base.TCPSocket}) -precompile(Tuple{typeof(Base._fd), Base.TCPSocket}) precompile(Tuple{typeof(Base.print), Base.PipeEndpoint, String}) precompile(Tuple{typeof(Base.print), Base.PipeEndpoint, Char}) precompile(Tuple{typeof(Base.print), Base.PipeEndpoint, String, Char}) -precompile(Tuple{typeof(Base.print), Base.GenericIOBuffer{Array{UInt8, 1}}, Base.TCPSocket}) precompile(Tuple{typeof(Base.write), Base.PipeEndpoint, Char}) -precompile(Tuple{typeof(Base.isopen), Base.TCPSocket}) -precompile(Tuple{typeof(Base.unpreserve_handle), Base.TCPSocket}) -precompile(Tuple{typeof(Base.check_open), Base.TCPSocket}) -precompile(Tuple{typeof(Base.stream_wait), Base.TCPSocket, Base.Condition}) -precompile(Tuple{typeof(Base.wait_connected), Base.TCPSocket}) -precompile(Tuple{typeof(Base.print), Base.GenericIOBuffer{Array{UInt8, 1}}, String, Base.IPv4, String}) -precompile(Tuple{typeof(Base.print), Base.GenericIOBuffer{Array{UInt8, 1}}, String, Base.IPv6, String}) precompile(Tuple{typeof(Base.promote_type), Type{Int64}, Type{Int16}}) precompile(Tuple{typeof(Base.promote_rule), Type{Int16}, Type{Int64}}) precompile(Tuple{typeof(Base.promote_result), Type{Int64}, Type{Int16}, Type{Int64}, Type{Union{}}}) precompile(Tuple{typeof(Base.show), Base.GenericIOBuffer{Array{UInt8, 1}}, Int16}) precompile(Tuple{typeof(Base.print), Base.GenericIOBuffer{Array{UInt8, 1}}, Int16}) -precompile(Tuple{typeof(Base.uv_status_string), Base.PipeServer}) -precompile(Tuple{typeof(Base._fd), Base.PipeServer}) precompile(Tuple{typeof(Base.convert), Type{Int16}, Int16}) precompile(Tuple{typeof(Base.string), String, Int16, String, String, String, String}) -precompile(Tuple{typeof(Base.print), Base.GenericIOBuffer{Array{UInt8, 1}}, Base.PipeServer}) -precompile(Tuple{typeof(Base.unpreserve_handle), Base.PipeServer}) -precompile(Tuple{typeof(Base.isopen), Base.PipeServer}) -precompile(Tuple{typeof(Base.accept_nonblock), Base.PipeServer, Base.PipeEndpoint}) -precompile(Tuple{typeof(Base.stream_wait), Base.PipeServer, Base.Condition}) -precompile(Tuple{typeof(Base.accept), Base.PipeServer, Base.PipeEndpoint}) -precompile(Tuple{typeof(Base.accept_nonblock), Base.TCPServer, Base.TCPSocket}) -precompile(Tuple{Type{Base.TCPSocket}}) -precompile(Tuple{typeof(Base.accept), Base.TCPServer, Base.TCPSocket}) -precompile(Tuple{typeof(Base.accept), Base.TCPServer}) precompile(Tuple{typeof(Base.tryparse_internal), Type{Int16}, Base.SubString{String}, Int64, Int64, Int64, Bool}) precompile(Tuple{typeof(Base.parse), Type{Int16}, Base.SubString{String}}) precompile(Tuple{typeof(Base.write), Base.PipeEndpoint, String}) @@ -793,34 +752,13 @@ precompile(Tuple{typeof(Base.notify), Base.Condition, Base.EOFError, Bool, Bool} precompile(Tuple{typeof(Base.unpreserve_handle), Base.Timer}) precompile(Tuple{typeof(Base.disassociate_julia_struct), Base.Timer}) precompile(Tuple{typeof(Base.convert), Type{Base.Union{AbstractString, Nothing}}, Base.SubString{String}}) -precompile(Tuple{typeof(Base.connect!), Base.TCPSocket, Base.SubString{String}, UInt16}) -precompile(Tuple{typeof(Base.notify), Base.Condition, Base.IPv4, Bool, Bool}) -precompile(Tuple{typeof(Base.schedule), Task, Base.IPv4}) -precompile(Tuple{typeof(Base.connect!), Base.TCPSocket, Base.IPv4, UInt16}) -precompile(Tuple{typeof(Base.uv_status_string), Base.TCPSocket}) -precompile(Tuple{typeof(Base._fd), Base.TCPSocket}) -precompile(Tuple{typeof(Base.print), Base.GenericIOBuffer{Array{UInt8, 1}}, Base.TCPSocket}) -precompile(Tuple{typeof(Base.isopen), Base.TCPSocket}) precompile(Tuple{typeof(Base.convert), Type{Base.Union{AbstractString, Nothing}}, String}) -precompile(Tuple{typeof(Base.unpreserve_handle), Base.TCPSocket}) -precompile(Tuple{typeof(Base.check_open), Base.TCPSocket}) -precompile(Tuple{typeof(Base.stream_wait), Base.TCPSocket, Base.Condition}) precompile(Tuple{typeof(Base.read_sub), Base.GenericIOBuffer{Array{UInt8, 1}}, Array{UInt8, 1}, Int64, Int64}) -precompile(Tuple{typeof(Base.isreadable), Base.TCPSocket}) -precompile(Tuple{typeof(Base.start_reading), Base.TCPSocket}) precompile(Tuple{typeof(Base.write_sub), Base.GenericIOBuffer{Array{UInt8, 1}}, Array{UInt8, 1}, Int64, Int64}) precompile(Tuple{typeof(Base.readbytes!), Base.GenericIOBuffer{Array{UInt8, 1}}, Array{UInt8, 1}, Int64}) -precompile(Tuple{typeof(Base.wait_readnb), Base.TCPSocket, Int64}) precompile(Tuple{typeof(Base.write), Base.GenericIOBuffer{Array{UInt8, 1}}, Base.GenericIOBuffer{Array{UInt8, 1}}}) -precompile(Tuple{typeof(Base.readbytes!), Base.TCPSocket, Array{UInt8, 1}, Int64}) -precompile(Tuple{typeof(Base.read), Base.TCPSocket, Int64}) -precompile(Tuple{typeof(Base.unsafe_read), Base.TCPSocket, Ptr{UInt8}, UInt64}) -precompile(Tuple{typeof(Base.read!), Base.TCPSocket, Array{Int64, 1}}) -precompile(Tuple{typeof(Base.read), Base.TCPSocket, Type{UInt8}}) -precompile(Tuple{typeof(Base.convert), Type{IO}, Base.TCPSocket}) precompile(Tuple{typeof(Base.convert), Type{Base.Union{Base.VersionNumber, Nothing}}, Base.Union{Base.VersionNumber, Nothing}}) precompile(Tuple{typeof(Base.join), Base.GenericIOBuffer{Array{UInt8, 1}}, Tuple{Int64}, Char}) -precompile(Tuple{typeof(Base.close), Base.TCPSocket}) precompile(Tuple{typeof(Base.convert), Type{Base.AbstractChannel}, Base.Channel{Any}}) precompile(Tuple{typeof(Base.ndigits0z), UInt8}) precompile(Tuple{typeof(Base.dec), UInt8, Int64, Bool}) @@ -831,17 +769,8 @@ precompile(Tuple{typeof(Base.rehash!), Base.Dict{Int64, Nothing}, Int64}) precompile(Tuple{typeof(Base.ht_keyindex2!), Base.Dict{Int64, Nothing}, Int64}) precompile(Tuple{typeof(Base._setindex!), Base.Dict{Int64, Nothing}, Nothing, Int64, Int64}) precompile(Tuple{typeof(Base.setindex!), Base.Dict{Int64, Nothing}, Nothing, Int64}) -precompile(Tuple{typeof(Base.wait_connected), Base.TCPSocket}) -precompile(Tuple{typeof(Base.write), Base.TCPSocket, String}) -precompile(Tuple{typeof(Base.uv_write), Base.TCPSocket, Ptr{UInt8}, UInt64}) -precompile(Tuple{typeof(Base.flush), Base.TCPSocket}) -precompile(Tuple{typeof(Base.unsafe_write), Base.TCPSocket, Ptr{UInt8}, UInt64}) -precompile(Tuple{typeof(Base.write), Base.TCPSocket, Int64, Int64, Int64, Int64}) -precompile(Tuple{typeof(Base.unsafe_write), Base.TCPSocket, Base.RefValue{Int64}, Int64}) -precompile(Tuple{typeof(Base.unsafe_write), Base.TCPSocket, Base.RefValue{UInt8}, Int64}) precompile(Tuple{typeof(Core.Compiler.length), Tuple{Core.Compiler.Const, DataType, Core.Compiler.Const}}) precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{Core.Compiler.Const, DataType, Core.Compiler.Const}, Int64}) -precompile(Tuple{typeof(Base.unsafe_write), Base.TCPSocket, Base.RefValue{Int32}, Int64}) precompile(Tuple{typeof(Base.copyto!), Array{Any, 1}, Base.MethodList}) precompile(Tuple{typeof(Base.ht_keyindex), Base.Dict{UInt64, UInt64}, UInt64}) precompile(Tuple{typeof(Base.unique), Array{Symbol, 1}}) @@ -855,30 +784,15 @@ precompile(Tuple{typeof(Base.ht_keyindex2!), Base.Dict{UInt64, Nothing}, UInt64} precompile(Tuple{typeof(Base._setindex!), Base.Dict{UInt64, Nothing}, Nothing, UInt64, Int64}) precompile(Tuple{typeof(Base.ht_keyindex), Base.Dict{WeakRef, Any}, Core.TypeName}) precompile(Tuple{typeof(Base.isassigned), Array{Union{Tuple{Any, Int64}, Tuple{Tuple{}, Any, Bool}}, 1}, Int64}) -precompile(Tuple{typeof(Base.uvfinalize), Base.TCPSocket}) -precompile(Tuple{typeof(Base.close), Base.TCPSocket}) -precompile(Tuple{typeof(Base.write), Base.TCPSocket, Array{UInt8, 1}}) precompile(Tuple{typeof(Base.wait_readnb), Base.PipeEndpoint, Int64}) precompile(Tuple{typeof(Base.eof), Base.PipeEndpoint}) -precompile(Tuple{typeof(Base.unsafe_read), Base.TCPSocket, Base.RefValue{Int32}, Int64}) -precompile(Tuple{typeof(Base.unsafe_read), Base.TCPSocket, Base.RefValue{Int64}, Int64}) -precompile(Tuple{typeof(Base.read!), Base.TCPSocket, Array{UInt8, 1}}) precompile(Tuple{typeof(Base.read_sub), Base.GenericIOBuffer{Array{UInt8, 1}}, Array{UInt8, 1}, Int64, Int64}) -precompile(Tuple{typeof(Base.isreadable), Base.TCPSocket}) -precompile(Tuple{typeof(Base.start_reading), Base.TCPSocket}) precompile(Tuple{typeof(Base.write_sub), Base.GenericIOBuffer{Array{UInt8, 1}}, Array{UInt8, 1}, Int64, Int64}) precompile(Tuple{typeof(Base.readbytes!), Base.GenericIOBuffer{Array{UInt8, 1}}, Array{UInt8, 1}, Int64}) -precompile(Tuple{typeof(Base.wait_readnb), Base.TCPSocket, Int64}) precompile(Tuple{typeof(Base.write), Base.GenericIOBuffer{Array{UInt8, 1}}, Base.GenericIOBuffer{Array{UInt8, 1}}}) -precompile(Tuple{typeof(Base.readbytes!), Base.TCPSocket, Array{UInt8, 1}, Int64}) -precompile(Tuple{typeof(Base.read), Base.TCPSocket, Int64}) precompile(Tuple{typeof(Base.promote_type), Type{Int64}, Type{UInt8}}) precompile(Tuple{typeof(Base.promote_rule), Type{Int64}, Type{UInt8}}) precompile(Tuple{typeof(Base.promote_result), Type{Int64}, Type{UInt8}, Type{Union{}}, Type{Int64}}) -precompile(Tuple{typeof(Base.read!), Base.TCPSocket, Array{UInt64, 1}}) -precompile(Tuple{typeof(Base.unsafe_read), Base.TCPSocket, Ptr{UInt8}, UInt64}) -precompile(Tuple{typeof(Base.read!), Base.TCPSocket, Array{Int64, 1}}) -precompile(Tuple{typeof(Base.read), Base.TCPSocket, Type{UInt8}}) precompile(Tuple{typeof(Base._array_for), Type{Union{}}, Base.UnitRange{Int64}, Base.HasShape}) precompile(Tuple{typeof(Base.join), Base.GenericIOBuffer{Array{UInt8, 1}}, Tuple{Int64}, Char}) precompile(Tuple{typeof(Base.setindex!), Base.Dict{Int64, Nothing}, Nothing, Int64}) @@ -904,24 +818,11 @@ precompile(Tuple{typeof(Base.eltype), Type{Base.Union{Base.Dict{K, V}, Nothing} precompile(Tuple{Type{Base.Union{Base.Dict{K, V}, Nothing} where V where K}}) precompile(Tuple{typeof(Base.eltype), Type{Base.Union{Array{T, N}, Nothing} where N where T}}) precompile(Tuple{Type{Base.Union{Array{T, N}, Nothing} where N where T}}) -precompile(Tuple{typeof(Base.convert), Type{IO}, Base.TCPSocket}) precompile(Tuple{typeof(Base.convert), Type{Base.Union{Base.VersionNumber, Nothing}}, Base.VersionNumber}) -precompile(Tuple{typeof(Base.unsafe_write), Base.TCPSocket, Ptr{UInt8}, UInt64}) -precompile(Tuple{typeof(Base.uv_write), Base.TCPSocket, Ptr{UInt8}, UInt64}) -precompile(Tuple{typeof(Base.flush), Base.TCPSocket}) -precompile(Tuple{typeof(Base.write), Base.TCPSocket, Int64, Int64, Int64, Int64}) -precompile(Tuple{typeof(Base.unsafe_write), Base.TCPSocket, Base.RefValue{Int64}, Int64}) -precompile(Tuple{typeof(Base.unsafe_write), Base.TCPSocket, Base.RefValue{UInt8}, Int64}) -precompile(Tuple{typeof(Base.write), Base.TCPSocket, Array{UInt8, 1}}) -precompile(Tuple{typeof(Base.unsafe_read), Base.TCPSocket, Base.RefValue{Int32}, Int64}) -precompile(Tuple{typeof(Base.unsafe_read), Base.TCPSocket, Base.RefValue{Int64}, Int64}) -precompile(Tuple{typeof(Base.read!), Base.TCPSocket, Array{UInt8, 1}}) precompile(Tuple{typeof(Base.promote_type), Type{Int64}, Type{UInt8}}) precompile(Tuple{typeof(Base.promote_rule), Type{Int64}, Type{UInt8}}) precompile(Tuple{typeof(Base.promote_result), Type{Int64}, Type{UInt8}, Type{Union{}}, Type{Int64}}) -precompile(Tuple{typeof(Base.read!), Base.TCPSocket, Array{UInt64, 1}}) precompile(Tuple{typeof(Base._array_for), Type{Union{}}, Base.UnitRange{Int64}, Base.HasShape}) -precompile(Tuple{typeof(Base.read), Base.TCPSocket, Type{Int64}}) precompile(Tuple{typeof(Base.rehash!), Base.Dict{WeakRef, Nothing}, Int64}) precompile(Tuple{typeof(Base.ht_keyindex2!), Base.Dict{WeakRef, Nothing}, WeakRef}) precompile(Tuple{typeof(Base._setindex!), Base.Dict{WeakRef, Nothing}, Nothing, WeakRef, Int64}) @@ -941,7 +842,6 @@ precompile(Tuple{typeof(Base.put_buffered), Base.Channel{Int64}, Int64}) precompile(Tuple{typeof(Base.put_unbuffered), Base.Channel{Int64}, Int64}) precompile(Tuple{typeof(Base.put!), Base.Channel{Int64}, Int64}) precompile(Tuple{typeof(Base._delete!), Base.Dict{Any, Any}, Int64}) -precompile(Tuple{typeof(Base.write), Base.TCPSocket, Array{Int64, 1}}) precompile(Tuple{typeof(Base.sort!), Array{Int64, 1}, Int64, Int64, Base.Sort.InsertionSortAlg, Base.Order.ForwardOrdering}) precompile(Tuple{typeof(Base.Sort.partition!), Array{Int64, 1}, Int64, Int64, Base.Order.ForwardOrdering}) precompile(Tuple{typeof(Base.sort!), Array{Int64, 1}, Int64, Int64, Base.Sort.QuickSortAlg, Base.Order.ForwardOrdering}) @@ -980,9 +880,6 @@ precompile(Tuple{typeof(Base.uvfinalize), Base.PipeEndpoint}) precompile(Tuple{typeof(Base.unpreserve_handle), Base.PipeEndpoint}) precompile(Tuple{typeof(Base.stream_wait), Base.PipeEndpoint, Base.Condition}) precompile(Tuple{typeof(Base.close), Base.PipeEndpoint}) -precompile(Tuple{typeof(Base.uvfinalize), Base.TCPServer}) -precompile(Tuple{typeof(Base.uvfinalize), Base.TCPSocket}) -precompile(Tuple{typeof(Base._uv_hook_close), Base.TCPSocket}) precompile(Tuple{typeof(Base.in), Int64, Base.BitSet}) precompile(Tuple{typeof(Base._uv_hook_close), Base.Process}) precompile(Tuple{typeof(Base._delete!), Base.Dict{WeakRef, Nothing}, Int64}) diff --git a/base/stream.jl b/base/stream.jl index 502bfcab8e79f..6de6d7aac06a7 100644 --- a/base/stream.jl +++ b/base/stream.jl @@ -148,30 +148,6 @@ function PipeEndpoint() return pipe end -mutable struct PipeServer <: LibuvServer - handle::Ptr{Cvoid} - status::Int - connectnotify::Condition - closenotify::Condition - function PipeServer(handle::Ptr{Cvoid}, status) - p = new(handle, - status, - Condition(), - Condition()) - associate_julia_struct(p.handle, p) - finalizer(uvfinalize, p) - return p - end -end - -function PipeServer() - pipe = PipeServer(Libc.malloc(_sizeof_uv_named_pipe), StatusUninit) - err = ccall(:uv_pipe_init, Cint, (Ptr{Cvoid}, Ptr{Cvoid}, Cint), eventloop(), pipe.handle, 0) - uv_error("failed to create pipe server", err) - pipe.status = StatusInit - return pipe -end - mutable struct TTY <: LibuvStream handle::Ptr{Cvoid} status::Int @@ -240,6 +216,8 @@ unlock(s::LibuvStream) = unlock(s.lock) rawhandle(stream::LibuvStream) = stream.handle unsafe_convert(::Type{Ptr{Cvoid}}, s::Union{LibuvStream, LibuvServer}) = s.handle +const Sockets_mod = Ref{Module}() + function init_stdio(handle::Ptr{Cvoid}) t = ccall(:jl_uv_handle_type, Int32, (Ptr{Cvoid},), handle) if t == UV_FILE @@ -255,7 +233,10 @@ function init_stdio(handle::Ptr{Cvoid}) elseif t == UV_TTY return TTY(handle, StatusOpen) elseif t == UV_TCP - return TCPSocket(handle, StatusOpen) + if !isassigned(Sockets_mod) + Sockets_mod[] = Base.require(Base, :Sockets) + end + return Sockets_mod[].TCPSocket(handle, StatusOpen) elseif t == UV_NAMED_PIPE return PipeEndpoint(handle, StatusOpen) else @@ -942,108 +923,6 @@ function uv_writecb_task(req::Ptr{Cvoid}, status::Cint) nothing end -## server functions ## - -function accept_nonblock(server::PipeServer, client::PipeEndpoint) - if client.status != StatusInit - error("client is already in use or has been closed") - end - err = ccall(:uv_accept, Int32, (Ptr{Cvoid}, Ptr{Cvoid}), server.handle, client.handle) - if err == 0 - client.status = StatusOpen - end - return err -end - -function accept_nonblock(server::PipeServer) - client = PipeEndpoint() - uv_error("accept", accept_nonblock(server, client) != 0) - return client -end - -function accept(server::LibuvServer, client::LibuvStream) - if server.status != StatusActive - throw(ArgumentError("server not connected, make sure \"listen\" has been called")) - end - while isopen(server) - err = accept_nonblock(server, client) - if err == 0 - return client - elseif err != UV_EAGAIN - uv_error("accept", err) - end - stream_wait(server, server.connectnotify) - end - uv_error("accept", UV_ECONNABORTED) -end - -const BACKLOG_DEFAULT = 511 - -function listen(sock::LibuvServer; backlog::Integer=BACKLOG_DEFAULT) - uv_error("listen", trylisten(sock)) - return sock -end - -function trylisten(sock::LibuvServer; backlog::Integer=BACKLOG_DEFAULT) - check_open(sock) - err = ccall(:uv_listen, Cint, (Ptr{Cvoid}, Cint, Ptr{Cvoid}), - sock, backlog, uv_jl_connectioncb::Ptr{Cvoid}) - sock.status = StatusActive - return err -end - -function bind(server::PipeServer, name::AbstractString) - @assert server.status == StatusInit - err = ccall(:uv_pipe_bind, Int32, (Ptr{Cvoid}, Cstring), - server, name) - if err != 0 - if err != UV_EADDRINUSE && err != UV_EACCES - #TODO: this codepath is currently not tested - throw(UVError("bind",err)) - else - return false - end - end - server.status = StatusOpen - return true -end - -""" - listen(path::AbstractString) -> PipeServer - -Create and listen on a named pipe / UNIX domain socket. -""" -function listen(path::AbstractString) - sock = PipeServer() - bind(sock, path) || throw(ArgumentError("could not listen on path $path")) - return listen(sock) -end - -function connect!(sock::PipeEndpoint, path::AbstractString) - @assert sock.status == StatusInit - req = Libc.malloc(_sizeof_uv_connect) - uv_req_set_data(req, C_NULL) - ccall(:uv_pipe_connect, Cvoid, (Ptr{Cvoid}, Ptr{Cvoid}, Cstring, Ptr{Cvoid}), req, sock.handle, path, uv_jl_connectcb::Ptr{Cvoid}) - sock.status = StatusConnecting - return sock -end - -function connect(sock::LibuvStream, args...) - connect!(sock, args...) - wait_connected(sock) - return sock -end - -# Libuv will internally reset read/writability, which is uses to -# mark that this is an invalid pipe. - -""" - connect(path::AbstractString) -> PipeEndpoint - -Connect to the named pipe / UNIX domain socket at `path`. -""" -connect(path::AbstractString) = connect(PipeEndpoint(), path) - _fd(x::IOStream) = RawFD(fd(x)) function _fd(x::Union{LibuvStream, LibuvServer}) diff --git a/base/sysimg.jl b/base/sysimg.jl index 36afa52ce236a..8498114d377d3 100644 --- a/base/sysimg.jl +++ b/base/sysimg.jl @@ -342,7 +342,6 @@ function randn end # I/O include("stream.jl") -include("socket.jl") include("filesystem.jl") using .Filesystem include("process.jl") @@ -501,6 +500,7 @@ Base.require(Base, :Base64) Base.require(Base, :CRC32c) Base.require(Base, :SHA) Base.require(Base, :Dates) +Base.require(Base, :Sockets) Base.require(Base, :DelimitedFiles) Base.require(Base, :Serialization) Base.require(Base, :Distributed) @@ -855,6 +855,27 @@ Base.require(Base, :Markdown) @eval @deprecate_stdlib $(Symbol("@code_lowered")) InteractiveUtils true @eval @deprecate_stdlib $(Symbol("@code_llvm")) InteractiveUtils true @eval @deprecate_stdlib $(Symbol("@code_native")) InteractiveUtils true + + @eval @deprecate_stdlib $(Symbol("@ip_str")) Sockets true + @deprecate_stdlib IPAddr Sockets true + @deprecate_stdlib IPv4 Sockets true + @deprecate_stdlib IPv6 Sockets true + @deprecate_stdlib accept Sockets true + @deprecate_stdlib connect Sockets true + @deprecate_stdlib getaddrinfo Sockets true + @deprecate_stdlib getalladdrinfo Sockets true + @deprecate_stdlib getnameinfo Sockets true + @deprecate_stdlib getipaddr Sockets true + @deprecate_stdlib getpeername Sockets true + @deprecate_stdlib getsockname Sockets true + @deprecate_stdlib listen Sockets true + @deprecate_stdlib listenany Sockets true + @deprecate_stdlib recv Sockets true + @deprecate_stdlib recvfrom Sockets true + @deprecate_stdlib send Sockets true + @deprecate_stdlib TCPSocket Sockets true + @deprecate_stdlib UDPSocket Sockets true + end empty!(DEPOT_PATH) diff --git a/doc/src/base/io-network.md b/doc/src/base/io-network.md index 1816f7b321a6e..8532bc3e9660c 100644 --- a/doc/src/base/io-network.md +++ b/doc/src/base/io-network.md @@ -126,27 +126,7 @@ Base.Multimedia.istextmime ## Network I/O ```@docs -Base.connect(::TCPSocket, ::Integer) -Base.connect(::AbstractString) -Base.listen(::Any) -Base.listen(::AbstractString) -Base.getaddrinfo -Base.getalladdrinfo -Base.getnameinfo -Base.getsockname -Base.getpeername -Base.IPv4 -Base.IPv6 -Base.TCPSocket -Base.UDPSocket Base.bytesavailable -Base.accept -Base.listenany -Base.bind -Base.send -Base.recv -Base.recvfrom -Base.setopt Base.ntoh Base.hton Base.ltoh diff --git a/examples/clustermanager/simple/UnixDomainCM.jl b/examples/clustermanager/simple/UnixDomainCM.jl index 29eb4f1975720..5426a64010a04 100644 --- a/examples/clustermanager/simple/UnixDomainCM.jl +++ b/examples/clustermanager/simple/UnixDomainCM.jl @@ -1,6 +1,6 @@ # This file is a part of Julia. License is MIT: https://julialang.org/license -using Distributed +using Sockets, Distributed import Distributed: launch, manage, connect, exit mutable struct UnixDomainCM <: ClusterManager diff --git a/stdlib/Distributed/Project.toml b/stdlib/Distributed/Project.toml index f4b1d7014bf49..f369cc1bf1e3a 100644 --- a/stdlib/Distributed/Project.toml +++ b/stdlib/Distributed/Project.toml @@ -5,3 +5,4 @@ uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" +Sockets = "6462fe0b-24de-5631-8697-dd941f90decc" diff --git a/stdlib/Distributed/src/Distributed.jl b/stdlib/Distributed/src/Distributed.jl index 02f1c86aae1e2..021d220302107 100644 --- a/stdlib/Distributed/src/Distributed.jl +++ b/stdlib/Distributed/src/Distributed.jl @@ -9,7 +9,7 @@ module Distributed # imports for extension import Base: getindex, wait, put!, take!, fetch, isready, push!, length, - hash, ==, connect, kill, close, showerror + hash, ==, kill, close, showerror # imports for use using Base: Process, Semaphore, JLOptions, AnyDict, buffer_writes, wait_connected, @@ -18,8 +18,9 @@ using Base: Process, Semaphore, JLOptions, AnyDict, buffer_writes, wait_connecte AsyncGenerator, acquire, release, invokelatest, shell_escape_posixly, uv_error, coalesce, notnothing -using Serialization +using Serialization, Sockets import Serialization: serialize, deserialize +import Sockets: connect # NOTE: clusterserialize.jl imports additional symbols from Serialization for use diff --git a/stdlib/Distributed/src/precompile.jl b/stdlib/Distributed/src/precompile.jl index 842d0403b3583..fe2b32653fa2f 100644 --- a/stdlib/Distributed/src/precompile.jl +++ b/stdlib/Distributed/src/precompile.jl @@ -36,7 +36,7 @@ precompile(Tuple{typeof(Distributed.launch), Distributed.LocalManager, Base.Dict precompile(Tuple{typeof(Distributed.start_worker), Base.PipeEndpoint, String}) precompile(Tuple{typeof(Distributed.socket_reuse_port)}) precompile(Tuple{typeof(Distributed.flush_gc_msgs)}) -precompile(Tuple{typeof(Distributed.disable_nagle), Base.TCPServer}) +precompile(Tuple{typeof(Distributed.disable_nagle), Sockets.TCPServer}) precompile(Tuple{typeof(Distributed.next_tunnel_port)}) precompile(Tuple{typeof(Base._delete!), Base.Dict{Int64, Union{Distributed.Worker, Distributed.LocalProcess}}, Int64}) precompile(Tuple{typeof(Distributed.send_msg_), Distributed.Worker, Distributed.MsgHeader, Distributed.JoinPGRPMsg, Bool}) @@ -44,14 +44,14 @@ precompile(Tuple{typeof(Distributed.send_msg_now), Distributed.Worker, Distribut precompile(Tuple{typeof(Distributed.connect_w2w), Int64, Distributed.WorkerConfig}) precompile(Tuple{typeof(Distributed.create_worker), Distributed.LocalManager, Distributed.WorkerConfig}) precompile(Tuple{typeof(Distributed.setup_launched_worker), Distributed.LocalManager, Distributed.WorkerConfig, Array{Int64, 1}}) -precompile(Tuple{typeof(Base.connect), Distributed.LocalManager, Int64, Distributed.WorkerConfig}) +precompile(Tuple{typeof(Sockets.connect), Distributed.LocalManager, Int64, Distributed.WorkerConfig}) precompile(Tuple{typeof(Distributed.read_worker_host_port), Base.Pipe}) precompile(Tuple{typeof(Distributed.parse_connection_info), String}) precompile(Tuple{typeof(Distributed.connect_to_worker), Base.SubString{String}, Int16}) -precompile(Tuple{typeof(Distributed.process_messages), Base.TCPSocket, Base.TCPSocket, Bool}) -precompile(Tuple{getfield(Core, Symbol("#kw#Type")), Array{Any, 1}, Type{Distributed.Worker}, Int64, Base.TCPSocket, Base.TCPSocket, Distributed.LocalManager}) -precompile(Tuple{typeof(Distributed.worker_id_from_socket), Base.TCPSocket}) -precompile(Tuple{Type{Distributed.ClusterSerializer{Base.TCPSocket}}, Base.TCPSocket}) +precompile(Tuple{typeof(Distributed.process_messages), Sockets.TCPSocket, Sockets.TCPSocket, Bool}) +precompile(Tuple{getfield(Core, Symbol("#kw#Type")), Array{Any, 1}, Type{Distributed.Worker}, Int64, Sockets.TCPSocket, Sockets.TCPSocket, Distributed.LocalManager}) +precompile(Tuple{typeof(Distributed.worker_id_from_socket), Sockets.TCPSocket}) +precompile(Tuple{Type{Distributed.ClusterSerializer{Sockets.TCPSocket}}, Sockets.TCPSocket}) precompile(Tuple{typeof(Distributed.send_msg_), Distributed.Worker, Distributed.MsgHeader, Distributed.ResultMsg, Bool}) precompile(Tuple{typeof(Distributed.send_msg_now), Distributed.Worker, Distributed.MsgHeader, Distributed.ResultMsg}) precompile(Tuple{Type{Core.Compiler.Generator{I, F} where F where I}, Type{Core.Compiler.Const}, Tuple{Int64, typeof(Distributed.rmprocs)}}) @@ -74,9 +74,9 @@ precompile(Tuple{typeof(Core.Compiler.indexed_next), Tuple{typeof(Distributed.rm precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{typeof(Distributed.rmprocs), Int64}, Int64}) precompile(Tuple{typeof(Distributed.register_worker_streams), Distributed.Worker}) precompile(Tuple{typeof(Distributed.register_worker_streams), Distributed.LocalProcess}) -precompile(Tuple{Type{Distributed.ClusterSerializer{Base.TCPSocket}}, Base.TCPSocket}) -precompile(Tuple{typeof(Distributed.worker_id_from_socket), Base.TCPSocket}) -precompile(Tuple{typeof(Base.convert), Type{Distributed.ClusterSerializer{I} where I<:IO}, Distributed.ClusterSerializer{Base.TCPSocket}}) +precompile(Tuple{Type{Distributed.ClusterSerializer{Sockets.TCPSocket}}, Sockets.TCPSocket}) +precompile(Tuple{typeof(Distributed.worker_id_from_socket), Sockets.TCPSocket}) +precompile(Tuple{typeof(Base.convert), Type{Distributed.ClusterSerializer{I} where I<:IO}, Distributed.ClusterSerializer{Sockets.TCPSocket}}) precompile(Tuple{typeof(Base.convert), Type{Distributed.ClusterManager}, Distributed.LocalManager}) precompile(Tuple{typeof(Base.convert), Type{Distributed.WorkerConfig}, Distributed.WorkerConfig}) precompile(Tuple{typeof(Base.get), Base.Dict{Any, Any}, Distributed.RRID, Bool}) @@ -97,47 +97,47 @@ precompile(Tuple{getfield(Distributed, Symbol("#kw##remote_do")), Array{Any, 1}, precompile(Tuple{getfield(Distributed, Symbol("#kw##remote_do")), Array{Any, 1}, typeof(Distributed.remote_do), typeof(Distributed.rmprocs), Distributed.LocalProcess, Int64}) precompile(Tuple{Type{Distributed.ResultMsg}, Distributed.RemoteException}) precompile(Tuple{Type{Distributed.ResultMsg}, Symbol}) -precompile(Tuple{typeof(Distributed.send_msg_now), Base.TCPSocket, Distributed.MsgHeader, Distributed.ResultMsg}) +precompile(Tuple{typeof(Distributed.send_msg_now), Sockets.TCPSocket, Distributed.MsgHeader, Distributed.ResultMsg}) precompile(Tuple{typeof(Base._delete!), Base.Dict{Int64, Union{Distributed.Worker, Distributed.LocalProcess}}, Int64}) precompile(Tuple{typeof(Distributed.def_rv_channel)}) precompile(Tuple{typeof(Base.setindex!), Base.Dict{Any, Any}, Distributed.RemoteValue, Distributed.RRID}) precompile(Tuple{typeof(Base.ht_keyindex2!), Base.Dict{Any, Any}, Distributed.RRID}) precompile(Tuple{typeof(Base._setindex!), Base.Dict{Any, Any}, Distributed.RemoteValue, Distributed.RRID, Int64}) precompile(Tuple{typeof(Base.notify), Base.Condition, Distributed.ProcessExitedException, Bool, Bool}) -precompile(Tuple{typeof(Distributed.process_messages), Base.TCPSocket, Base.TCPSocket, Bool}) +precompile(Tuple{typeof(Distributed.process_messages), Sockets.TCPSocket, Sockets.TCPSocket, Bool}) precompile(Tuple{typeof(Base.pop!), Base.Dict{Int64, Union{Distributed.Worker, Distributed.LocalProcess}}, Int64, Nothing}) precompile(Tuple{typeof(Distributed.send_connection_hdr), Distributed.Worker, Bool}) precompile(Tuple{typeof(Distributed.deregister_worker), Distributed.ProcessGroup, Int64}) -precompile(Tuple{typeof(Distributed.process_hdr), Base.TCPSocket, Bool}) -precompile(Tuple{typeof(Distributed.deserialize_msg), Distributed.ClusterSerializer{Base.TCPSocket}}) +precompile(Tuple{typeof(Distributed.process_hdr), Sockets.TCPSocket, Bool}) +precompile(Tuple{typeof(Distributed.deserialize_msg), Distributed.ClusterSerializer{Sockets.TCPSocket}}) precompile(Tuple{typeof(Distributed.null_id), Distributed.RRID}) -precompile(Tuple{typeof(Distributed.deliver_result), Base.TCPSocket, Symbol, Distributed.RRID, Distributed.RemoteException}) -precompile(Tuple{typeof(Distributed.disable_nagle), Base.TCPSocket}) -precompile(Tuple{typeof(Distributed.message_handler_loop), Base.TCPSocket, Base.TCPSocket, Bool}) -precompile(Tuple{typeof(Distributed.process_tcp_streams), Base.TCPSocket, Base.TCPSocket, Bool}) +precompile(Tuple{typeof(Distributed.deliver_result), Sockets.TCPSocket, Symbol, Distributed.RRID, Distributed.RemoteException}) +precompile(Tuple{typeof(Distributed.disable_nagle), Sockets.TCPSocket}) +precompile(Tuple{typeof(Distributed.message_handler_loop), Sockets.TCPSocket, Sockets.TCPSocket, Bool}) +precompile(Tuple{typeof(Distributed.process_tcp_streams), Sockets.TCPSocket, Sockets.TCPSocket, Bool}) precompile(Tuple{Type{Distributed.JoinPGRPMsg}, Int64, Array{Union{Tuple{Any, Int64}, Tuple{Tuple{}, Any, Bool}}, 1}, Symbol, Bool}) -precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Base.TCPSocket}, Distributed.JoinPGRPMsg}) -precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Base.TCPSocket}, Int64}) -precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Base.TCPSocket}, Array{Union{Tuple{Any, Int64}, Tuple{Tuple{}, Any, Bool}}, 1}}) -precompile(Tuple{typeof(Serialization.should_send_whole_type), Distributed.ClusterSerializer{Base.TCPSocket}, Type{Any}}) -precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Base.TCPSocket}, Core.SimpleVector}) -precompile(Tuple{typeof(Serialization.serialize_type_data), Distributed.ClusterSerializer{Base.TCPSocket}, Type{Any}, Bool}) -precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Base.TCPSocket}, Type{Any}}) -precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Base.TCPSocket}, Tuple{Int64}}) -precompile(Tuple{typeof(Serialization.serialize_cycle), Distributed.ClusterSerializer{Base.TCPSocket}, Type{Union{Tuple{Any, Int64}, Tuple{Tuple{}, Any, Bool}}}}) -precompile(Tuple{typeof(Serialization.serialize_type), Distributed.ClusterSerializer{Base.TCPSocket}, DataType}) -precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Base.TCPSocket}, Bool}) -precompile(Tuple{typeof(Distributed.serialize_global_from_main), Distributed.ClusterSerializer{Base.TCPSocket}, Symbol}) -precompile(Tuple{typeof(Serialization.serialize_mod_names), Distributed.ClusterSerializer{Base.TCPSocket}, Module}) -precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Base.TCPSocket}, Symbol}) -precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Base.TCPSocket}, Module}) -precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Base.TCPSocket}, Array{Any, 1}}) -precompile(Tuple{typeof(Serialization.serialize_cycle), Distributed.ClusterSerializer{Base.TCPSocket}, Core.TypeName}) -precompile(Tuple{typeof(Serialization.serialize_typename), Distributed.ClusterSerializer{Base.TCPSocket}, Core.TypeName}) -precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Base.TCPSocket}, Array{Symbol, 1}}) -precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Base.TCPSocket}, Core.TypeName}) -precompile(Tuple{typeof(Serialization.serialize_cycle_header), Distributed.ClusterSerializer{Base.TCPSocket}, Type{Union{Tuple{Any, Int64}, Tuple{Tuple{}, Any, Bool}}}}) -precompile(Tuple{typeof(Serialization.serialize_any), Distributed.ClusterSerializer{Base.TCPSocket}, Type{Union{Tuple{Any, Int64}, Tuple{Tuple{}, Any, Bool}}}}) +precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Sockets.TCPSocket}, Distributed.JoinPGRPMsg}) +precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Sockets.TCPSocket}, Int64}) +precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Sockets.TCPSocket}, Array{Union{Tuple{Any, Int64}, Tuple{Tuple{}, Any, Bool}}, 1}}) +precompile(Tuple{typeof(Serialization.should_send_whole_type), Distributed.ClusterSerializer{Sockets.TCPSocket}, Type{Any}}) +precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Sockets.TCPSocket}, Core.SimpleVector}) +precompile(Tuple{typeof(Serialization.serialize_type_data), Distributed.ClusterSerializer{Sockets.TCPSocket}, Type{Any}, Bool}) +precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Sockets.TCPSocket}, Type{Any}}) +precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Sockets.TCPSocket}, Tuple{Int64}}) +precompile(Tuple{typeof(Serialization.serialize_cycle), Distributed.ClusterSerializer{Sockets.TCPSocket}, Type{Union{Tuple{Any, Int64}, Tuple{Tuple{}, Any, Bool}}}}) +precompile(Tuple{typeof(Serialization.serialize_type), Distributed.ClusterSerializer{Sockets.TCPSocket}, DataType}) +precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Sockets.TCPSocket}, Bool}) +precompile(Tuple{typeof(Distributed.serialize_global_from_main), Distributed.ClusterSerializer{Sockets.TCPSocket}, Symbol}) +precompile(Tuple{typeof(Serialization.serialize_mod_names), Distributed.ClusterSerializer{Sockets.TCPSocket}, Module}) +precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Sockets.TCPSocket}, Symbol}) +precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Sockets.TCPSocket}, Module}) +precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Sockets.TCPSocket}, Array{Any, 1}}) +precompile(Tuple{typeof(Serialization.serialize_cycle), Distributed.ClusterSerializer{Sockets.TCPSocket}, Core.TypeName}) +precompile(Tuple{typeof(Serialization.serialize_typename), Distributed.ClusterSerializer{Sockets.TCPSocket}, Core.TypeName}) +precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Sockets.TCPSocket}, Array{Symbol, 1}}) +precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Sockets.TCPSocket}, Core.TypeName}) +precompile(Tuple{typeof(Serialization.serialize_cycle_header), Distributed.ClusterSerializer{Sockets.TCPSocket}, Type{Union{Tuple{Any, Int64}, Tuple{Tuple{}, Any, Bool}}}}) +precompile(Tuple{typeof(Serialization.serialize_any), Distributed.ClusterSerializer{Sockets.TCPSocket}, Type{Union{Tuple{Any, Int64}, Tuple{Tuple{}, Any, Bool}}}}) precompile(Tuple{typeof(Distributed.send_msg_), Distributed.Worker, Distributed.MsgHeader, Distributed.ResultMsg, Bool}) precompile(Tuple{typeof(Distributed.send_msg_now), Distributed.Worker, Distributed.MsgHeader, Distributed.ResultMsg}) precompile(Tuple{Type{Core.Compiler.Generator{I, F} where F where I}, Type{Core.Compiler.Const}, Tuple{Int64, typeof(Distributed.rmprocs)}}) @@ -158,12 +158,12 @@ precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{Int64, typeof(Distributed precompile(Tuple{typeof(Core.Compiler.start), Tuple{typeof(Distributed.rmprocs), Int64}}) precompile(Tuple{typeof(Core.Compiler.indexed_next), Tuple{typeof(Distributed.rmprocs), Int64}, Int64, Int64}) precompile(Tuple{typeof(Core.Compiler.getindex), Tuple{typeof(Distributed.rmprocs), Int64}, Int64}) -precompile(Tuple{typeof(Serialization.deserialize), Distributed.ClusterSerializer{Base.TCPSocket}}) -precompile(Tuple{typeof(Serialization.deserialize_cycle), Distributed.ClusterSerializer{Base.TCPSocket}, Expr}) -precompile(Tuple{typeof(Serialization.handle_deserialize), Distributed.ClusterSerializer{Base.TCPSocket}, Int32}) -precompile(Tuple{typeof(Serialization.deserialize_array), Distributed.ClusterSerializer{Base.TCPSocket}}) -precompile(Tuple{typeof(Serialization.deserialize_datatype), Distributed.ClusterSerializer{Base.TCPSocket}}) -precompile(Tuple{typeof(Serialization.deserialize_expr), Distributed.ClusterSerializer{Base.TCPSocket}, Int64}) +precompile(Tuple{typeof(Serialization.deserialize), Distributed.ClusterSerializer{Sockets.TCPSocket}}) +precompile(Tuple{typeof(Serialization.deserialize_cycle), Distributed.ClusterSerializer{Sockets.TCPSocket}, Expr}) +precompile(Tuple{typeof(Serialization.handle_deserialize), Distributed.ClusterSerializer{Sockets.TCPSocket}, Int32}) +precompile(Tuple{typeof(Serialization.deserialize_array), Distributed.ClusterSerializer{Sockets.TCPSocket}}) +precompile(Tuple{typeof(Serialization.deserialize_datatype), Distributed.ClusterSerializer{Sockets.TCPSocket}}) +precompile(Tuple{typeof(Serialization.deserialize_expr), Distributed.ClusterSerializer{Sockets.TCPSocket}, Int64}) precompile(Tuple{typeof(Core.Compiler.isbits), Tuple{Int64, typeof(Distributed.rmprocs)}}) precompile(Tuple{Type{Core.Compiler.Generator{I, F} where F where I}, Type{QuoteNode}, Tuple{Int64, typeof(Distributed.rmprocs)}}) precompile(Tuple{Type{Core.Compiler.Generator{Tuple{Int64, typeof(Distributed.rmprocs)}, Type{QuoteNode}}}, Type{QuoteNode}, Tuple{Int64, typeof(Distributed.rmprocs)}}) @@ -180,43 +180,43 @@ precompile(Tuple{getfield(Distributed, Symbol("#kw##remote_do")), Array{Any, 1}, precompile(Tuple{getfield(Distributed, Symbol("#kw##remote_do")), Array{Any, 1}, typeof(Distributed.remote_do), typeof(Distributed.rmprocs), Distributed.LocalProcess, Int64}) precompile(Tuple{Type{Distributed.ResultMsg}, Distributed.RemoteException}) precompile(Tuple{Type{Distributed.ResultMsg}, Symbol}) -precompile(Tuple{typeof(Distributed.send_msg_now), Base.TCPSocket, Distributed.MsgHeader, Distributed.ResultMsg}) +precompile(Tuple{typeof(Distributed.send_msg_now), Sockets.TCPSocket, Distributed.MsgHeader, Distributed.ResultMsg}) precompile(Tuple{typeof(Base.notify), Base.Condition, Distributed.ProcessExitedException, Bool, Bool}) precompile(Tuple{typeof(Base.pop!), Base.Dict{Int64, Union{Distributed.Worker, Distributed.LocalProcess}}, Int64, Nothing}) precompile(Tuple{typeof(Distributed.deregister_worker), Distributed.ProcessGroup, Int64}) -precompile(Tuple{typeof(Distributed.process_hdr), Base.TCPSocket, Bool}) +precompile(Tuple{typeof(Distributed.process_hdr), Sockets.TCPSocket, Bool}) precompile(Tuple{typeof(Distributed.null_id), Distributed.RRID}) -precompile(Tuple{typeof(Distributed.deliver_result), Base.TCPSocket, Symbol, Distributed.RRID, Distributed.RemoteException}) -precompile(Tuple{typeof(Distributed.disable_nagle), Base.TCPSocket}) -precompile(Tuple{typeof(Distributed.message_handler_loop), Base.TCPSocket, Base.TCPSocket, Bool}) -precompile(Tuple{typeof(Distributed.process_tcp_streams), Base.TCPSocket, Base.TCPSocket, Bool}) -precompile(Tuple{typeof(Serialization.deserialize), Distributed.ClusterSerializer{Base.TCPSocket}, Type{Union}}) -precompile(Tuple{typeof(Serialization.deserialize), Distributed.ClusterSerializer{Base.TCPSocket}, Type{Module}}) -precompile(Tuple{typeof(Serialization.deserialize), Distributed.ClusterSerializer{Base.TCPSocket}, Type{Core.SimpleVector}}) +precompile(Tuple{typeof(Distributed.deliver_result), Sockets.TCPSocket, Symbol, Distributed.RRID, Distributed.RemoteException}) +precompile(Tuple{typeof(Distributed.disable_nagle), Sockets.TCPSocket}) +precompile(Tuple{typeof(Distributed.message_handler_loop), Sockets.TCPSocket, Sockets.TCPSocket, Bool}) +precompile(Tuple{typeof(Distributed.process_tcp_streams), Sockets.TCPSocket, Sockets.TCPSocket, Bool}) +precompile(Tuple{typeof(Serialization.deserialize), Distributed.ClusterSerializer{Sockets.TCPSocket}, Type{Union}}) +precompile(Tuple{typeof(Serialization.deserialize), Distributed.ClusterSerializer{Sockets.TCPSocket}, Type{Module}}) +precompile(Tuple{typeof(Serialization.deserialize), Distributed.ClusterSerializer{Sockets.TCPSocket}, Type{Core.SimpleVector}}) precompile(Tuple{Type{Distributed.JoinPGRPMsg}, Int64, Array{Union{Tuple{Any, Int64}, Tuple{Tuple{}, Any, Bool}}, 1}, Symbol, Bool}) -precompile(Tuple{typeof(Distributed.handle_msg), Distributed.JoinPGRPMsg, Distributed.MsgHeader, Base.TCPSocket, Base.TCPSocket, Base.VersionNumber}) +precompile(Tuple{typeof(Distributed.handle_msg), Distributed.JoinPGRPMsg, Distributed.MsgHeader, Sockets.TCPSocket, Sockets.TCPSocket, Base.VersionNumber}) precompile(Tuple{Type{Distributed.WorkerConfig}}) precompile(Tuple{typeof(Distributed.send_msg_), Distributed.Worker, Distributed.MsgHeader, Distributed.JoinCompleteMsg, Bool}) precompile(Tuple{typeof(Distributed.send_msg_now), Distributed.Worker, Distributed.MsgHeader, Distributed.JoinCompleteMsg}) -precompile(Tuple{getfield(Core, Symbol("#kw#Type")), Array{Any, 1}, Type{Distributed.Worker}, Int64, Base.TCPSocket, Base.TCPSocket, Distributed.DefaultClusterManager}) +precompile(Tuple{getfield(Core, Symbol("#kw#Type")), Array{Any, 1}, Type{Distributed.Worker}, Int64, Sockets.TCPSocket, Sockets.TCPSocket, Distributed.DefaultClusterManager}) precompile(Tuple{typeof(Distributed.register_worker_streams), Distributed.Worker}) precompile(Tuple{typeof(Distributed.register_worker_streams), Distributed.LocalProcess}) -precompile(Tuple{typeof(Base.convert), Type{Distributed.ClusterSerializer{I} where I<:IO}, Distributed.ClusterSerializer{Base.TCPSocket}}) +precompile(Tuple{typeof(Base.convert), Type{Distributed.ClusterSerializer{I} where I<:IO}, Distributed.ClusterSerializer{Sockets.TCPSocket}}) precompile(Tuple{typeof(Base.convert), Type{Distributed.ClusterManager}, Distributed.DefaultClusterManager}) precompile(Tuple{typeof(Base.convert), Type{Distributed.WorkerConfig}, Distributed.WorkerConfig}) precompile(Tuple{typeof(Distributed.send_connection_hdr), Distributed.Worker, Bool}) precompile(Tuple{typeof(Distributed.manage), Distributed.LocalManager, Int64, Distributed.WorkerConfig, Symbol}) -precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Base.TCPSocket}, Distributed.JoinCompleteMsg}) -precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Base.TCPSocket}, Int64}) -precompile(Tuple{typeof(Serialization.deserialize), Distributed.ClusterSerializer{Base.TCPSocket}}) -precompile(Tuple{typeof(Serialization.deserialize_cycle), Distributed.ClusterSerializer{Base.TCPSocket}, Expr}) -precompile(Tuple{typeof(Serialization.handle_deserialize), Distributed.ClusterSerializer{Base.TCPSocket}, Int32}) -precompile(Tuple{typeof(Serialization.deserialize_array), Distributed.ClusterSerializer{Base.TCPSocket}}) -precompile(Tuple{typeof(Serialization.deserialize_datatype), Distributed.ClusterSerializer{Base.TCPSocket}}) -precompile(Tuple{typeof(Serialization.deserialize_expr), Distributed.ClusterSerializer{Base.TCPSocket}, Int64}) -precompile(Tuple{typeof(Serialization.deserialize), Distributed.ClusterSerializer{Base.TCPSocket}, Type{Int64}}) +precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Sockets.TCPSocket}, Distributed.JoinCompleteMsg}) +precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Sockets.TCPSocket}, Int64}) +precompile(Tuple{typeof(Serialization.deserialize), Distributed.ClusterSerializer{Sockets.TCPSocket}}) +precompile(Tuple{typeof(Serialization.deserialize_cycle), Distributed.ClusterSerializer{Sockets.TCPSocket}, Expr}) +precompile(Tuple{typeof(Serialization.handle_deserialize), Distributed.ClusterSerializer{Sockets.TCPSocket}, Int32}) +precompile(Tuple{typeof(Serialization.deserialize_array), Distributed.ClusterSerializer{Sockets.TCPSocket}}) +precompile(Tuple{typeof(Serialization.deserialize_datatype), Distributed.ClusterSerializer{Sockets.TCPSocket}}) +precompile(Tuple{typeof(Serialization.deserialize_expr), Distributed.ClusterSerializer{Sockets.TCPSocket}, Int64}) +precompile(Tuple{typeof(Serialization.deserialize), Distributed.ClusterSerializer{Sockets.TCPSocket}, Type{Int64}}) precompile(Tuple{Type{Distributed.JoinCompleteMsg}, Int64, Int64}) -precompile(Tuple{typeof(Distributed.handle_msg), Distributed.JoinCompleteMsg, Distributed.MsgHeader, Base.TCPSocket, Base.TCPSocket, Base.VersionNumber}) +precompile(Tuple{typeof(Distributed.handle_msg), Distributed.JoinCompleteMsg, Distributed.MsgHeader, Sockets.TCPSocket, Sockets.TCPSocket, Base.VersionNumber}) precompile(Tuple{typeof(Base.hash), Distributed.RemoteChannel{Base.Channel{Any}}, UInt64}) precompile(Tuple{typeof(Base.ht_keyindex), Base.Dict{WeakRef, Nothing}, Distributed.RemoteChannel{Base.Channel{Any}}}) precompile(Tuple{typeof(Distributed.remotecall_fetch), typeof(Distributed.put_ref), Distributed.Worker, Distributed.RRID, Distributed.WorkerPool}) @@ -235,18 +235,18 @@ precompile(Tuple{typeof(Base.put!), Base.Channel{Any}, Distributed.WorkerPool}) precompile(Tuple{typeof(Base.put_buffered), Base.Channel{Any}, Distributed.WorkerPool}) precompile(Tuple{typeof(Base.put_unbuffered), Base.Channel{Any}, Distributed.WorkerPool}) precompile(Tuple{typeof(Base.push!), Distributed.WorkerPool, Int64}) -precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Base.TCPSocket}, Distributed.RemoteDoMsg}) -precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Base.TCPSocket}, typeof(Distributed.set_valid_processes)}) -precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Base.TCPSocket}, Tuple{Array{Int64, 1}}}) -precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Base.TCPSocket}, Array{Int64, 1}}) -precompile(Tuple{typeof(Serialization.deserialize), Distributed.ClusterSerializer{Base.TCPSocket}, Type{typeof(Distributed.set_valid_processes)}}) -precompile(Tuple{typeof(Distributed.handle_msg), Distributed.RemoteDoMsg, Distributed.MsgHeader, Base.TCPSocket, Base.TCPSocket, Base.VersionNumber}) +precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Sockets.TCPSocket}, Distributed.RemoteDoMsg}) +precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Sockets.TCPSocket}, typeof(Distributed.set_valid_processes)}) +precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Sockets.TCPSocket}, Tuple{Array{Int64, 1}}}) +precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Sockets.TCPSocket}, Array{Int64, 1}}) +precompile(Tuple{typeof(Serialization.deserialize), Distributed.ClusterSerializer{Sockets.TCPSocket}, Type{typeof(Distributed.set_valid_processes)}}) +precompile(Tuple{typeof(Distributed.handle_msg), Distributed.RemoteDoMsg, Distributed.MsgHeader, Sockets.TCPSocket, Sockets.TCPSocket, Base.VersionNumber}) precompile(Tuple{typeof(Distributed.set_valid_processes), Array{Int64, 1}}) precompile(Tuple{typeof(Distributed._rmprocs), Array{Int64, 1}, Float64}) precompile(Tuple{typeof(Base.kill), Distributed.LocalManager, Int64, Distributed.WorkerConfig}) -precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Base.TCPSocket}, typeof(Base.exit)}) -precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Base.TCPSocket}, Tuple{}}) -precompile(Tuple{typeof(Serialization.deserialize), Distributed.ClusterSerializer{Base.TCPSocket}, Type{typeof(Base.exit)}}) +precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Sockets.TCPSocket}, typeof(Base.exit)}) +precompile(Tuple{typeof(Serialization.serialize), Distributed.ClusterSerializer{Sockets.TCPSocket}, Tuple{}}) +precompile(Tuple{typeof(Serialization.deserialize), Distributed.ClusterSerializer{Sockets.TCPSocket}, Type{typeof(Base.exit)}}) precompile(Tuple{typeof(Distributed.finalize_ref), Distributed.RemoteChannel{Base.Channel{Any}}}) precompile(Tuple{typeof(Distributed.send_del_client), Distributed.RemoteChannel{Base.Channel{Any}}}) precompile(Tuple{typeof(Base.:(==)), Distributed.RemoteChannel{Base.Channel{Any}}, Distributed.RemoteChannel{Base.Channel{Any}}}) diff --git a/stdlib/Distributed/test/distributed_exec.jl b/stdlib/Distributed/test/distributed_exec.jl index 098e226c1c948..7cd2ee31915b7 100644 --- a/stdlib/Distributed/test/distributed_exec.jl +++ b/stdlib/Distributed/test/distributed_exec.jl @@ -1,6 +1,6 @@ # This file is a part of Julia. License is MIT: https://julialang.org/license -using Test, Distributed, Random, Serialization +using Test, Distributed, Random, Serialization, Sockets import Distributed: launch, manage include(joinpath(Sys.BINDIR, "..", "share", "julia", "test", "testenv.jl")) @@ -1441,7 +1441,7 @@ function reuseport_tests() ports_higher = [] # ports of pids higher than myid() for w in Distributed.PGRP.workers w.id == myid() && continue - port = Base._sockname(w.r_stream, true)[2] + port = Sockets._sockname(w.r_stream, true)[2] if (w.id == 1) # master connects to workers push!(ports_higher, port) diff --git a/stdlib/Serialization/src/precompile.jl b/stdlib/Serialization/src/precompile.jl index d25f4945b1c9c..7bbc18a44c29f 100644 --- a/stdlib/Serialization/src/precompile.jl +++ b/stdlib/Serialization/src/precompile.jl @@ -1,8 +1,6 @@ # This file is a part of Julia. License is MIT: https://julialang.org/license -precompile(Tuple{typeof(Serialization.write_as_tag), Base.TCPSocket, Int32}) precompile(Tuple{typeof(Serialization.object_number), Core.TypeName}) -precompile(Tuple{typeof(Serialization.serialize_array_data), Base.TCPSocket, Array{Int64, 1}}) precompile(Tuple{typeof(Serialization.deserialize_array), Serialization.Serializer{Base.PipeEndpoint}}) precompile(Tuple{typeof(Serialization.deserialize), Base.PipeEndpoint}) precompile(Tuple{typeof(Serialization.deserialize), Serialization.Serializer{Base.PipeEndpoint}}) diff --git a/stdlib/Sockets/Project.toml b/stdlib/Sockets/Project.toml new file mode 100644 index 0000000000000..11d6cb0dd320c --- /dev/null +++ b/stdlib/Sockets/Project.toml @@ -0,0 +1,2 @@ +name = "Sockets" +uuid = "6462fe0b-24de-5631-8697-dd941f90decc" diff --git a/stdlib/Sockets/docs/src/index.md b/stdlib/Sockets/docs/src/index.md new file mode 100644 index 0000000000000..d457da9dfbeb9 --- /dev/null +++ b/stdlib/Sockets/docs/src/index.md @@ -0,0 +1,25 @@ +## Sockets + +```@docs +Sockets.connect(::TCPSocket, ::Integer) +Sockets.connect(::AbstractString) +Sockets.listen(::Any) +Sockets.listen(::AbstractString) +Sockets.getaddrinfo +Sockets.getipaddr +Sockets.getalladdrinfo +Sockets.getnameinfo +Sockets.getsockname +Sockets.getpeername +Sockets.IPv4 +Sockets.IPv6 +Sockets.TCPSocket +Sockets.UDPSocket +Sockets.accept +Sockets.listenany +Sockets.bind +Sockets.send +Sockets.recv +Sockets.recvfrom +Sockets.setopt +``` diff --git a/stdlib/Sockets/src/PipeServer.jl b/stdlib/Sockets/src/PipeServer.jl new file mode 100644 index 0000000000000..8f03c08c131fb --- /dev/null +++ b/stdlib/Sockets/src/PipeServer.jl @@ -0,0 +1,130 @@ +# This file is a part of Julia. License is MIT: https://julialang.org/license + +mutable struct PipeServer <: LibuvServer + handle::Ptr{Cvoid} + status::Int + connectnotify::Condition + closenotify::Condition + function PipeServer(handle::Ptr{Cvoid}, status) + p = new(handle, + status, + Condition(), + Condition()) + associate_julia_struct(p.handle, p) + finalizer(uvfinalize, p) + return p + end +end + +function PipeServer() + pipe = PipeServer(Libc.malloc(Base._sizeof_uv_named_pipe), StatusUninit) + err = ccall(:uv_pipe_init, Cint, (Ptr{Cvoid}, Ptr{Cvoid}, Cint), eventloop(), pipe.handle, 0) + uv_error("failed to create pipe server", err) + pipe.status = StatusInit + return pipe +end + +## server functions ## + +accept(server::PipeServer) = accept(server, PipeEndpoint()) + +function accept_nonblock(server::PipeServer, client::PipeEndpoint) + if client.status != StatusInit + error("client is already in use or has been closed") + end + err = ccall(:uv_accept, Int32, (Ptr{Cvoid}, Ptr{Cvoid}), server.handle, client.handle) + if err == 0 + client.status = StatusOpen + end + return err +end + +function accept_nonblock(server::PipeServer) + client = PipeEndpoint() + uv_error("accept", accept_nonblock(server, client) != 0) + return client +end + +function accept(server::LibuvServer, client::LibuvStream) + if server.status != StatusActive + throw(ArgumentError("server not connected, make sure \"listen\" has been called")) + end + while isopen(server) + err = accept_nonblock(server, client) + if err == 0 + return client + elseif err != UV_EAGAIN + uv_error("accept", err) + end + stream_wait(server, server.connectnotify) + end + uv_error("accept", UV_ECONNABORTED) +end + +const BACKLOG_DEFAULT = 511 + +function listen(sock::LibuvServer; backlog::Integer=BACKLOG_DEFAULT) + uv_error("listen", trylisten(sock)) + return sock +end + +function trylisten(sock::LibuvServer; backlog::Integer=BACKLOG_DEFAULT) + check_open(sock) + err = ccall(:uv_listen, Cint, (Ptr{Cvoid}, Cint, Ptr{Cvoid}), + sock, backlog, Base.uv_jl_connectioncb::Ptr{Cvoid}) + sock.status = StatusActive + return err +end + +function bind(server::PipeServer, name::AbstractString) + @assert server.status == StatusInit + err = ccall(:uv_pipe_bind, Int32, (Ptr{Cvoid}, Cstring), + server, name) + if err != 0 + if err != UV_EADDRINUSE && err != UV_EACCES + #TODO: this codepath is currently not tested + throw(UVError("bind",err)) + else + return false + end + end + server.status = StatusOpen + return true +end + +""" + listen(path::AbstractString) -> PipeServer + +Create and listen on a named pipe / UNIX domain socket. +""" +function listen(path::AbstractString) + sock = PipeServer() + bind(sock, path) || throw(ArgumentError("could not listen on path $path")) + return listen(sock) +end + +function connect!(sock::PipeEndpoint, path::AbstractString) + @assert sock.status == StatusInit + req = Libc.malloc(Base._sizeof_uv_connect) + uv_req_set_data(req, C_NULL) + ccall(:uv_pipe_connect, Cvoid, (Ptr{Cvoid}, Ptr{Cvoid}, Cstring, Ptr{Cvoid}), req, sock.handle, path, + Base.uv_jl_connectcb::Ptr{Cvoid}) + sock.status = StatusConnecting + return sock +end + +function connect(sock::LibuvStream, args...) + connect!(sock, args...) + wait_connected(sock) + return sock +end + +# Libuv will internally reset read/writability, which is uses to +# mark that this is an invalid pipe. + +""" + connect(path::AbstractString) -> PipeEndpoint + +Connect to the named pipe / UNIX domain socket at `path`. +""" +connect(path::AbstractString) = connect(PipeEndpoint(), path) diff --git a/base/socket.jl b/stdlib/Sockets/src/Sockets.jl similarity index 92% rename from base/socket.jl rename to stdlib/Sockets/src/Sockets.jl index 8916ccbb5b715..ac4a93f9a5a06 100644 --- a/base/socket.jl +++ b/stdlib/Sockets/src/Sockets.jl @@ -1,5 +1,42 @@ # This file is a part of Julia. License is MIT: https://julialang.org/license +module Sockets + +export + accept, + bind, + connect, + getaddrinfo, + getalladdrinfo, + getnameinfo, + getipaddr, + getpeername, + getsockname, + listen, + listenany, + recv, + recvfrom, + send, + TCPSocket, + UDPSocket, + @ip_str, + IPAddr, + IPv4, + IPv6 + +import Base: isless, show, print, parse, bind, convert, isreadable, iswritable, alloc_buf_hook, _uv_hook_close + +using Base: LibuvStream, LibuvServer, PipeEndpoint, @handle_as, uv_error, associate_julia_struct, uvfinalize, + notify_error, stream_wait, uv_req_data, uv_req_set_data, preserve_handle, unpreserve_handle, UVError, + eventloop, StatusUninit, StatusInit, StatusConnecting, StatusOpen, StatusClosing, StatusClosed, StatusActive, + uv_status_string, check_open, wait_connected, + UV_EINVAL, UV_ENOMEM, UV_ENOBUFS, UV_EAGAIN, UV_ECONNABORTED, UV_EADDRINUSE, UV_EACCES, UV_EADDRNOTAVAIL, + UV_EAI_ADDRFAMILY, UV_EAI_AGAIN, UV_EAI_BADFLAGS, + UV_EAI_BADHINTS, UV_EAI_CANCELED, UV_EAI_FAIL, + UV_EAI_FAMILY, UV_EAI_NODATA, UV_EAI_NONAME, + UV_EAI_OVERFLOW, UV_EAI_PROTOCOL, UV_EAI_SERVICE, + UV_EAI_SOCKTYPE, UV_EAI_MEMORY + ## IP ADDRESS HANDLING ## abstract type IPAddr end @@ -282,7 +319,7 @@ mutable struct TCPSocket <: LibuvStream Condition(), nothing, ReentrantLock(), - DEFAULT_READ_BUFFER_SZ) + Base.DEFAULT_READ_BUFFER_SZ) associate_julia_struct(tcp.handle, tcp) finalizer(uvfinalize, tcp) return tcp @@ -291,7 +328,7 @@ end # kw arg "delay": if true, libuv delays creation of the socket fd till the first bind call function TCPSocket(; delay=true) - tcp = TCPSocket(Libc.malloc(_sizeof_uv_tcp), StatusUninit) + tcp = TCPSocket(Libc.malloc(Base._sizeof_uv_tcp), StatusUninit) af_spec = delay ? 0 : 2 # AF_UNSPEC is 0, AF_INET is 2 err = ccall(:uv_tcp_init_ex, Cint, (Ptr{Cvoid}, Ptr{Cvoid}, Cuint), eventloop(), tcp.handle, af_spec) @@ -322,7 +359,7 @@ end # It can be set to false if there is a need to set socket options before # further calls to `bind` and `listen`, e.g. `SO_REUSEPORT`. function TCPServer(; delay=true) - tcp = TCPServer(Libc.malloc(_sizeof_uv_tcp), StatusUninit) + tcp = TCPServer(Libc.malloc(Base._sizeof_uv_tcp), StatusUninit) af_spec = delay ? 0 : 2 # AF_UNSPEC is 0, AF_INET is 2 err = ccall(:uv_tcp_init_ex, Cint, (Ptr{Cvoid}, Ptr{Cvoid}, Cuint), eventloop(), tcp.handle, af_spec) @@ -337,7 +374,7 @@ iswritable(io::TCPSocket) = isopen(io) && io.status != StatusClosing ## VARIOUS METHODS TO BE MOVED TO BETTER LOCATION _jl_connect_raw(sock::TCPSocket, sockaddr::Ptr{Cvoid}) = - ccall(:jl_connect_raw, Int32, (Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}), sock.handle, sockaddr, uv_jl_connectcb::Ptr{Cvoid}) + ccall(:jl_connect_raw, Int32, (Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}), sock.handle, sockaddr, Base.uv_jl_connectcb::Ptr{Cvoid}) _jl_sockaddr_from_addrinfo(addrinfo::Ptr{Cvoid}) = ccall(:jl_sockaddr_from_addrinfo, Ptr{Cvoid}, (Ptr{Cvoid},), addrinfo) _jl_sockaddr_set_port(ptr::Ptr{Cvoid}, port::UInt16) = @@ -351,7 +388,6 @@ uninitialized client stream may be provided, in which case it will be used inste creating a new stream. """ accept(server::TCPServer) = accept(server, TCPSocket()) -accept(server::PipeServer) = accept(server, PipeEndpoint()) # UDP """ @@ -380,7 +416,7 @@ mutable struct UDPSocket <: LibuvStream end end function UDPSocket() - this = UDPSocket(Libc.malloc(_sizeof_uv_udp), StatusUninit) + this = UDPSocket(Libc.malloc(Base._sizeof_uv_udp), StatusUninit) err = ccall(:uv_udp_init, Cint, (Ptr{Cvoid}, Ptr{Cvoid}), eventloop(), this.handle) uv_error("failed to create udp socket", err) @@ -517,7 +553,7 @@ function recvfrom(sock::UDPSocket) end if ccall(:uv_is_active, Cint, (Ptr{Cvoid},), sock.handle) == 0 uv_error("recv_start", ccall(:uv_udp_recv_start, Cint, (Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}), - sock.handle, uv_jl_alloc_buf::Ptr{Cvoid}, uv_jl_recvcb::Ptr{Cvoid})) + sock.handle, Base.uv_jl_alloc_buf::Ptr{Cvoid}, uv_jl_recvcb::Ptr{Cvoid})) end sock.status = StatusActive return stream_wait(sock, sock.recvnotify)::Tuple{Union{IPv4, IPv6}, Vector{UInt8}} @@ -642,7 +678,7 @@ Uses the operating system's underlying getaddrinfo implementation, which may do """ function getalladdrinfo(host::String) isascii(host) || error("non-ASCII hostname: $host") - req = Libc.malloc(_sizeof_uv_getaddrinfo) + req = Libc.malloc(Base._sizeof_uv_getaddrinfo) uv_req_set_data(req, C_NULL) # in case we get interrupted before arriving at the wait call status = ccall(:jl_getaddrinfo, Int32, (Ptr{Cvoid}, Ptr{Cvoid}, Cstring, Ptr{Cvoid}, Ptr{Cvoid}), eventloop(), req, host, #=service=#C_NULL, uv_jl_getaddrinfocb::Ptr{Cvoid}) @@ -732,7 +768,7 @@ Performs a reverse-lookup for IP address to return a hostname and service using the operating system's underlying getnameinfo implementation. """ function getnameinfo(address::Union{IPv4, IPv6}) - req = Libc.malloc(_sizeof_uv_getnameinfo) + req = Libc.malloc(Base._sizeof_uv_getnameinfo) uv_req_set_data(req, C_NULL) # in case we get interrupted before arriving at the wait call ev = eventloop() port = hton(UInt16(0)) @@ -836,7 +872,7 @@ function connect!(sock::TCPSocket, host::IPv4, port::Integer) throw(ArgumentError("port out of range, must be 0 ≤ port ≤ 65535, got $port")) end uv_error("connect", ccall(:jl_tcp4_connect, Int32, (Ptr{Cvoid}, UInt32, UInt16, Ptr{Cvoid}), - sock.handle, hton(host.host), hton(UInt16(port)), uv_jl_connectcb::Ptr{Cvoid})) + sock.handle, hton(host.host), hton(UInt16(port)), Base.uv_jl_connectcb::Ptr{Cvoid})) sock.status = StatusConnecting nothing end @@ -849,7 +885,7 @@ function connect!(sock::TCPSocket, host::IPv6, port::Integer) throw(ArgumentError("port out of range, must be 0 ≤ port ≤ 65535, got $port")) end uv_error("connect", ccall(:jl_tcp6_connect, Int32, (Ptr{Cvoid}, Ref{UInt128}, UInt16, Ptr{Cvoid}), - sock.handle, hton(host.host), hton(UInt16(port)), uv_jl_connectcb::Ptr{Cvoid})) + sock.handle, hton(host.host), hton(UInt16(port)), Base.uv_jl_connectcb::Ptr{Cvoid})) sock.status = StatusConnecting nothing end @@ -871,8 +907,6 @@ connect(host::AbstractString, port::Integer) = connect(TCPSocket(), host, port) connect(addr::IPAddr, port::Integer) = connect(TCPSocket(), addr, port) connect(addr::InetAddr) = connect(TCPSocket(), addr) -default_connectcb(sock, status) = nothing - function connect!(sock::TCPSocket, host::AbstractString, port::Integer) if sock.status != StatusInit error("TCPSocket is not in initialization state") @@ -1033,3 +1067,31 @@ function _sockname(sock, self=true) end return addr, port end + +# domain sockets + +include("PipeServer.jl") + +# libuv callback handles + +function __init__() + global uv_jl_getaddrinfocb = cfunction(uv_getaddrinfocb, Cvoid, Tuple{Ptr{Cvoid}, Cint, Ptr{Cvoid}}) + global uv_jl_getnameinfocb = cfunction(uv_getnameinfocb, Cvoid, Tuple{Ptr{Cvoid}, Cint, Cstring, Cstring}) + global uv_jl_recvcb = cfunction(uv_recvcb, Cvoid, Tuple{Ptr{Cvoid}, Cssize_t, Ptr{Cvoid}, Ptr{Cvoid}, Cuint}) + global uv_jl_sendcb = cfunction(uv_sendcb, Cvoid, Tuple{Ptr{Cvoid}, Cint}) +end + +# deprecations + +@deprecate convert(dt::Type{<:Integer}, ip::IPAddr) dt(ip) + +@noinline function getaddrinfo(callback::Function, host::AbstractString) + Base.depwarn("`getaddrinfo` with a callback function is deprecated, wrap code in `@async` instead for deferred execution.", :getaddrinfo) + @async begin + r = getaddrinfo(host) + callback(r) + end + nothing +end + +end diff --git a/test/netload/nettest.jl b/stdlib/Sockets/test/nettest.jl similarity index 99% rename from test/netload/nettest.jl rename to stdlib/Sockets/test/nettest.jl index 0f7394def95c8..568efb3869953 100644 --- a/test/netload/nettest.jl +++ b/stdlib/Sockets/test/nettest.jl @@ -1,5 +1,7 @@ # This file is a part of Julia. License is MIT: https://julialang.org/license +using Distributed, Sockets + # Run various networking tests checking to see how we perform under large loads addprocs(1) diff --git a/test/socket.jl b/stdlib/Sockets/test/runtests.jl similarity index 91% rename from test/socket.jl rename to stdlib/Sockets/test/runtests.jl index 501e9814d0f0c..74f7e3157f3dd 100644 --- a/test/socket.jl +++ b/stdlib/Sockets/test/runtests.jl @@ -1,6 +1,6 @@ # This file is a part of Julia. License is MIT: https://julialang.org/license -using Random +using Sockets, Random @testset "parsing" begin @test ip"127.0.0.1" == IPv4(127,0,0,1) @@ -56,25 +56,25 @@ using Random @test IPv6(UInt16(1), UInt16(1), UInt16(1), UInt16(1), UInt16(1), UInt16(1), UInt16(1), UInt16(1)) == IPv6(1,1,1,1,1,1,1,1) - @test_throws BoundsError Base.ipv6_field(IPv6(0xffff7f000001), -1) - @test_throws BoundsError Base.ipv6_field(IPv6(0xffff7f000001), 9) + @test_throws BoundsError Sockets.ipv6_field(IPv6(0xffff7f000001), -1) + @test_throws BoundsError Sockets.ipv6_field(IPv6(0xffff7f000001), 9) end @testset "InetAddr constructor" begin - inet = Base.InetAddr(IPv4(127,0,0,1), 1024) + inet = Sockets.InetAddr(IPv4(127,0,0,1), 1024) @test inet.host == ip"127.0.0.1" @test inet.port == 1024 end @testset "InetAddr invalid port" begin - @test_throws InexactError Base.InetAddr(IPv4(127,0,0,1), -1) - @test_throws InexactError Base.InetAddr(IPv4(127,0,0,1), typemax(UInt16)+1) + @test_throws InexactError Sockets.InetAddr(IPv4(127,0,0,1), -1) + @test_throws InexactError Sockets.InetAddr(IPv4(127,0,0,1), typemax(UInt16)+1) end @testset "isless and comparisons" begin @test ip"1.2.3.4" < ip"1.2.3.7" < ip"2.3.4.5" @test ip"1.2.3.4" >= ip"1.2.3.4" >= ip"1.2.3.1" @test isless(ip"1.2.3.4", ip"1.2.3.5") - @test_throws MethodError sort[ip"2.3.4.5", ip"1.2.3.4", ip"2001:1:2::1"] + @test_throws MethodError sort([ip"2.3.4.5", ip"1.2.3.4", ip"2001:1:2::1"]) end @testset "RFC 5952 Compliance" begin @@ -92,13 +92,13 @@ defaultport = rand(2000:4000) tsk = @async begin local (p, s) = listenany(testport) @test p != 0 - @test getsockname(s) == (Base.localhost, p) + @test getsockname(s) == (Sockets.localhost, p) put!(port, p) for i in 1:3 sock = accept(s) - @test getsockname(sock) == (Base.localhost, p) + @test getsockname(sock) == (Sockets.localhost, p) let peer = getpeername(sock)::Tuple{IPAddr, UInt16} - @test peer[1] == Base.localhost + @test peer[1] == Sockets.localhost @test 0 != peer[2] != p end # test write call @@ -117,16 +117,16 @@ defaultport = rand(2000:4000) wait(port) let p = fetch(port) otherip = getipaddr() - if otherip != Base.localhost + if otherip != Sockets.localhost @test_throws Base.UVError("connect", Base.UV_ECONNREFUSED) connect(otherip, p) end for i in 1:3 client = connect(p) let name = getsockname(client)::Tuple{IPAddr, UInt16} - @test name[1] == Base.localhost + @test name[1] == Sockets.localhost @test 0 != name[2] != p end - @test getpeername(client) == (Base.localhost, p) + @test getpeername(client) == (Sockets.localhost, p) @test read(client, String) == "Hello World\n" * ("a1\n"^100) end end @@ -135,10 +135,10 @@ defaultport = rand(2000:4000) mktempdir() do tmpdir socketname = Sys.iswindows() ? ("\\\\.\\pipe\\uv-test-" * randstring(6)) : joinpath(tmpdir, "socket") - c = Base.Condition() + c = Condition() tsk = @async begin s = listen(socketname) - Base.notify(c) + notify(c) sock = accept(s) write(sock,"Hello World\n") close(s) @@ -180,10 +180,10 @@ end @test try getaddrinfo(localhost, IPv6)::IPv6 != ip"::" catch ex - isa(ex, Base.DNSError) && ex.code == Base.UV_EAI_NONAME && ex.host == localhost + isa(ex, Sockets.DNSError) && ex.code == Base.UV_EAI_NONAME && ex.host == localhost end end - @test_throws Base.DNSError getaddrinfo(".invalid") + @test_throws Sockets.DNSError getaddrinfo(".invalid") @test_throws ArgumentError getaddrinfo("localhost\0") # issue #10994 @test_throws Base.UVError("connect", Base.UV_ECONNREFUSED) connect(ip"127.0.0.1", 21452) end @@ -221,11 +221,11 @@ let localhost = getaddrinfo("localhost") close(server2) end -@test_throws Base.DNSError connect(".invalid", 80) +@test_throws Sockets.DNSError connect(".invalid", 80) @testset "UDPSocket" begin # test show() function for UDPSocket() - @test repr(UDPSocket()) == "UDPSocket(init)" + @test endswith(repr(UDPSocket()), "UDPSocket(init)") a = UDPSocket() b = UDPSocket() bind(a, ip"127.0.0.1", randport) @@ -393,10 +393,10 @@ end end @testset "connect!" begin - # test the method matching connect!(::TCPSocket, ::Base.InetAddr{T<:Base.IPAddr}) - let addr = Base.InetAddr(ip"127.0.0.1", 4444) + # test the method matching connect!(::TCPSocket, ::Sockets.InetAddr{T<:Base.IPAddr}) + let addr = Sockets.InetAddr(ip"127.0.0.1", 4444) - function test_connect(addr::Base.InetAddr) + function test_connect(addr::Sockets.InetAddr) srv = listen(addr) @async try c = accept(srv); close(c) catch end @@ -423,7 +423,7 @@ end end @testset "TCPServer constructor" begin - s = Base.TCPServer(; delay=false) + s = Sockets.TCPServer(; delay=false) if ccall(:jl_has_so_reuseport, Int32, ()) == 1 @test 0 == ccall(:jl_tcp_reuseport, Int32, (Ptr{Cvoid},), s.handle) end diff --git a/test/choosetests.jl b/test/choosetests.jl index 68641f46958fe..a1122b93bc619 100644 --- a/test/choosetests.jl +++ b/test/choosetests.jl @@ -1,6 +1,6 @@ # This file is a part of Julia. License is MIT: https://julialang.org/license -using Random +using Random, Sockets const STDLIB_DIR = joinpath(Sys.BINDIR, "..", "share", "julia", "site", "v$(VERSION.major).$(VERSION.minor)") const STDLIBS = readdir(STDLIB_DIR) @@ -43,7 +43,7 @@ function choosetests(choices = []) "operators", "path", "ccall", "parse", "loading", "bigint", "bigfloat", "sorting", "statistics", "spawn", "backtrace", "file", "read", "version", "namedtuple", - "mpfr", "broadcast", "complex", "socket", + "mpfr", "broadcast", "complex", "floatapprox", "stdlib", "reflection", "regex", "float16", "combinatorics", "sysinfo", "env", "rounding", "ranges", "mod2pi", "euler", "show", @@ -162,7 +162,7 @@ function choosetests(choices = []) filter!(x -> (x != "Profile"), tests) end - net_required_for = ["socket", "LibGit2"] + net_required_for = ["Sockets", "LibGit2"] net_on = true try ipa = getipaddr() diff --git a/test/compile.jl b/test/compile.jl index 24259aae46d72..cedd7f4f2e464 100644 --- a/test/compile.jl +++ b/test/compile.jl @@ -217,7 +217,7 @@ try [:Base64, :CRC32c, :Dates, :DelimitedFiles, :Distributed, :FileWatching, :Markdown, :Future, :IterativeEigensolvers, :Libdl, :LinearAlgebra, :Logging, :Mmap, :Printf, :Profile, :Random, :Serialization, :SharedArrays, :SparseArrays, :SuiteSparse, :Test, - :Unicode, :REPL, :InteractiveUtils, :Pkg, :LibGit2, :SHA])) + :Unicode, :REPL, :InteractiveUtils, :Pkg, :LibGit2, :SHA, :Sockets])) @test discard_module.(deps) == deps1 @test current_task()(0x01, 0x4000, 0x30031234) == 2 diff --git a/test/read.jl b/test/read.jl index c71bd58d904c3..7f80dc74a4a41 100644 --- a/test/read.jl +++ b/test/read.jl @@ -1,7 +1,6 @@ # This file is a part of Julia. License is MIT: https://julialang.org/license -using DelimitedFiles -using Random +using DelimitedFiles, Random, Sockets mktempdir() do dir diff --git a/test/spawn.jl b/test/spawn.jl index d298f5fca234e..bd100b2f1a34b 100644 --- a/test/spawn.jl +++ b/test/spawn.jl @@ -4,7 +4,7 @@ # Cross Platform tests for spawn. # ################################### -using Random +using Random, Sockets valgrind_off = ccall(:jl_running_on_valgrind, Cint, ()) == 0