Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

30 linhas
627 B

  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. // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
  5. package nettest
  6. import (
  7. "fmt"
  8. "os"
  9. "runtime"
  10. "syscall"
  11. )
  12. func maxOpenFiles() int {
  13. var rlim syscall.Rlimit
  14. if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rlim); err != nil {
  15. return defaultMaxOpenFiles
  16. }
  17. return int(rlim.Cur)
  18. }
  19. func supportsRawIPSocket() (string, bool) {
  20. if os.Getuid() != 0 {
  21. return fmt.Sprintf("must be root on %s", runtime.GOOS), false
  22. }
  23. return "", true
  24. }