main_cloexec_test.go 701 B

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