mirror of
https://github.com/facebook/sapling.git
synced 2024-10-05 14:28:17 +03:00
dab46d37c6
Summary: By passing the argument to the channel, we can make it so that the NFS code correctly replies to whether it is case sensitive or not. Reviewed By: kmancini Differential Revision: D26500112 fbshipit-source-id: 2988eae403ff3648b50a1a8f0c978be2828ba568
60 lines
1.5 KiB
C++
60 lines
1.5 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 <folly/init/Init.h>
|
|
#include <folly/io/async/AsyncSignalHandler.h>
|
|
#include <folly/io/async/EventBaseManager.h>
|
|
#include <folly/logging/Init.h>
|
|
#include <folly/logging/xlog.h>
|
|
#include <signal.h>
|
|
#include "eden/fs/nfs/NfsServer.h"
|
|
|
|
using namespace facebook::eden;
|
|
|
|
FOLLY_INIT_LOGGING_CONFIG("eden=INFO");
|
|
|
|
namespace {
|
|
class SignalHandler : public folly::AsyncSignalHandler {
|
|
public:
|
|
explicit SignalHandler(folly::EventBase* evb)
|
|
: folly::AsyncSignalHandler(evb) {
|
|
registerSignalHandler(SIGTERM);
|
|
registerSignalHandler(SIGINT);
|
|
}
|
|
|
|
private:
|
|
void signalReceived(int signum) noexcept override {
|
|
if (signum == SIGTERM || signum == SIGINT) {
|
|
getEventBase()->terminateLoopSoon();
|
|
}
|
|
}
|
|
};
|
|
} // namespace
|
|
|
|
int main(int argc, char** argv) {
|
|
folly::init(&argc, &argv);
|
|
|
|
auto evb = folly::EventBaseManager::get()->getEventBase();
|
|
|
|
SignalHandler signal(evb);
|
|
NfsServer server(false, evb);
|
|
auto [nfsd, mountdport, nfsdport] = server.registerMount(
|
|
AbsolutePathPiece("/foo/bar"),
|
|
InodeNumber(42),
|
|
nullptr,
|
|
nullptr,
|
|
nullptr,
|
|
std::chrono::duration_cast<folly::Duration>(std::chrono::seconds(0)),
|
|
nullptr,
|
|
true);
|
|
|
|
XLOG(INFO) << "Started NfsServer, mountdport=" << mountdport
|
|
<< ", nfsdport=" << nfsdport;
|
|
|
|
evb->loop();
|
|
}
|