• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include <android-base/logging.h>
18 #include <asm-generic/socket.h>
19 #include <gflags/gflags.h>
20 #include <pwd.h>
21 #include <sys/socket.h>
22 #include <sys/types.h>
23 #include <sys/wait.h>
24 #include <unistd.h>
25 
26 #include <atomic>
27 #include <cstdint>
28 #include <cstdlib>
29 #include <iomanip>
30 #include <iostream>
31 #include <optional>
32 #include <set>
33 #include <sstream>
34 #include <thread>
35 
36 #include "common/libs/fs/shared_fd.h"
37 #include "host/libs/allocd/alloc_utils.h"
38 #include "host/libs/allocd/request.h"
39 #include "host/libs/allocd/resource_manager.h"
40 #include "host/libs/config/logging.h"
41 
42 DEFINE_string(socket_path, cuttlefish::kDefaultLocation, "Socket path");
43 DEFINE_bool(ebtables_legacy, false, "use ebtables-legacy instead of ebtables");
44 
main(int argc,char * argv[])45 int main(int argc, char* argv[]) {
46   ::android::base::InitLogging(argv, android::base::StderrLogger);
47 
48   google::ParseCommandLineFlags(&argc, &argv, true);
49 
50   cuttlefish::SharedFD FinalFD;
51   {
52     cuttlefish::ResourceManager m;
53     m.SetSocketLocation(FLAGS_socket_path);
54     m.SetUseEbtablesLegacy(FLAGS_ebtables_legacy);
55     m.JsonServer();
56   }
57 
58   return 0;  // EXIT_SUCCESS? or status
59 }
60