github.com/d4l3k/go@v0.0.0-20151015000803-65fc379daeda/src/net/main_cloexec_test.go (about)

     1  // Copyright 2015 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // +build freebsd linux
     6  
     7  package net
     8  
     9  func init() {
    10  	extraTestHookInstallers = append(extraTestHookInstallers, installAccept4TestHook)
    11  	extraTestHookUninstallers = append(extraTestHookUninstallers, uninstallAccept4TestHook)
    12  }
    13  
    14  var (
    15  	// Placeholders for saving original socket system calls.
    16  	origAccept4 = accept4Func
    17  )
    18  
    19  func installAccept4TestHook() {
    20  	accept4Func = sw.Accept4
    21  }
    22  
    23  func uninstallAccept4TestHook() {
    24  	accept4Func = origAccept4
    25  }