Commit 1a948950 authored by Alex Brainman's avatar Alex Brainman

net: move system common global variables into fd_unix.go

R=golang-dev, bradfitz
CC=dvyukov, golang-dev, mikioh.mikioh
https://golang.org/cl/9495044
parent 13081942
...@@ -20,17 +20,12 @@ func runtime_pollReset(ctx uintptr, mode int) int ...@@ -20,17 +20,12 @@ func runtime_pollReset(ctx uintptr, mode int) int
func runtime_pollSetDeadline(ctx uintptr, d int64, mode int) func runtime_pollSetDeadline(ctx uintptr, d int64, mode int)
func runtime_pollUnblock(ctx uintptr) func runtime_pollUnblock(ctx uintptr)
var canCancelIO = true // used for testing current package
type pollDesc struct { type pollDesc struct {
runtimeCtx uintptr runtimeCtx uintptr
} }
var serverInit sync.Once var serverInit sync.Once
func sysInit() {
}
func (pd *pollDesc) Init(fd *netFD) error { func (pd *pollDesc) Init(fd *netFD) error {
serverInit.Do(runtime_pollServerInit) serverInit.Do(runtime_pollServerInit)
ctx, errno := runtime_pollOpen(uintptr(fd.sysfd)) ctx, errno := runtime_pollOpen(uintptr(fd.sysfd))
......
...@@ -303,9 +303,7 @@ var pollMaxN int ...@@ -303,9 +303,7 @@ var pollMaxN int
var pollservers []*pollServer var pollservers []*pollServer
var startServersOnce []func() var startServersOnce []func()
var canCancelIO = true // used for testing current package func init() {
func sysInit() {
pollMaxN = runtime.NumCPU() pollMaxN = runtime.NumCPU()
if pollMaxN > 8 { if pollMaxN > 8 {
pollMaxN = 8 // No improvement then. pollMaxN = 8 // No improvement then.
......
...@@ -41,6 +41,11 @@ type netFD struct { ...@@ -41,6 +41,11 @@ type netFD struct {
pd pollDesc pd pollDesc
} }
var canCancelIO = true // used for testing current package
func sysInit() {
}
func resolveAndDial(net, addr string, localAddr Addr, deadline time.Time) (Conn, error) { func resolveAndDial(net, addr string, localAddr Addr, deadline time.Time) (Conn, error) {
ra, err := resolveAddr("dial", net, addr, deadline) ra, err := resolveAddr("dial", net, addr, deadline)
if err != nil { if err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment