mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 00:14:35 +03:00
fbdb46f5cb
Reviewed By: chadaustin Differential Revision: D17872966 fbshipit-source-id: cd60a364a2146f0dadbeca693b1d4a5d7c97ff63
41 lines
1.0 KiB
C++
41 lines
1.0 KiB
C++
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This software may be used and distributed according to the terms of the
|
|
* GNU General Public License version 2.
|
|
*/
|
|
|
|
#include "eden/fs/service/Systemd.h"
|
|
#include <folly/String.h>
|
|
#include <folly/logging/xlog.h>
|
|
#include <gflags/gflags.h>
|
|
#include "eden/fs/eden-config.h"
|
|
|
|
#if EDEN_HAVE_SYSTEMD
|
|
#include <systemd/sd-daemon.h> // @manual
|
|
#endif
|
|
|
|
namespace facebook {
|
|
namespace eden {
|
|
|
|
#if EDEN_HAVE_SYSTEMD
|
|
DEFINE_bool(
|
|
experimentalSystemd,
|
|
false,
|
|
"EXPERIMENTAL: Run edenfs as if systemd controls its lifecycle");
|
|
|
|
void Systemd::notifyReady() {
|
|
// TODO(strager): Move READY=1 into a systemd-specific StartupLogger.
|
|
auto rc = sd_notify(/*unset_environment=*/false, "READY=1");
|
|
if (rc < 0) {
|
|
XLOG(ERR) << "sd_notify READY=1 failed: " << folly::errnoStr(-rc);
|
|
} else if (rc == 0) {
|
|
XLOG(WARN)
|
|
<< "sd_notify READY=1 failed: $NOTIFY_SOCKET is unset. edenfs was probably not started by systemd.";
|
|
}
|
|
}
|
|
#endif
|
|
|
|
} // namespace eden
|
|
} // namespace facebook
|