File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 16
16
17
17
package fdlimit
18
18
19
- import "errors"
19
+ import "fmt"
20
+
21
+ const hardlimit = 16384
20
22
21
23
// Raise tries to maximize the file descriptor allowance of this process
22
24
// to the maximum hard-limit allowed by the OS.
@@ -27,8 +29,8 @@ func Raise(max uint64) (uint64, error) {
27
29
// changeable from within a running process
28
30
// This way we can always "request" raising the limits, which will either have
29
31
// 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 )
32
34
}
33
35
return max , nil
34
36
}
@@ -37,7 +39,7 @@ func Raise(max uint64) (uint64, error) {
37
39
// process.
38
40
func Current () (int , error ) {
39
41
// Please see Raise for the reason why we use hard coded 16K as the limit
40
- return 16384 , nil
42
+ return hardlimit , nil
41
43
}
42
44
43
45
// Maximum retrieves the maximum number of file descriptors this process is
You can’t perform that action at this time.
0 commit comments