...
Run Format

Source file src/net/main_cloexec_test.go

Documentation: net

     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 dragonfly freebsd linux
     6  
     7  package net
     8  
     9  import "internal/poll"
    10  
    11  func init() {
    12  	extraTestHookInstallers = append(extraTestHookInstallers, installAccept4TestHook)
    13  	extraTestHookUninstallers = append(extraTestHookUninstallers, uninstallAccept4TestHook)
    14  }
    15  
    16  var (
    17  	// Placeholders for saving original socket system calls.
    18  	origAccept4 = poll.Accept4Func
    19  )
    20  
    21  func installAccept4TestHook() {
    22  	poll.Accept4Func = sw.Accept4
    23  }
    24  
    25  func uninstallAccept4TestHook() {
    26  	poll.Accept4Func = origAccept4
    27  }
    28  

View as plain text