Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
0ca979b4
Commit
0ca979b4
authored
Jan 10, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Add --rlimit-nofile option
parent
987aa2dd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
0 deletions
+42
-0
src/shrpx.cc
src/shrpx.cc
+21
-0
src/shrpx_config.cc
src/shrpx_config.cc
+19
-0
src/shrpx_config.h
src/shrpx_config.h
+2
-0
No files found.
src/shrpx.cc
View file @
0ca979b4
...
...
@@ -37,6 +37,8 @@
#include <syslog.h>
#include <signal.h>
#include <limits.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <limits>
#include <cstdlib>
...
...
@@ -879,6 +881,11 @@ Performance:
--backend-http1-connections-per-host.
Default: )"
<<
get_config
()
->
downstream_connections_per_frontend
<<
R"(
--rlimit-nofile=<N>
Set maximum number of open files (RLIMIT_NOFILE)
to <N>. If 0 is given, nghttpx does not set the
limit.
Default: )"
<<
get_config
()
->
rlimit_nofile
<<
R"(
Timeout:
--frontend-http2-read-timeout=<SEC>
...
...
@@ -1272,6 +1279,7 @@ int main(int argc, char **argv) {
{
"backend-http1-connections-per-frontend"
,
required_argument
,
&
flag
,
67
},
{
"tls-ticket-key-file"
,
required_argument
,
&
flag
,
68
},
{
"rlimit-nofile"
,
required_argument
,
&
flag
,
69
},
{
nullptr
,
0
,
nullptr
,
0
}};
int
option_index
=
0
;
...
...
@@ -1585,6 +1593,10 @@ int main(int argc, char **argv) {
// --tls-ticket-key-file
cmdcfgs
.
emplace_back
(
SHRPX_OPT_TLS_TICKET_KEY_FILE
,
optarg
);
break
;
case
69
:
// --rlimit-nofile
cmdcfgs
.
emplace_back
(
SHRPX_OPT_RLIMIT_NOFILE
,
optarg
);
break
;
default:
break
;
}
...
...
@@ -1838,6 +1850,15 @@ int main(int argc, char **argv) {
}
}
if
(
get_config
()
->
rlimit_nofile
)
{
struct
rlimit
lim
=
{
get_config
()
->
rlimit_nofile
,
get_config
()
->
rlimit_nofile
};
if
(
setrlimit
(
RLIMIT_NOFILE
,
&
lim
)
!=
0
)
{
auto
error
=
errno
;
LOG
(
WARN
)
<<
"Setting rlimit-nofile failed: "
<<
strerror
(
error
);
}
}
if
(
get_config
()
->
upstream_frame_debug
)
{
// To make it sync to logging
set_output
(
stderr
);
...
...
src/shrpx_config.cc
View file @
0ca979b4
...
...
@@ -139,6 +139,7 @@ const char SHRPX_OPT_BACKEND_HTTP1_CONNECTIONS_PER_FRONTEND[] =
"backend-http1-connections-per-frontend"
;
const
char
SHRPX_OPT_LISTENER_DISABLE_TIMEOUT
[]
=
"listener-disable-timeout"
;
const
char
SHRPX_OPT_TLS_TICKET_KEY_FILE
[]
=
"tls-ticket-key-file"
;
const
char
SHRPX_OPT_RLIMIT_NOFILE
[]
=
"rlimit-nofile"
;
namespace
{
Config
*
config
=
nullptr
;
...
...
@@ -1109,6 +1110,24 @@ int parse_config(const char *opt, const char *optarg) {
return
0
;
}
if
(
util
::
strieq
(
opt
,
SHRPX_OPT_RLIMIT_NOFILE
))
{
int
n
;
if
(
parse_uint
(
&
n
,
opt
,
optarg
)
!=
0
)
{
return
-
1
;
}
if
(
n
<
0
)
{
LOG
(
ERROR
)
<<
opt
<<
": specify the integer more than or equal to 0"
;
return
-
1
;
}
mod_config
()
->
rlimit_nofile
=
n
;
return
0
;
}
if
(
util
::
strieq
(
opt
,
"conf"
))
{
LOG
(
WARN
)
<<
"conf: ignored"
;
...
...
src/shrpx_config.h
View file @
0ca979b4
...
...
@@ -127,6 +127,7 @@ extern const char SHRPX_OPT_BACKEND_HTTP1_CONNECTIONS_PER_HOST[];
extern
const
char
SHRPX_OPT_BACKEND_HTTP1_CONNECTIONS_PER_FRONTEND
[];
extern
const
char
SHRPX_OPT_LISTENER_DISABLE_TIMEOUT
[];
extern
const
char
SHRPX_OPT_TLS_TICKET_KEY_FILE
[];
extern
const
char
SHRPX_OPT_RLIMIT_NOFILE
[];
union
sockaddr_union
{
sockaddr
sa
;
...
...
@@ -255,6 +256,7 @@ struct Config {
size_t
worker_write_burst
;
size_t
padding
;
size_t
worker_frontend_connections
;
size_t
rlimit_nofile
;
// Bit mask to disable SSL/TLS protocol versions. This will be
// passed to SSL_CTX_set_options().
long
int
tls_proto_mask
;
...
...
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