File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 1616
1717package fdlimit
1818
19- import "errors"
19+ import "fmt"
20+
21+ const hardlimit = 16384
2022
2123// Raise tries to maximize the file descriptor allowance of this process
2224// to the maximum hard-limit allowed by the OS.
@@ -27,8 +29,8 @@ func Raise(max uint64) (uint64, error) {
2729 // changeable from within a running process
2830 // This way we can always "request" raising the limits, which will either have
2931 // or not have effect based on the platform we're running on.
30- if max > 16384 {
31- return errors . New ("file descriptor limit (16384 ) reached" )
32+ if max > hardlimit {
33+ return hardlimit , fmt . Errorf ("file descriptor limit (%d ) reached" , hardlimit )
3234 }
3335 return max , nil
3436}
@@ -37,7 +39,7 @@ func Raise(max uint64) (uint64, error) {
3739// process.
3840func Current () (int , error ) {
3941 // Please see Raise for the reason why we use hard coded 16K as the limit
40- return 16384 , nil
42+ return hardlimit , nil
4143}
4244
4345// Maximum retrieves the maximum number of file descriptors this process is
You can’t perform that action at this time.
0 commit comments