mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
common/fdlimit: fix Maximum-check to respect OPEN_MAX
This commit is contained in:
parent
b4d145673b
commit
db23b9547b
1 changed files with 3 additions and 2 deletions
|
|
@ -14,8 +14,6 @@
|
||||||
// You should have received a copy of the GNU Lesser General Public License
|
// You should have received a copy of the GNU Lesser General Public License
|
||||||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
// +build darwin
|
|
||||||
|
|
||||||
package fdlimit
|
package fdlimit
|
||||||
|
|
||||||
import "syscall"
|
import "syscall"
|
||||||
|
|
@ -66,5 +64,8 @@ func Maximum() (int, error) {
|
||||||
if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &limit); err != nil {
|
if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &limit); err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
if limit.Max > 10240 { // OPEN_MAX is 10240
|
||||||
|
return 10240, nil
|
||||||
|
}
|
||||||
return int(limit.Max), nil
|
return int(limit.Max), nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue