github.com/getgauge/gauge@v1.6.9/util/rlimitUtil.go (about) 1 //go:build !windows 2 3 /*---------------------------------------------------------------- 4 * Copyright (c) ThoughtWorks, Inc. 5 * Licensed under the Apache License, Version 2.0 6 * See LICENSE in the project root for license information. 7 *----------------------------------------------------------------*/ 8 9 package util 10 11 import ( 12 "syscall" 13 ) 14 15 func RLimit() (int, error) { 16 var rLimit syscall.Rlimit 17 err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rLimit) 18 if err != nil { 19 return 20, nil 20 } 21 return int(rLimit.Cur), nil 22 }