Replace master with main
This commit is contained in:
parent
f1d6733554
commit
617a5766a2
|
@ -1,4 +1,4 @@
|
||||||
.. nghttp2 documentation master file, created by
|
.. nghttp2 documentation main file, created by
|
||||||
sphinx-quickstart on Sun Mar 11 22:57:49 2012.
|
sphinx-quickstart on Sun Mar 11 22:57:49 2012.
|
||||||
You can adapt this file completely to your liking, but it should at least
|
You can adapt this file completely to your liking, but it should at least
|
||||||
contain the root `toctree` directive.
|
contain the root `toctree` directive.
|
||||||
|
|
|
@ -228,7 +228,7 @@ process. It will do fork and execute new executable, using same
|
||||||
command-line arguments and environment variables.
|
command-line arguments and environment variables.
|
||||||
|
|
||||||
As of nghttpx version 1.20.0, that is all you have to do. The new
|
As of nghttpx version 1.20.0, that is all you have to do. The new
|
||||||
master process sends QUIT signal to the original process, when it is
|
main process sends QUIT signal to the original process, when it is
|
||||||
ready to serve requests, to shut it down gracefully.
|
ready to serve requests, to shut it down gracefully.
|
||||||
|
|
||||||
For earlier versions of nghttpx, you have to do one more thing. At
|
For earlier versions of nghttpx, you have to do one more thing. At
|
||||||
|
@ -239,7 +239,7 @@ current process will exit. At this point, only new nghttpx process
|
||||||
exists and serves incoming requests.
|
exists and serves incoming requests.
|
||||||
|
|
||||||
If you want to just reload configuration file without executing new
|
If you want to just reload configuration file without executing new
|
||||||
binary, send SIGHUP to nghttpx master process.
|
binary, send SIGHUP to nghttpx main process.
|
||||||
|
|
||||||
Re-opening log files
|
Re-opening log files
|
||||||
--------------------
|
--------------------
|
||||||
|
|
26
src/shrpx.cc
26
src/shrpx.cc
|
@ -124,10 +124,10 @@ constexpr auto ENV_UNIX_PATH = StringRef::from_lit("NGHTTP2_UNIX_PATH");
|
||||||
// descriptor. <PATH> is a path to UNIX domain socket.
|
// descriptor. <PATH> is a path to UNIX domain socket.
|
||||||
constexpr auto ENV_ACCEPT_PREFIX = StringRef::from_lit("NGHTTPX_ACCEPT_");
|
constexpr auto ENV_ACCEPT_PREFIX = StringRef::from_lit("NGHTTPX_ACCEPT_");
|
||||||
|
|
||||||
// This environment variable contains PID of the original master
|
// This environment variable contains PID of the original main
|
||||||
// process, assuming that it created this master process as a result
|
// process, assuming that it created this main process as a result of
|
||||||
// of SIGUSR2. The new master process is expected to send QUIT signal
|
// SIGUSR2. The new main process is expected to send QUIT signal to
|
||||||
// to the original master process to shut it down gracefully.
|
// the original main process to shut it down gracefully.
|
||||||
constexpr auto ENV_ORIG_PID = StringRef::from_lit("NGHTTPX_ORIG_PID");
|
constexpr auto ENV_ORIG_PID = StringRef::from_lit("NGHTTPX_ORIG_PID");
|
||||||
|
|
||||||
#ifndef _KERNEL_FASTOPEN
|
#ifndef _KERNEL_FASTOPEN
|
||||||
|
@ -419,7 +419,7 @@ void exec_binary() {
|
||||||
|
|
||||||
// child process
|
// child process
|
||||||
|
|
||||||
shrpx_signal_unset_master_proc_ign_handler();
|
shrpx_signal_unset_main_proc_ign_handler();
|
||||||
|
|
||||||
rv = shrpx_signal_unblock_all();
|
rv = shrpx_signal_unblock_all();
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
|
@ -548,7 +548,7 @@ void ipc_send(WorkerProcess *wp, uint8_t ipc_event) {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
void reopen_log(WorkerProcess *wp) {
|
void reopen_log(WorkerProcess *wp) {
|
||||||
LOG(NOTICE) << "Reopening log files: master process";
|
LOG(NOTICE) << "Reopening log files: main process";
|
||||||
|
|
||||||
auto config = get_config();
|
auto config = get_config();
|
||||||
auto &loggingconf = config->logging;
|
auto &loggingconf = config->logging;
|
||||||
|
@ -1092,7 +1092,7 @@ void close_unused_inherited_addr(const std::vector<InheritedAddr> &iaddrs) {
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
// Returns the PID of the original master process from environment
|
// Returns the PID of the original main process from environment
|
||||||
// variable ENV_ORIG_PID.
|
// variable ENV_ORIG_PID.
|
||||||
pid_t get_orig_pid_from_env() {
|
pid_t get_orig_pid_from_env() {
|
||||||
auto s = getenv(ENV_ORIG_PID.c_str());
|
auto s = getenv(ENV_ORIG_PID.c_str());
|
||||||
|
@ -1310,7 +1310,7 @@ namespace {
|
||||||
int event_loop() {
|
int event_loop() {
|
||||||
std::array<char, STRERROR_BUFSIZE> errbuf;
|
std::array<char, STRERROR_BUFSIZE> errbuf;
|
||||||
|
|
||||||
shrpx_signal_set_master_proc_ign_handler();
|
shrpx_signal_set_main_proc_ign_handler();
|
||||||
|
|
||||||
auto config = mod_config();
|
auto config = mod_config();
|
||||||
|
|
||||||
|
@ -1369,7 +1369,7 @@ int event_loop() {
|
||||||
shrpx_sd_notifyf(0, "READY=1");
|
shrpx_sd_notifyf(0, "READY=1");
|
||||||
|
|
||||||
if (orig_pid != -1) {
|
if (orig_pid != -1) {
|
||||||
LOG(NOTICE) << "Send QUIT signal to the original master process to tell "
|
LOG(NOTICE) << "Send QUIT signal to the original main process to tell "
|
||||||
"that we are ready to serve requests.";
|
"that we are ready to serve requests.";
|
||||||
kill(orig_pid, SIGQUIT);
|
kill(orig_pid, SIGQUIT);
|
||||||
}
|
}
|
||||||
|
@ -2833,10 +2833,10 @@ Process:
|
||||||
--single-process
|
--single-process
|
||||||
Run this program in a single process mode for debugging
|
Run this program in a single process mode for debugging
|
||||||
purpose. Without this option, nghttpx creates at least
|
purpose. Without this option, nghttpx creates at least
|
||||||
2 processes: master and worker processes. If this
|
2 processes: main and worker processes. If this option
|
||||||
option is used, master and worker are unified into a
|
is used, main and worker are unified into a single
|
||||||
single process. nghttpx still spawns additional process
|
process. nghttpx still spawns additional process if
|
||||||
if neverbleed is used. In the single process mode, the
|
neverbleed is used. In the single process mode, the
|
||||||
signal handling feature is disabled.
|
signal handling feature is disabled.
|
||||||
|
|
||||||
Scripting:
|
Scripting:
|
||||||
|
|
|
@ -189,7 +189,7 @@ Log::~Log() {
|
||||||
|
|
||||||
lgconf->update_tstamp_millis(std::chrono::system_clock::now());
|
lgconf->update_tstamp_millis(std::chrono::system_clock::now());
|
||||||
|
|
||||||
// Error log format: <datetime> <master-pid> <current-pid>
|
// Error log format: <datetime> <main-pid> <current-pid>
|
||||||
// <thread-id> <level> (<filename>:<line>) <msg>
|
// <thread-id> <level> (<filename>:<line>) <msg>
|
||||||
rv = snprintf(buf, sizeof(buf), "%s %d %d %s %s%s%s (%s:%d) %.*s\n",
|
rv = snprintf(buf, sizeof(buf), "%s %d %d %s %s%s%s (%s:%d) %.*s\n",
|
||||||
lgconf->tstamp->time_iso8601.c_str(), config->pid, lgconf->pid,
|
lgconf->tstamp->time_iso8601.c_str(), config->pid, lgconf->pid,
|
||||||
|
|
|
@ -110,7 +110,7 @@ int signal_set_handler(void (*handler)(int), Signals &&sigs) {
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
constexpr auto master_proc_ign_signals = std::array<int, 1>{SIGPIPE};
|
constexpr auto main_proc_ign_signals = std::array<int, 1>{SIGPIPE};
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -119,12 +119,12 @@ constexpr auto worker_proc_ign_signals =
|
||||||
GRACEFUL_SHUTDOWN_SIGNAL, RELOAD_SIGNAL, SIGPIPE};
|
GRACEFUL_SHUTDOWN_SIGNAL, RELOAD_SIGNAL, SIGPIPE};
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
int shrpx_signal_set_master_proc_ign_handler() {
|
int shrpx_signal_set_main_proc_ign_handler() {
|
||||||
return signal_set_handler(SIG_IGN, master_proc_ign_signals);
|
return signal_set_handler(SIG_IGN, main_proc_ign_signals);
|
||||||
}
|
}
|
||||||
|
|
||||||
int shrpx_signal_unset_master_proc_ign_handler() {
|
int shrpx_signal_unset_main_proc_ign_handler() {
|
||||||
return signal_set_handler(SIG_DFL, master_proc_ign_signals);
|
return signal_set_handler(SIG_DFL, main_proc_ign_signals);
|
||||||
}
|
}
|
||||||
|
|
||||||
int shrpx_signal_set_worker_proc_ign_handler() {
|
int shrpx_signal_set_worker_proc_ign_handler() {
|
||||||
|
|
|
@ -49,8 +49,8 @@ int shrpx_signal_unblock_all();
|
||||||
// -1. The errno will indicate the error.
|
// -1. The errno will indicate the error.
|
||||||
int shrpx_signal_set(sigset_t *set);
|
int shrpx_signal_set(sigset_t *set);
|
||||||
|
|
||||||
int shrpx_signal_set_master_proc_ign_handler();
|
int shrpx_signal_set_main_proc_ign_handler();
|
||||||
int shrpx_signal_unset_master_proc_ign_handler();
|
int shrpx_signal_unset_main_proc_ign_handler();
|
||||||
|
|
||||||
int shrpx_signal_set_worker_proc_ign_handler();
|
int shrpx_signal_set_worker_proc_ign_handler();
|
||||||
int shrpx_signal_unset_worker_proc_ign_handler();
|
int shrpx_signal_unset_worker_proc_ign_handler();
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace shrpx {
|
||||||
class ConnectionHandler;
|
class ConnectionHandler;
|
||||||
|
|
||||||
struct WorkerProcessConfig {
|
struct WorkerProcessConfig {
|
||||||
// IPC socket to read event from master process
|
// IPC socket to read event from main process
|
||||||
int ipc_fd;
|
int ipc_fd;
|
||||||
// IPv4 or UNIX domain socket, or -1 if not used
|
// IPv4 or UNIX domain socket, or -1 if not used
|
||||||
int server_fd;
|
int server_fd;
|
||||||
|
|
Loading…
Reference in New Issue