blob: ed13e448b7b4c3ec9214be744a2ea79bb33d2909 [file] [log] [blame]
David K. Bainbridge215e0242017-09-05 23:18:24 -07001// 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 darwin dragonfly freebsd linux netbsd openbsd solaris
6
7package nettest
8
9import (
10 "fmt"
11 "os"
12 "runtime"
13 "syscall"
14)
15
16func maxOpenFiles() int {
17 var rlim syscall.Rlimit
18 if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rlim); err != nil {
19 return defaultMaxOpenFiles
20 }
21 return int(rlim.Cur)
22}
23
24func supportsRawIPSocket() (string, bool) {
25 if os.Getuid() != 0 {
26 return fmt.Sprintf("must be root on %s", runtime.GOOS), false
27 }
28 return "", true
29}