public
Last active

Finding out user limits in Go

  • Download Gist
gistfile1.go
Go
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
package main
 
import (
"fmt"
"syscall"
)
 
func main() {
r := syscall.Rlimit{}
 
syscall.Getrlimit(syscall.RLIMIT_NOFILE, &r)
 
fmt.Println("Open file current:", r.Cur)
fmt.Println("Open file maximum:", r.Max)
}

$ ulimit -n
2560

$ ./limit_test
Open file current: 2560
Open file maximum: 9223372036854775807

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.