Black Lives Matter. Support the Equal Justice Initiative.

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

View as plain text