Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
5782164a
Commit
5782164a
authored
May 09, 2016
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2529 from fjl/fdlimit-bsd
cmd/utils: fix build on *BSD
parents
27f65747
f61e203c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
1 deletion
+55
-1
fdlimit_freebsd.go
cmd/utils/fdlimit_freebsd.go
+54
-0
fdlimit_unix.go
cmd/utils/fdlimit_unix.go
+1
-1
No files found.
cmd/utils/fdlimit_freebsd.go
0 → 100644
View file @
5782164a
// Copyright 2016 The go-ethereum Authors
// This file is part of go-ethereum.
//
// go-ethereum is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// go-ethereum is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
// +build freebsd
package
utils
import
"syscall"
// This file is largely identical to fdlimit_unix.go,
// but Rlimit fields have type int64 on FreeBSD so it needs
// an extra conversion.
// raiseFdLimit tries to maximize the file descriptor allowance of this process
// to the maximum hard-limit allowed by the OS.
func
raiseFdLimit
(
max
uint64
)
error
{
// Get the current limit
var
limit
syscall
.
Rlimit
if
err
:=
syscall
.
Getrlimit
(
syscall
.
RLIMIT_NOFILE
,
&
limit
);
err
!=
nil
{
return
err
}
// Try to update the limit to the max allowance
limit
.
Cur
=
limit
.
Max
if
limit
.
Cur
>
int64
(
max
)
{
limit
.
Cur
=
int64
(
max
)
}
if
err
:=
syscall
.
Setrlimit
(
syscall
.
RLIMIT_NOFILE
,
&
limit
);
err
!=
nil
{
return
err
}
return
nil
}
// getFdLimit retrieves the number of file descriptors allowed to be opened by this
// process.
func
getFdLimit
()
(
int
,
error
)
{
var
limit
syscall
.
Rlimit
if
err
:=
syscall
.
Getrlimit
(
syscall
.
RLIMIT_NOFILE
,
&
limit
);
err
!=
nil
{
return
0
,
err
}
return
int
(
limit
.
Cur
),
nil
}
cmd/utils/fdlimit_unix.go
View file @
5782164a
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// You should have received a copy of the GNU General Public License
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
// +build linux darwin
// +build linux darwin
netbsd openbsd solaris
package
utils
package
utils
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment