/*
- * Copyright 2014 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// will verify that the file actually gets created, which means that everything
// worked as intended.
-#include <sys/types.h>
-#include <sys/stat.h>
#include <fcntl.h>
#include <signal.h>
-#include <unistd.h>
+#include <sys/types.h>
-#include <gflags/gflags.h>
#include <glog/logging.h>
-#include "folly/Conv.h"
-#include "folly/Subprocess.h"
+#include <folly/Conv.h>
+#include <folly/Subprocess.h>
+#include <folly/portability/GFlags.h>
+#include <folly/portability/Unistd.h>
using folly::Subprocess;
namespace {
constexpr int kSignal = SIGUSR1;
-} // namespace
+} // namespace
void runChild(const char* file) {
// Block SIGUSR1 so it's queued
CHECK_ERR(creat(file, 0600));
}
-void runParent(const char* file) {
+[[noreturn]] void runParent(const char* file) {
std::vector<std::string> args {"/proc/self/exe", "--child", file};
Subprocess proc(
args,
}
int main(int argc, char *argv[]) {
- google::ParseCommandLineFlags(&argc, &argv, true);
+ gflags::ParseCommandLineFlags(&argc, &argv, true);
CHECK_EQ(argc, 2);
if (FLAGS_child) {
runChild(argv[1]);
}
return 0;
}
-