diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 820d7847c5..94ab64c2e0 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -725,7 +725,7 @@ func makeDatabaseHandles() int { if err := fdlimit.Raise(2048); err != nil { Fatalf("Failed to raise file descriptor allowance: %v", err) } - limit, err := fdlimit.Get() + limit, err := fdlimit.Current() if err != nil { Fatalf("Failed to retrieve file descriptor allowance: %v", err) } diff --git a/common/fdlimit/fdlimit_freebsd.go b/common/fdlimit/fdlimit_freebsd.go index 3f4acf0b5a..25caaafe21 100644 --- a/common/fdlimit/fdlimit_freebsd.go +++ b/common/fdlimit/fdlimit_freebsd.go @@ -43,9 +43,9 @@ func Raise(max uint64) error { return nil } -// Get retrieves the number of file descriptors allowed to be opened by this +// Current retrieves the number of file descriptors allowed to be opened by this // process. -func Get() (int, error) { +func Current() (int, error) { var limit syscall.Rlimit if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &limit); err != nil { return 0, err @@ -53,9 +53,9 @@ func Get() (int, error) { return int(limit.Cur), nil } -// GetMax retrieves the maximum number of file descriptors this process is +// Maximum retrieves the maximum number of file descriptors this process is // allowed to request for itself. -func GetMax() (int, error) { +func Maximum() (int, error) { var limit syscall.Rlimit if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &limit); err != nil { return 0, err diff --git a/common/fdlimit/fdlimit_test.go b/common/fdlimit/fdlimit_test.go index 671feab5ef..05e9f0b658 100644 --- a/common/fdlimit/fdlimit_test.go +++ b/common/fdlimit/fdlimit_test.go @@ -25,7 +25,7 @@ import ( // per this process can be retrieved. func TestFileDescriptorLimits(t *testing.T) { target := 4096 - hardlimit, err := GetMax() + hardlimit, err := Maximum() if err != nil { t.Fatal(err) } @@ -33,13 +33,13 @@ func TestFileDescriptorLimits(t *testing.T) { t.Skip(fmt.Sprintf("system limit is less than desired test target: %d < %d", hardlimit, target)) } - if limit, err := Get(); err != nil || limit <= 0 { + if limit, err := Current(); err != nil || limit <= 0 { t.Fatalf("failed to retrieve file descriptor limit (%d): %v", limit, err) } if err := Raise(uint64(target)); err != nil { t.Fatalf("failed to raise file allowance") } - if limit, err := Get(); err != nil || limit < target { + if limit, err := Current(); err != nil || limit < target { t.Fatalf("failed to retrieve raised descriptor limit (have %v, want %v): %v", limit, target, err) } } diff --git a/common/fdlimit/fdlimit_unix.go b/common/fdlimit/fdlimit_unix.go index aaeba48f0f..27c7e783f7 100644 --- a/common/fdlimit/fdlimit_unix.go +++ b/common/fdlimit/fdlimit_unix.go @@ -39,9 +39,9 @@ func Raise(max uint64) error { return nil } -// Get retrieves the number of file descriptors allowed to be opened by this +// Current retrieves the number of file descriptors allowed to be opened by this // process. -func Get() (int, error) { +func Current() (int, error) { var limit syscall.Rlimit if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &limit); err != nil { return 0, err @@ -49,9 +49,9 @@ func Get() (int, error) { return int(limit.Cur), nil } -// GetMax retrieves the maximum number of file descriptors this process is +// Maximum retrieves the maximum number of file descriptors this process is // allowed to request for itself. -func GetMax() (int, error) { +func Maximum() (int, error) { var limit syscall.Rlimit if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &limit); err != nil { return 0, err diff --git a/common/fdlimit/fdlimit_windows.go b/common/fdlimit/fdlimit_windows.go index ab37de126a..efcd3220ea 100644 --- a/common/fdlimit/fdlimit_windows.go +++ b/common/fdlimit/fdlimit_windows.go @@ -33,15 +33,15 @@ func Raise(max uint64) error { return nil } -// Get retrieves the number of file descriptors allowed to be opened by this +// Current retrieves the number of file descriptors allowed to be opened by this // process. -func Get() (int, error) { +func Current() (int, error) { // Please see Raise for the reason why we use hard coded 16K as the limit return 16384, nil } -// GetMax retrieves the maximum number of file descriptors this process is +// Maximum retrieves the maximum number of file descriptors this process is // allowed to request for itself. -func GetMax() (int, error) { - return Get() +func Maximum() (int, error) { + return Current() }