diff --git a/cmake/SapiDeps.cmake b/cmake/SapiDeps.cmake index 4774bcc..9688d8f 100644 --- a/cmake/SapiDeps.cmake +++ b/cmake/SapiDeps.cmake @@ -79,21 +79,6 @@ if(SAPI_DOWNLOAD_LIBUNWIND) endif() sapi_check_target(unwind_ptrace_wrapped) -if(SAPI_DOWNLOAD_GFLAGS) - include(cmake/gflags.cmake) - sapi_check_target(gflags) -else() - find_package(gflags REQUIRED) -endif() - -if(SAPI_DOWNLOAD_GLOG) - include(cmake/glog.cmake) -endif() -sapi_check_target(glog::glog) - -# TODO(cblichmann): Check if this is needed/works with system lib -add_dependencies(glog gflags::gflags) - if(SAPI_DOWNLOAD_PROTOBUF) include(cmake/protobuf.cmake) endif() diff --git a/cmake/SapiOptions.cmake b/cmake/SapiOptions.cmake index 26b74fd..57bfe31 100644 --- a/cmake/SapiOptions.cmake +++ b/cmake/SapiOptions.cmake @@ -30,8 +30,6 @@ endif() option(SAPI_DOWNLOAD_ABSL "Download Abseil at config time" ON) option(SAPI_DOWNLOAD_GOOGLETEST "Download googletest at config time" ON) option(SAPI_DOWNLOAD_BENCHMARK "Download benchmark at config time" ON) -option(SAPI_DOWNLOAD_GFLAGS "Download gflags at config time" ON) -option(SAPI_DOWNLOAD_GLOG "Download glog at config time" ON) option(SAPI_DOWNLOAD_PROTOBUF "Download protobuf at config time" ON) option(SAPI_DOWNLOAD_LIBUNWIND "Download libunwind at config time" ON) option(SAPI_DOWNLOAD_LIBCAP "Download libcap at config time" ON) diff --git a/cmake/gflags.cmake b/cmake/gflags.cmake deleted file mode 100644 index 04b30d0..0000000 --- a/cmake/gflags.cmake +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2019 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -FetchContent_Declare(gflags - GIT_REPOSITORY https://github.com/gflags/gflags.git - GIT_TAG addd749114fab4f24b7ea1e0f2f837584389e52c # 2020-03-18 -) -set(GFLAGS_IS_SUBPROJECT TRUE) -set(GFLAGS_BUILD_SHARED_LIBS ${SAPI_ENABLE_SHARED_LIBS}) -set(GFLAGS_INSTALL_SHARED_LIBS ${SAPI_ENABLE_SHARED_LIBS}) -set(GFLAGS_INSTALL_HEADERS OFF) -set(GFLAGS_BUILD_TESTING FALSE) - -FetchContent_MakeAvailable(gflags) diff --git a/cmake/glog.cmake b/cmake/glog.cmake deleted file mode 100644 index 8920d6f..0000000 --- a/cmake/glog.cmake +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright 2019 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -FetchContent_Declare(glog - GIT_REPOSITORY https://github.com/google/glog.git - GIT_TAG 3ba8976592274bc1f907c402ce22558011d6fc5e # 2020-02-16 -) -# Force gflags from subdirectory -set(WITH_GFLAGS FALSE CACHE BOOL "" FORCE) -set(HAVE_LIB_GFLAGS TRUE CACHE STRING "" FORCE) - -set(WITH_UNWIND FALSE CACHE BOOL "" FORCE) -set(UNWIND_LIBRARY FALSE) - -set(HAVE_PWD_H FALSE) -set(WITH_PKGCONFIG TRUE CACHE BOOL "" FORCE) - -set(BUILD_SHARED_LIBS ${SAPI_ENABLE_SHARED_LIBS}) - -FetchContent_MakeAvailable(glog) -target_include_directories(glog PUBLIC - $ - $ -) -add_library(gflags_nothreads STATIC IMPORTED) -set_target_properties(gflags_nothreads PROPERTIES - IMPORTED_LOCATION "${gflags_BINARY_DIR}/libgflags_nothreads.a" -) -target_link_libraries(glog PRIVATE - #-Wl,--whole-archive gflags_nothreads -Wl,--no-whole-archive - gflags_nothreads -) diff --git a/contrib/brotli/example/CMakeLists.txt b/contrib/brotli/example/CMakeLists.txt index 5e0cd22..17a0926 100644 --- a/contrib/brotli/example/CMakeLists.txt +++ b/contrib/brotli/example/CMakeLists.txt @@ -18,9 +18,11 @@ add_executable(sapi_minibrotli ../utils/utils_brotli_enc.cc ../utils/utils_brotli_dec.cc ) -target_link_libraries(sapi_minibrotli - PRIVATE absl::flags_parse - sapi_contrib::brotli - sapi::logging - sapi::sapi +target_link_libraries(sapi_minibrotli PRIVATE + absl::flags + absl::flags_parse + absl::log_globals + absl::log_initialize + sapi_contrib::brotli + sapi::sapi ) diff --git a/contrib/brotli/example/main.cc b/contrib/brotli/example/main.cc index 33f9aca..fbb2b99 100644 --- a/contrib/brotli/example/main.cc +++ b/contrib/brotli/example/main.cc @@ -17,11 +17,12 @@ #include "absl/flags/flag.h" #include "absl/flags/parse.h" +#include "absl/log/globals.h" +#include "absl/log/initialize.h" #include "contrib/brotli/sandboxed.h" #include "contrib/brotli/utils/utils_brotli.h" #include "contrib/brotli/utils/utils_brotli_dec.h" #include "contrib/brotli/utils/utils_brotli_enc.h" -#include "sandboxed_api/util/logging.h" ABSL_FLAG(bool, decompress, false, "decompress"); @@ -62,8 +63,9 @@ absl::Status DecompressInMemory(BrotliSandbox& sandbox, int main(int argc, char* argv[]) { std::string prog_name(argv[0]); - sapi::InitLogging(argv[0]); + absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo); std::vector args = absl::ParseCommandLine(argc, argv); + absl::InitializeLog(); if (args.size() != 3) { std::cerr << "Usage:\n " << prog_name << " INPUT OUTPUT\n"; diff --git a/contrib/c-blosc/example/CMakeLists.txt b/contrib/c-blosc/example/CMakeLists.txt index 2d3104a..ef6c92a 100644 --- a/contrib/c-blosc/example/CMakeLists.txt +++ b/contrib/c-blosc/example/CMakeLists.txt @@ -21,9 +21,11 @@ target_include_directories(sapi_miniblosc INTERFACE "${SAPI_SOURCE_DIR}" ) -target_link_libraries(sapi_miniblosc - PRIVATE sapi_contrib::blosc - absl::flags_parse - sapi::logging - sapi::sapi +target_link_libraries(sapi_miniblosc PRIVATE + absl::flags + absl::flags_parse + absl::log_globals + absl::log_initialize + sapi_contrib::blosc + sapi::sapi ) diff --git a/contrib/c-blosc/example/main.cc b/contrib/c-blosc/example/main.cc index 89e7c7c..d687eb0 100644 --- a/contrib/c-blosc/example/main.cc +++ b/contrib/c-blosc/example/main.cc @@ -12,17 +12,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include #include #include #include #include +#include "absl/flags/flag.h" +#include "absl/flags/parse.h" +#include "absl/log/globals.h" +#include "absl/log/initialize.h" #include "contrib/c-blosc/sandboxed.h" #include "contrib/c-blosc/utils/utils_blosc.h" -#include "sandboxed_api/util/logging.h" ABSL_FLAG(bool, decompress, false, "decompress"); ABSL_FLAG(int, clevel, 5, "compression level"); @@ -53,8 +54,9 @@ absl::Status Stream(CbloscApi& api, std::string& infile_s, int main(int argc, char* argv[]) { std::string prog_name(argv[0]); + absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo); std::vector args = absl::ParseCommandLine(argc, argv); - sapi::InitLogging(argv[0]); + absl::InitializeLog(); if (args.size() != 3) { std::cerr << "Usage:\n " << prog_name << " INPUT OUTPUT\n"; diff --git a/contrib/hunspell/example/CMakeLists.txt b/contrib/hunspell/example/CMakeLists.txt index ca4c918..84c2993 100644 --- a/contrib/hunspell/example/CMakeLists.txt +++ b/contrib/hunspell/example/CMakeLists.txt @@ -16,8 +16,11 @@ add_executable(sapi_minihunspell main.cc ) -target_link_libraries(sapi_minihunspell - PRIVATE sapi_contrib::hunspell - sapi::logging - sapi::sapi +target_link_libraries(sapi_minihunspell PRIVATE + absl::flags + absl::flags_parse + absl::log_globals + absl::log_initialize + sapi_contrib::hunspell + sapi::sapi ) diff --git a/contrib/hunspell/example/main.cc b/contrib/hunspell/example/main.cc index d4e173b..136c33f 100644 --- a/contrib/hunspell/example/main.cc +++ b/contrib/hunspell/example/main.cc @@ -18,8 +18,10 @@ #include #include +#include "absl/flags/parse.h" +#include "absl/log/globals.h" +#include "absl/log/initialize.h" #include "contrib/hunspell/sandboxed.h" -#include "sandboxed_api/util/logging.h" absl::Status PrintSuggest(HunspellApi& api, sapi::v::RemotePtr& hunspellrp, sapi::v::ConstCStr& word) { @@ -53,7 +55,9 @@ absl::Status PrintSuggest(HunspellApi& api, sapi::v::RemotePtr& hunspellrp, } int main(int argc, char* argv[]) { - sapi::InitLogging(argv[0]); + absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo); + absl::ParseCommandLine(argc, argv); + absl::InitializeLog(); if (argc != 4) { std::cerr << "Usage:\n " << argv[0]; diff --git a/contrib/jsonnet/examples/CMakeLists.txt b/contrib/jsonnet/examples/CMakeLists.txt index 12e01b2..f4a722b 100644 --- a/contrib/jsonnet/examples/CMakeLists.txt +++ b/contrib/jsonnet/examples/CMakeLists.txt @@ -17,12 +17,17 @@ foreach(target IN ITEMS base multiple_files yaml_stream formatter) jsonnet_${target}_example.cc ) target_link_libraries(jsonnet_${target}_sandboxed PRIVATE + absl::check + absl::flags + absl::flags_parse + absl::log + absl::log_globals + absl::log_initialize libjsonnet sapi_contrib::jsonnet_helper sapi_contrib::jsonnet sapi::file_base sapi::fileops - sapi::logging sapi::sapi ) endforeach() @@ -30,11 +35,15 @@ endforeach() add_executable(jsonnet_base_transacted jsonnet_base_transaction.cc ) - target_link_libraries(jsonnet_base_transacted PRIVATE + absl::check + absl::flags + absl::flags_parse + absl::log + absl::log_globals + absl::log_initialize libjsonnet sapi_contrib::jsonnet_helper sapi_contrib::jsonnet - sapi::logging sapi::sapi ) diff --git a/contrib/jsonnet/examples/jsonnet_base_example.cc b/contrib/jsonnet/examples/jsonnet_base_example.cc index ce08f9e..f3c0758 100644 --- a/contrib/jsonnet/examples/jsonnet_base_example.cc +++ b/contrib/jsonnet/examples/jsonnet_base_example.cc @@ -15,9 +15,12 @@ #include #include +#include "absl/flags/parse.h" +#include "absl/log/check.h" +#include "absl/log/globals.h" +#include "absl/log/initialize.h" #include "contrib/jsonnet/jsonnet_base_sandbox.h" #include "sandboxed_api/util/fileops.h" -#include "sandboxed_api/util/logging.h" #include "sandboxed_api/util/path.h" absl::Status JsonnetMain(std::string in_file, std::string out_file) { @@ -73,10 +76,11 @@ absl::Status JsonnetMain(std::string in_file, std::string out_file) { int main(int argc, char* argv[]) { using sapi::file_util::fileops::Basename; - sapi::InitLogging(argv[0]); - gflags::ParseCommandLineFlags(&argc, &argv, true); + absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo); + absl::ParseCommandLine(argc, argv); + absl::InitializeLog(); - if (!(argc == 3)) { + if (argc != 3) { std::cerr << "Usage:\n" << Basename(argv[0]) << " /absolute/path/to/INPUT.jsonnet /absolute/path/to/OUTPUT\n"; diff --git a/contrib/jsonnet/examples/jsonnet_base_transaction.cc b/contrib/jsonnet/examples/jsonnet_base_transaction.cc index 627119e..aeaa1ad 100644 --- a/contrib/jsonnet/examples/jsonnet_base_transaction.cc +++ b/contrib/jsonnet/examples/jsonnet_base_transaction.cc @@ -14,8 +14,11 @@ #include "contrib/jsonnet/jsonnet_base_transaction.h" +#include "absl/flags/parse.h" +#include "absl/log/check.h" +#include "absl/log/globals.h" +#include "absl/log/initialize.h" #include "sandboxed_api/util/fileops.h" -#include "sandboxed_api/util/logging.h" #include "sandboxed_api/util/path.h" absl::Status JsonnetTransaction::Main() { @@ -65,10 +68,11 @@ absl::Status JsonnetTransaction::Main() { int main(int argc, char* argv[]) { using sapi::file_util::fileops::Basename; - sapi::InitLogging(argv[0]); - gflags::ParseCommandLineFlags(&argc, &argv, true); + absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo); + absl::ParseCommandLine(argc, argv); + absl::InitializeLog(); - if (!(argc == 3)) { + if (argc != 3) { std::cerr << "Usage:\n" << Basename(argv[0]) << " /absolute/path/to/INPUT.jsonnet /absolute/path/to/OUTPUT\n"; diff --git a/contrib/jsonnet/examples/jsonnet_formatter_example.cc b/contrib/jsonnet/examples/jsonnet_formatter_example.cc index 602fdd4..4cf5b49 100644 --- a/contrib/jsonnet/examples/jsonnet_formatter_example.cc +++ b/contrib/jsonnet/examples/jsonnet_formatter_example.cc @@ -19,8 +19,11 @@ #include #include "jsonnet_sapi.sapi.h" // NOLINT(build/include) +#include "absl/flags/parse.h" +#include "absl/log/check.h" +#include "absl/log/globals.h" +#include "absl/log/initialize.h" #include "sandboxed_api/util/fileops.h" -#include "sandboxed_api/util/logging.h" #include "sandboxed_api/util/path.h" class JsonnetSapiSandbox : public JsonnetSandbox { @@ -105,10 +108,11 @@ absl::Status JsonnetMain(std::string in_file, std::string out_file) { int main(int argc, char* argv[]) { using sapi::file_util::fileops::Basename; - sapi::InitLogging(argv[0]); - gflags::ParseCommandLineFlags(&argc, &argv, true); + absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo); + absl::ParseCommandLine(argc, argv); + absl::InitializeLog(); - if (!(argc == 3)) { + if (argc != 3) { std::cerr << "Usage:\n" << Basename(argv[0]) << " /absolute/path/to/INPUT.jsonnet /absolute/path/to/OUTPUT\n"; diff --git a/contrib/jsonnet/examples/jsonnet_multiple_files_example.cc b/contrib/jsonnet/examples/jsonnet_multiple_files_example.cc index 356fe3c..81db2d2 100644 --- a/contrib/jsonnet/examples/jsonnet_multiple_files_example.cc +++ b/contrib/jsonnet/examples/jsonnet_multiple_files_example.cc @@ -19,8 +19,11 @@ #include #include "jsonnet_sapi.sapi.h" // NOLINT(build/include) +#include "absl/flags/parse.h" +#include "absl/log/check.h" +#include "absl/log/globals.h" +#include "absl/log/initialize.h" #include "sandboxed_api/util/fileops.h" -#include "sandboxed_api/util/logging.h" #include "sandboxed_api/util/path.h" class JsonnetSapiSandbox : public JsonnetSandbox { @@ -108,10 +111,11 @@ absl::Status JsonnetMain(std::string in_file, std::string out_file) { int main(int argc, char* argv[]) { using sapi::file_util::fileops::Basename; - sapi::InitLogging(argv[0]); - gflags::ParseCommandLineFlags(&argc, &argv, true); + absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo); + absl::ParseCommandLine(argc, argv); + absl::InitializeLog(); - if (!(argc == 3)) { + if (argc != 3) { std::cerr << "Usage:\n" << Basename(argv[0]) << " /absolute/path/to/INPUT.jsonnet /absolute/path/to/OUTPUT\n"; diff --git a/contrib/jsonnet/examples/jsonnet_yaml_stream_example.cc b/contrib/jsonnet/examples/jsonnet_yaml_stream_example.cc index 2ec4577..659e20a 100644 --- a/contrib/jsonnet/examples/jsonnet_yaml_stream_example.cc +++ b/contrib/jsonnet/examples/jsonnet_yaml_stream_example.cc @@ -15,9 +15,12 @@ #include #include +#include "absl/flags/parse.h" +#include "absl/log/check.h" +#include "absl/log/globals.h" +#include "absl/log/initialize.h" #include "contrib/jsonnet/jsonnet_base_sandbox.h" #include "sandboxed_api/util/fileops.h" -#include "sandboxed_api/util/logging.h" #include "sandboxed_api/util/path.h" absl::Status JsonnetMain(std::string in_file, std::string out_file) { @@ -73,10 +76,11 @@ absl::Status JsonnetMain(std::string in_file, std::string out_file) { int main(int argc, char* argv[]) { using sapi::file_util::fileops::Basename; - sapi::InitLogging(argv[0]); - gflags::ParseCommandLineFlags(&argc, &argv, true); + absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo); + absl::ParseCommandLine(argc, argv); + absl::InitializeLog(); - if (!(argc == 3)) { + if (argc == 3) { std::cerr << "Usage:\n" << Basename(argv[0]) << " /absolute/path/to/INPUT.jsonnet /absolute/path/to/OUTPUT\n"; diff --git a/contrib/libidn2/libidn2_sapi.cc b/contrib/libidn2/libidn2_sapi.cc index 0bafc8d..9b979e6 100644 --- a/contrib/libidn2/libidn2_sapi.cc +++ b/contrib/libidn2/libidn2_sapi.cc @@ -20,7 +20,7 @@ #include #include -#include +#include "absl/log/log.h" #include "sandboxed_api/util/fileops.h" static constexpr std::size_t kMaxDomainNameLength = 256; diff --git a/contrib/libraw/example/CMakeLists.txt b/contrib/libraw/example/CMakeLists.txt index 35cebbb..7aa8a8d 100644 --- a/contrib/libraw/example/CMakeLists.txt +++ b/contrib/libraw/example/CMakeLists.txt @@ -16,9 +16,12 @@ add_executable(sapi_minilibraw main.cc ../utils/utils_libraw.cc ) -target_link_libraries(sapi_minilibraw - PRIVATE absl::strings - sapi_contrib::libraw - sapi::logging - sapi::sapi +target_link_libraries(sapi_minilibraw PRIVATE + absl::flags + absl::flags_parse + absl::log_globals + absl::log_initialize + absl::strings + sapi_contrib::libraw + sapi::sapi ) diff --git a/contrib/libraw/example/main.cc b/contrib/libraw/example/main.cc index 23962e8..03eeace 100644 --- a/contrib/libraw/example/main.cc +++ b/contrib/libraw/example/main.cc @@ -17,10 +17,12 @@ #include #include +#include "absl/flags/parse.h" +#include "absl/log/globals.h" +#include "absl/log/initialize.h" #include "absl/status/statusor.h" #include "contrib/libraw/sandboxed.h" #include "contrib/libraw/utils/utils_libraw.h" -#include "sandboxed_api/util/logging.h" void PrintUsage(const char* name) { std::cout << "Dump (small) selecton of RAW file as tab-separated text file\n" @@ -38,7 +40,10 @@ uint16_t SubtractBlack(uint16_t val, unsigned int bl) { } int main(int argc, char* argv[]) { - sapi::InitLogging(argv[0]); + absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo); + absl::ParseCommandLine(argc, argv); + absl::InitializeLog(); + if (argc < 4) { PrintUsage(argv[0]); return EXIT_FAILURE; diff --git a/contrib/libtiff/example/CMakeLists.txt b/contrib/libtiff/example/CMakeLists.txt index a55b6a5..028a83e 100644 --- a/contrib/libtiff/example/CMakeLists.txt +++ b/contrib/libtiff/example/CMakeLists.txt @@ -18,7 +18,11 @@ add_executable(sandboxed ) target_link_libraries(sandboxed PRIVATE - tiff_sapi + absl::flags + absl::flags_parse + absl::log_globals + absl::log_initialize sapi::sapi + sapi_contrib::libtiff sapi::temp_file ) diff --git a/contrib/libtiff/example/main_sandboxed.cc b/contrib/libtiff/example/main_sandboxed.cc index 4e984c9..857b030 100644 --- a/contrib/libtiff/example/main_sandboxed.cc +++ b/contrib/libtiff/example/main_sandboxed.cc @@ -19,6 +19,9 @@ #include #include "../sandboxed.h" // NOLINT(build/include) +#include "absl/flags/parse.h" +#include "absl/log/globals.h" +#include "absl/log/initialize.h" #include "sandboxed_api/util/fileops.h" #include "sandboxed_api/util/path.h" #include "sandboxed_api/vars.h" @@ -135,7 +138,9 @@ std::string GetFilePath(const std::string filename) { } // namespace int main(int argc, char* argv[]) { - gflags::ParseCommandLineFlags(&argc, &argv, true); + absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo); + absl::ParseCommandLine(argc, argv); + absl::InitializeLog(); std::string srcfile; // "test/images/quad-tile.jpg.tiff" diff --git a/contrib/libxls/example/CMakeLists.txt b/contrib/libxls/example/CMakeLists.txt index cb92b5c..5c3d3a1 100644 --- a/contrib/libxls/example/CMakeLists.txt +++ b/contrib/libxls/example/CMakeLists.txt @@ -17,9 +17,11 @@ add_executable(sapi_minixls ../utils/utils_libxls.cc ) -target_link_libraries(sapi_minixls - PRIVATE sapi_libxls - absl::flags_parse - sapi::logging - sapi::sapi +target_link_libraries(sapi_minixls PRIVATE + absl::flags + absl::flags_parse + absl::log_globals + absl::log_initialize + sapi_contrib::libxls + sapi::sapi ) diff --git a/contrib/libxls/example/main.cc b/contrib/libxls/example/main.cc index 4002f16..78db873 100644 --- a/contrib/libxls/example/main.cc +++ b/contrib/libxls/example/main.cc @@ -23,16 +23,18 @@ #include "absl/flags/flag.h" #include "absl/flags/parse.h" +#include "absl/log/globals.h" +#include "absl/log/initialize.h" #include "contrib/libxls/sandboxed.h" #include "contrib/libxls/utils/utils_libxls.h" -#include "sandboxed_api/util/logging.h" ABSL_FLAG(uint32_t, sheet, 0, "sheet number"); int main(int argc, char* argv[]) { std::string prog_name(argv[0]); + absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo); std::vector args = absl::ParseCommandLine(argc, argv); - sapi::InitLogging(argv[0]); + absl::InitializeLog(); if (args.size() != 2) { std::cerr << "Usage:\n " << prog_name << " INPUT\n"; diff --git a/contrib/libzip/example/CMakeLists.txt b/contrib/libzip/example/CMakeLists.txt index 4037c7f..922acea 100644 --- a/contrib/libzip/example/CMakeLists.txt +++ b/contrib/libzip/example/CMakeLists.txt @@ -16,8 +16,10 @@ add_executable(sapi_minizip main.cc ) target_link_libraries(sapi_minizip PRIVATE - sapi_contrib::libzip - sapi::logging - sapi::sapi + absl::flags absl::flags_parse + absl::log_globals + absl::log_initialize + sapi_contrib::libzip + sapi::sapi ) diff --git a/contrib/libzip/example/main.cc b/contrib/libzip/example/main.cc index d02ac48..5aa41c0 100644 --- a/contrib/libzip/example/main.cc +++ b/contrib/libzip/example/main.cc @@ -23,9 +23,10 @@ #include "absl/flags/flag.h" #include "absl/flags/parse.h" +#include "absl/log/globals.h" +#include "absl/log/initialize.h" #include "contrib/libzip/sandboxed.h" #include "contrib/libzip/utils/utils_zip.h" -#include "sandboxed_api/util/logging.h" ABSL_FLAG(bool, list, false, "list files"); ABSL_FLAG(std::string, unzip, "", "unzip"); @@ -84,8 +85,9 @@ absl::Status DeleteFile(LibZip& zip, const std::string& filename) { int main(int argc, char* argv[]) { std::string prog_name(argv[0]); + absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo); std::vector args = absl::ParseCommandLine(argc, argv); - sapi::InitLogging(argv[0]); + absl::InitializeLog(); if (args.size() < 2 || args.size() > 3) { std::cerr << "Usage:\n " << prog_name << " ZIPFILE [OUTFILE]\n"; diff --git a/contrib/lodepng/examples/CMakeLists.txt b/contrib/lodepng/examples/CMakeLists.txt index f50ba3d..f225909 100644 --- a/contrib/lodepng/examples/CMakeLists.txt +++ b/contrib/lodepng/examples/CMakeLists.txt @@ -20,7 +20,6 @@ if(SAPI_BUILD_EXAMPLES) ) target_link_libraries(lodepng_unsandboxed PRIVATE lodepng - sapi::logging sapi::sapi sapi::temp_file sapi::file_base @@ -35,7 +34,6 @@ if(SAPI_BUILD_EXAMPLES) ) target_link_libraries(lodepng_sandboxed PRIVATE sapi_contrib::lodepng - sapi::logging sapi::sapi sapi::temp_file sapi::fileops @@ -53,8 +51,6 @@ if(BUILD_TESTING AND SAPI_BUILD_TESTING) sapi_contrib::lodepng absl::strings absl::time - sapi::flags - sapi::logging sapi::sapi sapi::temp_file sapi::fileops diff --git a/contrib/lodepng/examples/helpers.h b/contrib/lodepng/examples/helpers.h index 08ed330..ee6359a 100644 --- a/contrib/lodepng/examples/helpers.h +++ b/contrib/lodepng/examples/helpers.h @@ -18,7 +18,7 @@ #include #include -#include +#include "absl/log/log.h" #include "sandboxed_api/util/fileops.h" #include "sandboxed_api/util/temp_file.h" diff --git a/contrib/lodepng/examples/main_sandboxed.cc b/contrib/lodepng/examples/main_sandboxed.cc index e969a72..6d02c0b 100644 --- a/contrib/lodepng/examples/main_sandboxed.cc +++ b/contrib/lodepng/examples/main_sandboxed.cc @@ -12,12 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include +#include #include "helpers.h" // NOLINT(build/include) #include "sandbox.h" // NOLINT(build/include) +#include "absl/flags/parse.h" +#include "absl/log/check.h" +#include "absl/log/globals.h" +#include "absl/log/initialize.h" #include "absl/status/statusor.h" -#include "sandboxed_api/util/logging.h" void EncodeDecodeOneStep(SapiLodepngSandbox& sandbox, LodepngApi& api) { // Generate the values. @@ -172,7 +177,9 @@ void EncodeDecodeTwoSteps(SapiLodepngSandbox& sandbox, LodepngApi& api) { } int main(int argc, char* argv[]) { - sapi::InitLogging(argv[0]); + absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo); + absl::ParseCommandLine(argc, argv); + absl::InitializeLog(); const std::string images_path = CreateTempDirAtCWD(); CHECK(sapi::file_util::fileops::Exists(images_path, false)) diff --git a/contrib/lodepng/examples/main_unsandboxed.cc b/contrib/lodepng/examples/main_unsandboxed.cc index 7882473..49d2eaf 100644 --- a/contrib/lodepng/examples/main_unsandboxed.cc +++ b/contrib/lodepng/examples/main_unsandboxed.cc @@ -12,12 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include +#include #include "helpers.h" // NOLINT(build/include) #include "lodepng.gen.h" // NOLINT(build/include) +#include "absl/flags/parse.h" +#include "absl/log/check.h" +#include "absl/log/globals.h" +#include "absl/log/initialize.h" #include "sandboxed_api/util/fileops.h" -#include "sandboxed_api/util/logging.h" #include "sandboxed_api/util/path.h" void EncodeDecodeOneStep(const std::string& images_path) { @@ -99,7 +104,9 @@ void EncodeDecodeTwoSteps(const std::string& images_path) { } int main(int argc, char* argv[]) { - sapi::InitLogging(argv[0]); + absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo); + absl::ParseCommandLine(argc, argv); + absl::InitializeLog(); const std::string images_path = CreateTempDirAtCWD(); CHECK(sapi::file_util::fileops::Exists(images_path, false)) diff --git a/contrib/pffft/CMakeLists.txt b/contrib/pffft/CMakeLists.txt index b24d5b4..0375733 100644 --- a/contrib/pffft/CMakeLists.txt +++ b/contrib/pffft/CMakeLists.txt @@ -99,10 +99,12 @@ target_include_directories(pffft_sapi INTERFACE add_executable(pffft_sandboxed main_pffft_sandboxed.cc ) -target_link_libraries(pffft_sandboxed - PRIVATE sapi_contrib::pffft - absl::flags - absl::flags_parse - sapi::logging - sapi::sapi +target_link_libraries(pffft_sandboxed PRIVATE + absl::flags + absl::flags_parse + absl::log + absl::log_globals + absl::log_initialize + sapi_contrib::pffft + sapi::sapi ) diff --git a/contrib/pffft/main_pffft_sandboxed.cc b/contrib/pffft/main_pffft_sandboxed.cc index 00f5a48..9b9f039 100644 --- a/contrib/pffft/main_pffft_sandboxed.cc +++ b/contrib/pffft/main_pffft_sandboxed.cc @@ -23,7 +23,8 @@ #include "pffft_sapi.sapi.h" // NOLINT(build/include) #include "absl/flags/flag.h" #include "absl/flags/parse.h" -#include "sandboxed_api/util/logging.h" +#include "absl/log/globals.h" +#include "absl/log/initialize.h" #include "sandboxed_api/vars.h" class PffftSapiSandbox : public PffftSandbox { @@ -178,8 +179,9 @@ absl::Status PffftMain() { } int main(int argc, char* argv[]) { + absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo); absl::ParseCommandLine(argc, argv); - sapi::InitLogging(argv[0]); + absl::InitializeLog(); if (absl::Status status = PffftMain(); !status.ok()) { LOG(ERROR) << "Initialization failed: " << status.ToString(); diff --git a/contrib/turbojpeg/tests/CMakeLists.txt b/contrib/turbojpeg/tests/CMakeLists.txt index 8a08247..9ff1e75 100644 --- a/contrib/turbojpeg/tests/CMakeLists.txt +++ b/contrib/turbojpeg/tests/CMakeLists.txt @@ -14,14 +14,15 @@ include(GoogleTest) -add_executable(turbojpeg_sapi_test turbojpeg_sapi_test.cc) - -target_link_libraries(turbojpeg_sapi_test PRIVATE - turbojpeg_sapi - sapi::logging - sapi::base - gtest - gmock +add_executable(turbojpeg_sapi_test + turbojpeg_sapi_test.cc ) -gtest_discover_tests(turbojpeg_sapi_test PROPERTIES ENVIRONMENT "TEST_FILES_DIR=${PROJECT_SOURCE_DIR}/tests") +target_link_libraries(turbojpeg_sapi_test PRIVATE + sapi_contrib::turbojpeg + sapi::test_main +) + +gtest_discover_tests(turbojpeg_sapi_test PROPERTIES + ENVIRONMENT "TEST_FILES_DIR=${PROJECT_SOURCE_DIR}/tests" +) diff --git a/contrib/turbojpeg/tests/turbojpeg_sapi_test.cc b/contrib/turbojpeg/tests/turbojpeg_sapi_test.cc index 9f56915..0a9da5f 100644 --- a/contrib/turbojpeg/tests/turbojpeg_sapi_test.cc +++ b/contrib/turbojpeg/tests/turbojpeg_sapi_test.cc @@ -22,12 +22,10 @@ #include #include -#include "gflags/gflags.h" #include "gmock/gmock.h" #include "gtest/gtest.h" #include "sandboxed_api/testing.h" #include "sandboxed_api/util/fileops.h" -#include "sandboxed_api/util/logging.h" #include "sandboxed_api/util/path.h" #include "sandboxed_api/util/status_matchers.h" #include "turbojpeg_sapi.sapi.h" // NOLINT(build/include) @@ -173,9 +171,3 @@ TEST_F(TurboJpegSapiSandboxTest, Decompressor) { ASSERT_THAT(decompress_result.value(), Eq(0)); } } // namespace - -int main(int argc, char* argv[]) { - ::sapi::InitLogging(program_invocation_short_name); - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/contrib/uriparser/example/CMakeLists.txt b/contrib/uriparser/example/CMakeLists.txt index 47aca80..d847adc 100644 --- a/contrib/uriparser/example/CMakeLists.txt +++ b/contrib/uriparser/example/CMakeLists.txt @@ -17,9 +17,11 @@ add_executable(sapi_miniuriparser ../utils/utils_uriparser.cc ) -target_link_libraries(sapi_miniuriparser - PRIVATE sapi_contrib::uriparser - sapi::logging - sapi::sapi - absl::flags_parse +target_link_libraries(sapi_miniuriparser PRIVATE + absl::flags + absl::flags_parse + absl::log_globals + absl::log_initialize + sapi_contrib::uriparser + sapi::sapi ) diff --git a/contrib/uriparser/example/main.cc b/contrib/uriparser/example/main.cc index 63555f1..50ad6c1 100644 --- a/contrib/uriparser/example/main.cc +++ b/contrib/uriparser/example/main.cc @@ -18,9 +18,10 @@ #include #include "absl/flags/parse.h" +#include "absl/log/globals.h" +#include "absl/log/initialize.h" #include "contrib/uriparser/sandboxed.h" #include "contrib/uriparser/utils/utils_uriparser.h" -#include "sandboxed_api/util/logging.h" void Print(const char* name, const absl::StatusOr& r) { if (!r.ok()) { @@ -38,8 +39,9 @@ void Print(const char* name, const absl::StatusOr& r) { int main(int argc, char* argv[]) { std::string prog_name(argv[0]); + absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo); std::vector args = absl::ParseCommandLine(argc, argv); - sapi::InitLogging(argv[0]); + absl::InitializeLog(); if (args.size() < 2) { std::cerr << "Usage:\n " << prog_name << " URI ...\n"; diff --git a/contrib/woff2/CMakeLists.txt b/contrib/woff2/CMakeLists.txt index 5096904..14991cf 100644 --- a/contrib/woff2/CMakeLists.txt +++ b/contrib/woff2/CMakeLists.txt @@ -67,11 +67,10 @@ if(BUILD_TESTING AND SAPI_BUILD_TESTING) woff2_sapi_test.cc ) target_link_libraries(woff2_sapi_test PRIVATE + absl::flags + absl::flags_parse sapi_contrib::woff2 - sapi::logging - sapi::base - gtest - gmock + sapi::test_main ) gtest_discover_tests(woff2_sapi_test PROPERTIES ENVIRONMENT "TEST_DATA_DIR=${PROJECT_SOURCE_DIR}/testdata") diff --git a/contrib/woff2/woff2_sapi_test.cc b/contrib/woff2/woff2_sapi_test.cc index 3a6278c..a798234 100644 --- a/contrib/woff2/woff2_sapi_test.cc +++ b/contrib/woff2/woff2_sapi_test.cc @@ -22,13 +22,11 @@ #include #include -#include "gflags/gflags.h" #include "gmock/gmock.h" #include "gtest/gtest.h" #include "contrib/woff2/woff2_wrapper.h" #include "sandboxed_api/testing.h" #include "sandboxed_api/util/fileops.h" -#include "sandboxed_api/util/logging.h" #include "sandboxed_api/util/path.h" #include "sandboxed_api/util/status_matchers.h" #include "woff2_sapi.sapi.h" // NOLINT(build/include) @@ -127,11 +125,5 @@ TEST_F(Woff2SapiSandboxTest, Decompress) { auto ptr = sapi::v::RemotePtr{reinterpret_cast(p.GetValue())}; ASSERT_THAT(api_->WOFF2_Free(&ptr), IsOk()); } -} // namespace -int main(int argc, char* argv[]) { - if (argc < 1) return 255; - ::sapi::InitLogging(argv[0]); - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} +} // namespace diff --git a/contrib/zopfli/example/CMakeLists.txt b/contrib/zopfli/example/CMakeLists.txt index 36f93ca..8b4751f 100644 --- a/contrib/zopfli/example/CMakeLists.txt +++ b/contrib/zopfli/example/CMakeLists.txt @@ -16,9 +16,11 @@ add_executable(sapi_minizopfli main.cc ../utils/utils_zopfli.cc ) -target_link_libraries(sapi_minizopfli - PRIVATE sapi_contrib::zopfli - sapi::logging - sapi::sapi - absl::flags_parse +target_link_libraries(sapi_minizopfli PRIVATE + absl::flags + absl::flags_parse + absl::log_globals + absl::log_initialize + sapi_contrib::zopfli + sapi::sapi ) diff --git a/contrib/zopfli/example/main.cc b/contrib/zopfli/example/main.cc index feedf03..af21542 100644 --- a/contrib/zopfli/example/main.cc +++ b/contrib/zopfli/example/main.cc @@ -21,9 +21,10 @@ #include "absl/flags/flag.h" #include "absl/flags/parse.h" +#include "absl/log/globals.h" +#include "absl/log/initialize.h" #include "contrib/zopfli/sandboxed.h" #include "contrib/zopfli/utils/utils_zopfli.h" -#include "sandboxed_api/util/logging.h" ABSL_FLAG(bool, stream, false, "stream memory to sandbox"); ABSL_FLAG(bool, zlib, false, "zlib compression"); @@ -60,8 +61,9 @@ absl::Status CompressMainFD(ZopfliApi& api, std::string& infile_s, int main(int argc, char* argv[]) { std::string prog_name(argv[0]); + absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo); std::vector args = absl::ParseCommandLine(argc, argv); - sapi::InitLogging(argv[0]); + absl::InitializeLog(); if (args.size() != 3) { std::cerr << "Usage:\n " << prog_name << " INPUT OUTPUT\n"; diff --git a/contrib/zstd/example/CMakeLists.txt b/contrib/zstd/example/CMakeLists.txt index 5c3bf1d..aa4ac30 100644 --- a/contrib/zstd/example/CMakeLists.txt +++ b/contrib/zstd/example/CMakeLists.txt @@ -17,9 +17,11 @@ add_executable(sapi_minizstd ../utils/utils_zstd.cc ) -target_link_libraries(sapi_minizstd - PRIVATE sapi_contrib::zstd - sapi::logging - sapi::sapi - absl::flags_parse +target_link_libraries(sapi_minizstd PRIVATE + absl::flags + absl::flags_parse + absl::log_globals + absl::log_initialize + sapi_contrib::zstd + sapi::sapi ) diff --git a/contrib/zstd/example/main.cc b/contrib/zstd/example/main.cc index 57ce603..156bd20 100644 --- a/contrib/zstd/example/main.cc +++ b/contrib/zstd/example/main.cc @@ -23,9 +23,10 @@ #include "absl/flags/flag.h" #include "absl/flags/parse.h" +#include "absl/log/globals.h" +#include "absl/log/initialize.h" #include "contrib/zstd/sandboxed.h" #include "contrib/zstd/utils/utils_zstd.h" -#include "sandboxed_api/util/logging.h" ABSL_FLAG(bool, stream, false, "stream data to sandbox"); ABSL_FLAG(bool, decompress, false, "decompress"); @@ -79,8 +80,9 @@ absl::Status FileDescriptor(ZstdApi& api, std::string infile_s, int main(int argc, char* argv[]) { std::string prog_name(argv[0]); + absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo); std::vector args = absl::ParseCommandLine(argc, argv); - sapi::InitLogging(argv[0]); + absl::InitializeLog(); if (args.size() != 3) { std::cerr << "Usage:\n " << prog_name << " INPUT OUTPUT\n"; diff --git a/oss-internship-2020/curl/tests/test_utils.h b/oss-internship-2020/curl/tests/test_utils.h index 5266d8a..7c0f91e 100644 --- a/oss-internship-2020/curl/tests/test_utils.h +++ b/oss-internship-2020/curl/tests/test_utils.h @@ -18,7 +18,7 @@ #include "../sandbox.h" // NOLINT(build/include) #include "curl_sapi.sapi.h" // NOLINT(build/include) #include "gtest/gtest.h" -#include "sandboxed_api/util/flag.h" +#include "absl/flags/flag.h" #include "absl/status/statusor.h" #include "sandboxed_api/util/status_matchers.h" diff --git a/oss-internship-2020/gdal/raster.cc b/oss-internship-2020/gdal/raster.cc index 7d58003..8b57b5d 100644 --- a/oss-internship-2020/gdal/raster.cc +++ b/oss-internship-2020/gdal/raster.cc @@ -18,8 +18,8 @@ #include #include -#include #include "gdal_sapi.sapi.h" // NOLINT(build/include) +#include "absl/log/log.h" #include "sandboxed_api/util/fileops.h" class GdalSapiSandbox : public GDALSandbox { diff --git a/oss-internship-2020/libarchive/examples/CMakeLists.txt b/oss-internship-2020/libarchive/examples/CMakeLists.txt index 37d1bc7..74426c9 100644 --- a/oss-internship-2020/libarchive/examples/CMakeLists.txt +++ b/oss-internship-2020/libarchive/examples/CMakeLists.txt @@ -19,7 +19,7 @@ add_library(sapi_minitar_lib STATIC ) target_link_libraries(sapi_minitar_lib PUBLIC - glog::glog + absl::log libarchive_sapi sandbox2::executor sapi::fileops diff --git a/oss-internship-2020/libarchive/ld_preload_example/CMakeLists.txt b/oss-internship-2020/libarchive/ld_preload_example/CMakeLists.txt index a5a829a..448570f 100644 --- a/oss-internship-2020/libarchive/ld_preload_example/CMakeLists.txt +++ b/oss-internship-2020/libarchive/ld_preload_example/CMakeLists.txt @@ -36,7 +36,7 @@ add_library(sapi_minitar_lib_shared SHARED ) target_link_libraries(sapi_minitar_lib_shared PUBLIC - glog::glog + absl::log libarchive_sapi sandbox2::executor sapi::fileops diff --git a/oss-internship-2020/libuv/examples/CMakeLists.txt b/oss-internship-2020/libuv/examples/CMakeLists.txt index 854eb0f..1890cd3 100644 --- a/oss-internship-2020/libuv/examples/CMakeLists.txt +++ b/oss-internship-2020/libuv/examples/CMakeLists.txt @@ -18,7 +18,6 @@ add_executable(helloworld target_link_libraries(helloworld uv_a uv_sapi - sapi::flags sapi::sapi ) diff --git a/oss-internship-2020/libuv/examples/helloworld.cc b/oss-internship-2020/libuv/examples/helloworld.cc index 9a6faf7..a42e6d3 100644 --- a/oss-internship-2020/libuv/examples/helloworld.cc +++ b/oss-internship-2020/libuv/examples/helloworld.cc @@ -18,7 +18,7 @@ #include -#include "sandboxed_api/util/flag.h" +#include "absl/flags/flag.h" #include "uv_sapi.sapi.h" // NOLINT(build/include) namespace { diff --git a/oss-internship-2020/libuv/examples/idle-basic.cc b/oss-internship-2020/libuv/examples/idle-basic.cc index 4dd2e69..cd52e38 100644 --- a/oss-internship-2020/libuv/examples/idle-basic.cc +++ b/oss-internship-2020/libuv/examples/idle-basic.cc @@ -18,7 +18,8 @@ #include -#include "sandboxed_api/util/flag.h" +#include "absl/flags/flag.h" +#include "absl/log/initialize.h" #include "uv_sapi.sapi.h" // NOLINT(build/include) namespace { @@ -102,8 +103,8 @@ absl::Status IdleBasic() { } // namespace int main(int argc, char* argv[]) { - gflags::ParseCommandLineFlags(&argc, &argv, true); - sapi::InitLogging(argv[0]); + absl::ParseCommandLine(argc, argv); + absl::InitializeLog(); if (absl::Status status = IdleBasic(); !status.ok()) { LOG(ERROR) << "IdleBasic failed: " << status.ToString(); diff --git a/oss-internship-2020/libuv/examples/uvcat.cc b/oss-internship-2020/libuv/examples/uvcat.cc index 6e82b5f..ea92b00 100644 --- a/oss-internship-2020/libuv/examples/uvcat.cc +++ b/oss-internship-2020/libuv/examples/uvcat.cc @@ -18,7 +18,7 @@ #include -#include "sandboxed_api/util/flag.h" +#include "absl/flags/flag.h" #include "uv_sapi.sapi.h" // NOLINT(build/include) namespace { diff --git a/oss-internship-2020/libuv/tests/test_array.cc b/oss-internship-2020/libuv/tests/test_array.cc index f18fd29..d96bbe4 100644 --- a/oss-internship-2020/libuv/tests/test_array.cc +++ b/oss-internship-2020/libuv/tests/test_array.cc @@ -17,7 +17,7 @@ #include #include "gtest/gtest.h" -#include "sandboxed_api/util/flag.h" +#include "absl/flags/flag.h" #include "sandboxed_api/util/status_matchers.h" #include "uv_sapi.sapi.h" // NOLINT(build/include) diff --git a/oss-internship-2020/libuv/tests/test_callback.cc b/oss-internship-2020/libuv/tests/test_callback.cc index 98cfe2d..df4632b 100644 --- a/oss-internship-2020/libuv/tests/test_callback.cc +++ b/oss-internship-2020/libuv/tests/test_callback.cc @@ -17,7 +17,7 @@ #include #include "gtest/gtest.h" -#include "sandboxed_api/util/flag.h" +#include "absl/flags/flag.h" #include "sandboxed_api/util/status_matchers.h" #include "uv_sapi.sapi.h" // NOLINT(build/include) diff --git a/oss-internship-2020/libuv/tests/test_error.cc b/oss-internship-2020/libuv/tests/test_error.cc index da7bc77..5caffa0 100644 --- a/oss-internship-2020/libuv/tests/test_error.cc +++ b/oss-internship-2020/libuv/tests/test_error.cc @@ -16,7 +16,7 @@ #include #include "gtest/gtest.h" -#include "sandboxed_api/util/flag.h" +#include "absl/flags/flag.h" #include "sandboxed_api/util/status_matchers.h" #include "uv_sapi.sapi.h" // NOLINT(build/include) diff --git a/oss-internship-2020/libuv/tests/test_loop.cc b/oss-internship-2020/libuv/tests/test_loop.cc index 5e95140..646503f 100644 --- a/oss-internship-2020/libuv/tests/test_loop.cc +++ b/oss-internship-2020/libuv/tests/test_loop.cc @@ -17,7 +17,7 @@ #include #include "gtest/gtest.h" -#include "sandboxed_api/util/flag.h" +#include "absl/flags/flag.h" #include "sandboxed_api/util/status_matchers.h" #include "uv_sapi.sapi.h" // NOLINT(build/include) diff --git a/oss-internship-2020/libuv/tests/test_os.cc b/oss-internship-2020/libuv/tests/test_os.cc index e53f664..1e5da3b 100644 --- a/oss-internship-2020/libuv/tests/test_os.cc +++ b/oss-internship-2020/libuv/tests/test_os.cc @@ -17,7 +17,7 @@ #include #include "gtest/gtest.h" -#include "sandboxed_api/util/flag.h" +#include "absl/flags/flag.h" #include "sandboxed_api/util/status_matchers.h" #include "uv_sapi.sapi.h" // NOLINT(build/include) diff --git a/sandboxed_api/BUILD.bazel b/sandboxed_api/BUILD.bazel index 501b3df..c0aa3ed 100644 --- a/sandboxed_api/BUILD.bazel +++ b/sandboxed_api/BUILD.bazel @@ -49,10 +49,8 @@ cc_library( "//sandboxed_api/util:raw_logging", "//sandboxed_api/util:strerror", "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/status", "@com_google_absl//absl/strings", "@com_google_absl//absl/synchronization", - "@com_google_glog//:glog", ], ) @@ -82,19 +80,20 @@ cc_library( "//sandboxed_api/sandbox2/util:bpf_helper", "//sandboxed_api/util:file_base", "//sandboxed_api/util:fileops", + "//sandboxed_api/util:raw_logging", "//sandboxed_api/util:runfiles", "//sandboxed_api/util:status", "@com_google_absl//absl/base", "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/base:dynamic_annotations", "@com_google_absl//absl/container:flat_hash_map", + "@com_google_absl//absl/log", "@com_google_absl//absl/status", "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/strings", "@com_google_absl//absl/strings:str_format", "@com_google_absl//absl/synchronization", "@com_google_absl//absl/time", - "@com_google_glog//:glog", ], ) @@ -154,15 +153,17 @@ cc_library( ":proto_arg_cc_proto", ":var_type", "//sandboxed_api/sandbox2:comms", + "//sandboxed_api/util:raw_logging", "//sandboxed_api/util:status", "@com_google_absl//absl/base:core_headers", + "@com_google_absl//absl/log", + "@com_google_absl//absl/log:check", "@com_google_absl//absl/status", "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/strings", "@com_google_absl//absl/strings:str_format", "@com_google_absl//absl/synchronization", "@com_google_absl//absl/utility", - "@com_google_glog//:glog", ], ) @@ -174,7 +175,6 @@ cc_library( visibility = ["//visibility:public"], deps = [ ":call", - ":config", ":lenval_core", ":proto_arg_cc_proto", ":vars", @@ -182,11 +182,13 @@ cc_library( "//sandboxed_api/sandbox2:comms", "//sandboxed_api/sandbox2:forkingclient", "//sandboxed_api/sandbox2:logsink", - "//sandboxed_api/util:flags", - "//sandboxed_api/util:logging", + "//sandboxed_api/util:raw_logging", "@com_google_absl//absl/base:dynamic_annotations", + "@com_google_absl//absl/flags:parse", + "@com_google_absl//absl/log", + "@com_google_absl//absl/log:check", + "@com_google_absl//absl/log:initialize", "@com_google_absl//absl/strings", - "@com_google_glog//:glog", "@com_google_protobuf//:protobuf", "@org_sourceware_libffi//:libffi", ], diff --git a/sandboxed_api/CMakeLists.txt b/sandboxed_api/CMakeLists.txt index 193bd08..a0f014d 100644 --- a/sandboxed_api/CMakeLists.txt +++ b/sandboxed_api/CMakeLists.txt @@ -63,7 +63,7 @@ target_link_libraries(sapi_embed_file sapi::base sapi::raw_logging sapi::status - PUBLIC glog::glog + PUBLIC absl::log ) # sandboxed_api:sapi @@ -162,7 +162,7 @@ target_link_libraries(sapi_vars sapi::proto_arg_proto sapi::status sapi::var_type - PUBLIC glog::glog + PUBLIC absl::log ) # sandboxed_api:client @@ -173,6 +173,8 @@ add_library(sapi::client ALIAS sapi_client) target_link_libraries(sapi_client PRIVATE absl::core_headers absl::dynamic_annotations + absl::flags_parse + absl::log_initialize absl::strings libffi::libffi sandbox2::client @@ -181,13 +183,12 @@ target_link_libraries(sapi_client sandbox2::logsink sapi::base sapi::call - sapi::flags sapi::lenval_core - sapi::logging sapi::proto_arg_proto sapi::vars ${CMAKE_DL_LIBS} - PUBLIC glog::glog + PUBLIC absl::check + absl::log ) if(BUILD_TESTING AND SAPI_BUILD_TESTING AND NOT CMAKE_CROSSCOMPILING) diff --git a/sandboxed_api/client.cc b/sandboxed_api/client.cc index 44ef0b7..2bae12f 100644 --- a/sandboxed_api/client.cc +++ b/sandboxed_api/client.cc @@ -22,24 +22,24 @@ #include #include -#include #include "google/protobuf/descriptor.h" #include "google/protobuf/message.h" #include "absl/base/dynamic_annotations.h" -#include "sandboxed_api/util/flag.h" +#include "absl/flags/parse.h" +#include "absl/log/check.h" +#include "absl/log/initialize.h" +#include "absl/log/log.h" #include "absl/strings/str_cat.h" #include "sandboxed_api/call.h" -#include "sandboxed_api/config.h" #include "sandboxed_api/lenval_core.h" #include "sandboxed_api/proto_arg.pb.h" +#include "sandboxed_api/proto_helper.h" #include "sandboxed_api/sandbox2/comms.h" #include "sandboxed_api/sandbox2/forkingclient.h" #include "sandboxed_api/sandbox2/logsink.h" -#include "sandboxed_api/util/logging.h" -#include "sandboxed_api/vars.h" +#include "sandboxed_api/util/raw_logging.h" #include -#include namespace sapi { namespace { @@ -56,13 +56,14 @@ ffi_type* GetFFIType(size_t size, v::Type type) { case v::Type::kFloat: if (size == sizeof(float)) { return &ffi_type_float; - } else if (size == sizeof(double)) { - return &ffi_type_double; - } else if (size == sizeof(long double)) { - return &ffi_type_longdouble; - } else { - LOG(FATAL) << "Unknown floating-point size: " << size; } + if (size == sizeof(double)) { + return &ffi_type_double; + } + if (size == sizeof(long double)) { + return &ffi_type_longdouble; + } + LOG(FATAL) << "Unsupported floating-point size: " << size; case v::Type::kInt: switch (size) { case 1: @@ -74,7 +75,7 @@ ffi_type* GetFFIType(size_t size, v::Type type) { case 8: return &ffi_type_uint64; default: - LOG(FATAL) << "Unknown integral size: " << size; + LOG(FATAL) << "Unsupported integral size: " << size; } case v::Type::kStruct: LOG(FATAL) << "Structs are not supported as function arguments"; @@ -416,15 +417,15 @@ void ServeRequest(sandbox2::Comms* comms) { } // namespace sapi ABSL_ATTRIBUTE_WEAK int main(int argc, char* argv[]) { - gflags::ParseCommandLineFlags(&argc, &argv, true); - sapi::InitLogging(argv[0]); + absl::ParseCommandLine(argc, argv); + absl::InitializeLog(); // Note regarding the FD usage here: Parent and child seem to make use of the // same FD, although this is not true. During process setup `dup2()` will be // called to replace the FD `kSandbox2ClientCommsFD`. // We do not use a new comms object here as the destructor would close our FD. - sandbox2::Comms comms{sandbox2::Comms::kDefaultConnection}; - sandbox2::ForkingClient s2client{&comms}; + sandbox2::Comms comms(sandbox2::Comms::kDefaultConnection); + sandbox2::ForkingClient s2client(&comms); // Forkserver loop. while (true) { diff --git a/sandboxed_api/embed_file.cc b/sandboxed_api/embed_file.cc index 0c8b4f1..5f8d837 100644 --- a/sandboxed_api/embed_file.cc +++ b/sandboxed_api/embed_file.cc @@ -20,9 +20,6 @@ #include #include -#include -#include "absl/status/status.h" -#include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" #include "sandboxed_api/sandbox2/util.h" #include "sandboxed_api/util/fileops.h" diff --git a/sandboxed_api/examples/stringop/BUILD.bazel b/sandboxed_api/examples/stringop/BUILD.bazel index 534aed8..e4d2dc5 100644 --- a/sandboxed_api/examples/stringop/BUILD.bazel +++ b/sandboxed_api/examples/stringop/BUILD.bazel @@ -74,9 +74,9 @@ cc_test( ":stringop_params_cc_proto", "//sandboxed_api:sapi", "//sandboxed_api:vars", - "//sandboxed_api/util:flags", "//sandboxed_api/util:status", "//sandboxed_api/util:status_matchers", + "@com_google_absl//absl/log", "@com_google_absl//absl/status", "@com_google_absl//absl/time", "@com_google_googletest//:gtest_main", diff --git a/sandboxed_api/examples/stringop/CMakeLists.txt b/sandboxed_api/examples/stringop/CMakeLists.txt index 3fe64c4..1ceb352 100644 --- a/sandboxed_api/examples/stringop/CMakeLists.txt +++ b/sandboxed_api/examples/stringop/CMakeLists.txt @@ -74,8 +74,7 @@ if(SAPI_BUILD_TESTING) target_link_libraries(sapi_main_stringop PRIVATE absl::strings absl::time - glog::glog - sapi::flags + absl::log sapi::sapi sapi::status sapi::stringop_sapi diff --git a/sandboxed_api/examples/stringop/main_stringop.cc b/sandboxed_api/examples/stringop/main_stringop.cc index fa15cea..5429d30 100644 --- a/sandboxed_api/examples/stringop/main_stringop.cc +++ b/sandboxed_api/examples/stringop/main_stringop.cc @@ -18,10 +18,9 @@ #include -#include #include "gmock/gmock.h" #include "gtest/gtest.h" -#include "sandboxed_api/util/flag.h" +#include "absl/log/log.h" #include "absl/status/status.h" #include "absl/time/time.h" #include "sandboxed_api/examples/stringop/sandbox.h" @@ -41,7 +40,7 @@ using ::testing::StrEq; // Tests using a simple transaction (and function pointers): TEST(StringopTest, ProtobufStringDuplication) { - sapi::BasicTransaction st(std::make_unique()); + sapi::BasicTransaction st(absl::make_unique()); EXPECT_THAT(st.Run([](sapi::Sandbox* sandbox) -> absl::Status { StringopApi api(sandbox); stringop::StringDuplication proto; diff --git a/sandboxed_api/examples/sum/BUILD.bazel b/sandboxed_api/examples/sum/BUILD.bazel index e4f22b3..aaabc50 100644 --- a/sandboxed_api/examples/sum/BUILD.bazel +++ b/sandboxed_api/examples/sum/BUILD.bazel @@ -35,7 +35,7 @@ cc_library( visibility = ["//visibility:public"], deps = [ ":sum_params_cc_proto", - "@com_google_glog//:glog", + "@com_google_absl//absl/log", ], alwayslink = 1, # All functions are linked into depending binaries ) @@ -82,8 +82,13 @@ cc_binary( ":sum_params_cc_proto", "//sandboxed_api:sapi", "//sandboxed_api:vars", - "//sandboxed_api/util:flags", - "//sandboxed_api/util:logging", + "@com_google_absl//absl/base:log_severity", + "@com_google_absl//absl/flags:flag", + "@com_google_absl//absl/flags:parse", + "@com_google_absl//absl/log", + "@com_google_absl//absl/log:check", + "@com_google_absl//absl/log:globals", + "@com_google_absl//absl/log:initialize", "@com_google_absl//absl/status", "@com_google_absl//absl/strings", ], diff --git a/sandboxed_api/examples/sum/CMakeLists.txt b/sandboxed_api/examples/sum/CMakeLists.txt index 6743cab..d7e9748 100644 --- a/sandboxed_api/examples/sum/CMakeLists.txt +++ b/sandboxed_api/examples/sum/CMakeLists.txt @@ -38,7 +38,7 @@ add_dependencies(sapi_sum ) target_link_libraries(sapi_sum PRIVATE $ - glog::glog + absl::log sapi::base PUBLIC protobuf::libprotobuf ) @@ -79,11 +79,12 @@ add_executable(sapi_main_sum set_target_properties(sapi_main_sum PROPERTIES OUTPUT_NAME main_sum) add_executable(sapi::main_sum ALIAS sapi_main_sum) target_link_libraries(sapi_main_sum PRIVATE + absl::log + absl::log_initialize + absl::flags + absl::flags_parse absl::strings - glog::glog sapi::base - sapi::flags - sapi::logging sapi::sapi sapi::status sapi::sum_sapi diff --git a/sandboxed_api/examples/sum/main_sum.cc b/sandboxed_api/examples/sum/main_sum.cc index 4498e8f..de11fbd 100644 --- a/sandboxed_api/examples/sum/main_sum.cc +++ b/sandboxed_api/examples/sum/main_sum.cc @@ -18,15 +18,19 @@ #include -#include -#include "sandboxed_api/util/flag.h" +#include "absl/base/log_severity.h" +#include "absl/flags/flag.h" +#include "absl/flags/parse.h" +#include "absl/log/check.h" +#include "absl/log/globals.h" +#include "absl/log/initialize.h" +#include "absl/log/log.h" #include "absl/status/status.h" #include "absl/strings/str_cat.h" #include "sandboxed_api/examples/sum/sandbox.h" #include "sandboxed_api/examples/sum/sum-sapi.sapi.h" #include "sandboxed_api/examples/sum/sum_params.pb.h" #include "sandboxed_api/transaction.h" -#include "sandboxed_api/util/logging.h" #include "sandboxed_api/vars.h" namespace { @@ -208,12 +212,13 @@ absl::Status test_addition(sapi::Sandbox* sandbox, int a, int b, int c) { } // namespace int main(int argc, char* argv[]) { - gflags::ParseCommandLineFlags(&argc, &argv, true); - sapi::InitLogging(argv[0]); + absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo); + absl::ParseCommandLine(argc, argv); + absl::InitializeLog(); absl::Status status; - sapi::BasicTransaction st{std::make_unique()}; + sapi::BasicTransaction st(std::make_unique()); // Using the simple transaction (and function pointers): CHECK(st.Run(test_addition, 1, 1, 2).ok()); CHECK(st.Run(test_addition, 1336, 1, 1337).ok()); @@ -273,10 +278,10 @@ int main(int argc, char* argv[]) { LOG(INFO) << "Final run result for violate: " << status; CHECK(status.code() == absl::StatusCode::kUnavailable); - SumTransaction sapi_timeout{std::make_unique(), + SumTransaction sapi_timeout(std::make_unique(), /*crash=*/false, /*violate=*/false, - /*time_out=*/true}; + /*time_out=*/true); status = sapi_timeout.Run(); LOG(INFO) << "Final run result for timeout: " << status; CHECK(status.code() == absl::StatusCode::kUnavailable); diff --git a/sandboxed_api/examples/sum/sum_cpp.cc b/sandboxed_api/examples/sum/sum_cpp.cc index 05bfa11..481fbc2 100644 --- a/sandboxed_api/examples/sum/sum_cpp.cc +++ b/sandboxed_api/examples/sum/sum_cpp.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include +#include "absl/log/log.h" #include "sandboxed_api/examples/sum/sum_params.pb.h" extern "C" int sumproto(const sumsapi::SumParamsProto* params) { diff --git a/sandboxed_api/examples/zlib/BUILD.bazel b/sandboxed_api/examples/zlib/BUILD.bazel index 36226f0..c465bd5 100644 --- a/sandboxed_api/examples/zlib/BUILD.bazel +++ b/sandboxed_api/examples/zlib/BUILD.bazel @@ -40,11 +40,13 @@ cc_binary( copts = sapi_platform_copts(), deps = [ ":zlib-sapi", - ":zlib-sapi_embed", "//sandboxed_api:vars", - "//sandboxed_api/util:flags", - "//sandboxed_api/util:logging", "@com_google_absl//absl/base:core_headers", + "@com_google_absl//absl/flags:flag", + "@com_google_absl//absl/flags:parse", + "@com_google_absl//absl/log", + "@com_google_absl//absl/log:globals", + "@com_google_absl//absl/log:initialize", "@com_google_absl//absl/status:statusor", ], ) diff --git a/sandboxed_api/examples/zlib/CMakeLists.txt b/sandboxed_api/examples/zlib/CMakeLists.txt index 5acd61b..5be549a 100644 --- a/sandboxed_api/examples/zlib/CMakeLists.txt +++ b/sandboxed_api/examples/zlib/CMakeLists.txt @@ -33,11 +33,12 @@ add_executable(sapi_main_zlib ) set_target_properties(sapi_main_zlib PROPERTIES OUTPUT_NAME main_zlib) target_link_libraries(sapi_main_zlib PRIVATE - absl::status sapi::base - glog::glog - sapi::flags - sapi::logging + absl::flags + absl::flags_parse + absl::log + absl::log_initialize + absl::status sapi::sapi sapi::status sapi::zlib_sapi diff --git a/sandboxed_api/examples/zlib/main_zlib.cc b/sandboxed_api/examples/zlib/main_zlib.cc index d83cb4e..9360260 100644 --- a/sandboxed_api/examples/zlib/main_zlib.cc +++ b/sandboxed_api/examples/zlib/main_zlib.cc @@ -17,12 +17,14 @@ #include -#include #include "absl/base/macros.h" -#include "sandboxed_api/util/flag.h" +#include "absl/flags/flag.h" +#include "absl/flags/parse.h" +#include "absl/log/globals.h" +#include "absl/log/initialize.h" +#include "absl/log/log.h" #include "absl/status/statusor.h" #include "sandboxed_api/examples/zlib/zlib-sapi.sapi.h" -#include "sandboxed_api/util/logging.h" #include "sandboxed_api/vars.h" // Need to define these manually, as zlib.h cannot be directly included. The @@ -38,8 +40,9 @@ #define Z_STREAM_END 1 int main(int argc, char* argv[]) { - gflags::ParseCommandLineFlags(&argc, &argv, true); - sapi::InitLogging(argv[0]); + absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo); + absl::ParseCommandLine(argc, argv); + absl::InitializeLog(); sapi::Sandbox sandbox(sapi::zlib::zlib_sapi_embed_create()); sapi::zlib::ZlibApi api(&sandbox); diff --git a/sandboxed_api/rpcchannel.cc b/sandboxed_api/rpcchannel.cc index ed2c77b..eb61665 100644 --- a/sandboxed_api/rpcchannel.cc +++ b/sandboxed_api/rpcchannel.cc @@ -14,12 +14,13 @@ #include "sandboxed_api/rpcchannel.h" -#include +#include "absl/log/log.h" #include "absl/status/statusor.h" #include "absl/strings/str_cat.h" #include "absl/synchronization/mutex.h" #include "sandboxed_api/call.h" #include "sandboxed_api/sandbox2/comms.h" +#include "sandboxed_api/util/raw_logging.h" #include "sandboxed_api/util/status_macros.h" namespace sapi { diff --git a/sandboxed_api/sandbox.cc b/sandboxed_api/sandbox.cc index 016f1ed..fb3c9bc 100644 --- a/sandboxed_api/sandbox.cc +++ b/sandboxed_api/sandbox.cc @@ -23,10 +23,10 @@ #include #include -#include #include "absl/base/casts.h" #include "absl/base/dynamic_annotations.h" #include "absl/base/macros.h" +#include "absl/log/log.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/str_cat.h" @@ -42,6 +42,7 @@ #include "sandboxed_api/sandbox2/util/bpf_helper.h" #include "sandboxed_api/util/fileops.h" #include "sandboxed_api/util/path.h" +#include "sandboxed_api/util/raw_logging.h" #include "sandboxed_api/util/runfiles.h" #include "sandboxed_api/util/status_macros.h" @@ -239,6 +240,7 @@ absl::Status Sandbox::SynchronizePtrBefore(v::Callable* ptr) { } // Cast is safe, since type is v::Type::kPointer auto* p = static_cast(ptr); + // NOLINTNEXTLINE(clang-diagnostic-deprecated-declarations) if (p->GetSyncType() == v::Pointable::kSyncNone) { return absl::OkStatus(); } @@ -252,6 +254,7 @@ absl::Status Sandbox::SynchronizePtrBefore(v::Callable* ptr) { // Allocation occurs during both before/after synchronization modes. But the // memory is transferred to the sandboxee only if v::Pointable::kSyncBefore // was requested. + // NOLINTNEXTLINE(clang-diagnostic-deprecated-declarations) if ((p->GetSyncType() & v::Pointable::kSyncBefore) == 0) { return absl::OkStatus(); } @@ -270,6 +273,7 @@ absl::Status Sandbox::SynchronizePtrAfter(v::Callable* ptr) const { return absl::OkStatus(); } v::Ptr* p = reinterpret_cast(ptr); + // NOLINTNEXTLINE(clang-diagnostic-deprecated-declarations) if ((p->GetSyncType() & v::Pointable::kSyncAfter) == 0) { return absl::OkStatus(); } diff --git a/sandboxed_api/sandbox2/BUILD.bazel b/sandboxed_api/sandbox2/BUILD.bazel index 734e724..4c89d0d 100644 --- a/sandboxed_api/sandbox2/BUILD.bazel +++ b/sandboxed_api/sandbox2/BUILD.bazel @@ -61,7 +61,7 @@ cc_test( ":util", "//sandboxed_api/sandbox2/util:bpf_helper", "//sandboxed_api/util:status_matchers", - "@com_google_glog//:glog", + "@com_google_absl//absl/log:check", "@com_google_googletest//:gtest_main", ], ) @@ -80,10 +80,10 @@ cc_library( ":util", "//sandboxed_api:config", "@com_google_absl//absl/algorithm:container", + "@com_google_absl//absl/log", "@com_google_absl//absl/strings", "@com_google_absl//absl/strings:str_format", "@com_google_absl//absl/types:span", - "@com_google_glog//:glog", ], ) @@ -129,7 +129,8 @@ cc_library( deps = [ ":comms", ":logserver_cc_proto", - "@com_google_glog//:glog", + "@com_google_absl//absl/base:log_severity", + "@com_google_absl//absl/log", ], ) @@ -142,9 +143,12 @@ cc_library( deps = [ ":comms", ":logserver_cc_proto", + "@com_google_absl//absl/log:log_entry", + "@com_google_absl//absl/log:log_sink", + "@com_google_absl//absl/log:log_sink_registry", "@com_google_absl//absl/strings", + "@com_google_absl//absl/strings:str_format", "@com_google_absl//absl/synchronization", - "@com_google_glog//:glog", ], ) @@ -157,7 +161,8 @@ cc_library( ":comms", ":logserver", ":logsink", - "@com_google_absl//absl/base:core_headers", + "//sandboxed_api/util:raw_logging", + "@com_google_absl//absl/log", "@com_google_absl//absl/strings", ], ) @@ -171,14 +176,15 @@ cc_library( ":bpfdisassembler", ":comms", ":namespace", - ":regs", ":syscall", ":violation_cc_proto", "//sandboxed_api:config", "//sandboxed_api/sandbox2/network_proxy:filtering", "//sandboxed_api/sandbox2/util:bpf_helper", - "//sandboxed_api/util:flags", + "//sandboxed_api/util:raw_logging", "@com_google_absl//absl/base:core_headers", + "@com_google_absl//absl/flags:flag", + "@com_google_absl//absl/log", "@com_google_absl//absl/types:optional", ], ) @@ -195,7 +201,7 @@ cc_library( ":util", "//sandboxed_api:config", "@com_google_absl//absl/base:core_headers", - "@com_google_glog//:glog", + "@com_google_absl//absl/log", ], ) @@ -220,8 +226,7 @@ cc_binary( ":sanitizer", "//sandboxed_api/util:raw_logging", "//sandboxed_api/util:strerror", - "@com_google_absl//absl/base:core_headers", - "@com_google_absl//absl/strings", + "@com_google_absl//absl/log:globals", ], ) @@ -245,15 +250,15 @@ cc_library( "//sandboxed_api:config", "//sandboxed_api:embed_file", "//sandboxed_api/util:fileops", - "//sandboxed_api/util:flags", "//sandboxed_api/util:raw_logging", "//sandboxed_api/util:status", "@com_google_absl//absl/base:core_headers", + "@com_google_absl//absl/flags:flag", + "@com_google_absl//absl/log", "@com_google_absl//absl/status", "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/strings", "@com_google_absl//absl/synchronization", - "@com_google_glog//:glog", ], ) @@ -286,8 +291,10 @@ cc_library( ":util", "//sandboxed_api:config", "//sandboxed_api/util:fileops", - "//sandboxed_api/util:status", + "//sandboxed_api/util:raw_logging", "@com_google_absl//absl/base:core_headers", + "@com_google_absl//absl/log", + "@com_google_absl//absl/log:check", "@com_google_absl//absl/status", "@com_google_absl//absl/strings", "@com_google_absl//absl/types:span", @@ -351,7 +358,7 @@ cc_library( "//sandboxed_api/util:file_base", "//sandboxed_api/util:file_helpers", "//sandboxed_api/util:fileops", - "//sandboxed_api/util:flags", + "//sandboxed_api/util:raw_logging", "//sandboxed_api/util:status", "//sandboxed_api/util:strerror", "//sandboxed_api/util:temp_file", @@ -359,6 +366,9 @@ cc_library( "@com_google_absl//absl/cleanup", "@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/container:flat_hash_set", + "@com_google_absl//absl/flags:flag", + "@com_google_absl//absl/log", + "@com_google_absl//absl/log:check", "@com_google_absl//absl/memory", "@com_google_absl//absl/status", "@com_google_absl//absl/status:statusor", @@ -431,13 +441,12 @@ cc_library( ":util", "//sandboxed_api/sandbox2/unwind", "//sandboxed_api/sandbox2/util:bpf_helper", - "//sandboxed_api/util:file_helpers", "//sandboxed_api/util:fileops", "//sandboxed_api/util:raw_logging", - "//sandboxed_api/util:status", "//sandboxed_api/util:strerror", "@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/container:flat_hash_set", + "@com_google_absl//absl/log", "@com_google_absl//absl/status", "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/strings", @@ -456,8 +465,9 @@ cc_library( ":comms", ":forkserver_cc_proto", "@com_google_absl//absl/base:core_headers", + "@com_google_absl//absl/log", + "@com_google_absl//absl/log:check", "@com_google_absl//absl/synchronization", - "@com_google_glog//:glog", ], ) @@ -539,6 +549,7 @@ cc_test( "//sandboxed_api/util:fileops", "//sandboxed_api/util:status_matchers", "//sandboxed_api/util:temp_file", + "@com_google_absl//absl/log", "@com_google_absl//absl/strings", "@com_google_googletest//:gtest_main", ], @@ -555,6 +566,7 @@ cc_library( ":comms", ":forkserver", ":sanitizer", + "@com_google_absl//absl/log:check", ], ) @@ -612,6 +624,7 @@ cc_test( "//sandboxed_api:config", "//sandboxed_api:testing", "//sandboxed_api/util:status_matchers", + "@com_google_absl//absl/log", "@com_google_googletest//:gtest_main", ], ) @@ -666,8 +679,9 @@ cc_test( ":comms_test_cc_proto", "//sandboxed_api/util:status_matchers", "@com_google_absl//absl/container:fixed_array", + "@com_google_absl//absl/log", + "@com_google_absl//absl/log:check", "@com_google_absl//absl/strings", - "@com_google_glog//:glog", "@com_google_googletest//:gtest_main", "@com_google_protobuf//:protobuf", ], @@ -686,8 +700,9 @@ cc_test( ":global_forkserver", ":sandbox2", "//sandboxed_api:testing", + "//sandboxed_api/util:raw_logging", + "@com_google_absl//absl/log:check", "@com_google_absl//absl/strings", - "@com_google_glog//:glog", "@com_google_googletest//:gtest_main", ], ) @@ -719,10 +734,10 @@ cc_test( tags = ["no_qemu_user_mode"], deps = [ ":comms", - ":regs", ":sandbox2", "//sandboxed_api:testing", "//sandboxed_api/sandbox2/util:bpf_helper", + "@com_google_absl//absl/log", "@com_google_absl//absl/strings", "@com_google_googletest//:gtest_main", ], @@ -771,7 +786,6 @@ cc_test( ":sandbox2", "//sandboxed_api:config", "//sandboxed_api:testing", - "//sandboxed_api/sandbox2/util:bpf_helper", "//sandboxed_api/util:status_matchers", "@com_google_absl//absl/strings", "@com_google_googletest//:gtest_main", @@ -796,6 +810,7 @@ cc_test( "//sandboxed_api/sandbox2/util:bpf_helper", "//sandboxed_api/util:status_matchers", "@com_google_absl//absl/container:flat_hash_set", + "@com_google_absl//absl/log", "@com_google_absl//absl/strings", "@com_google_googletest//:gtest_main", ], @@ -830,10 +845,11 @@ cc_test( "//sandboxed_api:testing", "//sandboxed_api/sandbox2/util:bpf_helper", "//sandboxed_api/util:fileops", - "//sandboxed_api/util:flags", "//sandboxed_api/util:status_matchers", "//sandboxed_api/util:temp_file", "@com_google_absl//absl/cleanup", + "@com_google_absl//absl/flags:flag", + "@com_google_absl//absl/flags:reflection", "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/strings", "@com_google_googletest//:gtest_main", @@ -887,10 +903,10 @@ cc_test( "//sandboxed_api:testing", "//sandboxed_api/sandbox2/util:bpf_helper", "//sandboxed_api/util:status_matchers", + "@com_google_absl//absl/log", "@com_google_absl//absl/status", "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/strings", - "@com_google_glog//:glog", "@com_google_googletest//:gtest_main", ], ) diff --git a/sandboxed_api/sandbox2/CMakeLists.txt b/sandboxed_api/sandbox2/CMakeLists.txt index b4df0fd..381d64d 100644 --- a/sandboxed_api/sandbox2/CMakeLists.txt +++ b/sandboxed_api/sandbox2/CMakeLists.txt @@ -62,7 +62,7 @@ target_link_libraries(sandbox2_syscall absl::strings sandbox2::util sapi::base - PUBLIC glog::glog + PUBLIC absl::log ) # sandboxed_api/sandbox2:result @@ -106,7 +106,7 @@ target_link_libraries(sandbox2_logserver PRIVATE sandbox2::comms sandbox2::logserver_proto sapi::base - PUBLIC glog::glog + PUBLIC absl::log ) # sandboxed_api/sandbox2:logsink @@ -121,7 +121,7 @@ target_link_libraries(sandbox2_logsink sandbox2::logserver_proto sapi::base PUBLIC absl::synchronization - glog::glog + absl::log ) # sandboxed_api/sandbox2:ipc @@ -159,7 +159,6 @@ target_link_libraries(sandbox2_policy PRIVATE sandbox2::violation_proto sapi::base sapi::config - sapi::flags ) # sandboxed_api/sandbox2:notify @@ -169,7 +168,7 @@ add_library(sandbox2_notify ${SAPI_LIB_TYPE} add_library(sandbox2::notify ALIAS sandbox2_notify) target_link_libraries(sandbox2_notify PUBLIC absl::core_headers - glog::glog + absl::log sandbox2::comms sandbox2::result sandbox2::syscall @@ -197,16 +196,13 @@ set_target_properties(sandbox2_forkserver_bin PROPERTIES OUTPUT_NAME forkserver_bin) add_executable(sandbox2::forkserver_bin ALIAS sandbox2_forkserver_bin) target_link_libraries(sandbox2_forkserver_bin PRIVATE - absl::core_headers - absl::strings + absl::log_globals sandbox2::client sandbox2::comms sandbox2::forkserver sandbox2::sanitizer - sapi::strerror sapi::base sapi::raw_logging - PUBLIC glog::glog ) # sandboxed_api/sandbox2:forkserver_bin_embed @@ -227,7 +223,7 @@ target_link_libraries(sandbox2_global_forkserver PRIVATE absl::strings absl::status absl::statusor - glog::glog + absl::log sandbox2::client sandbox2::forkserver_bin_embed sapi::strerror @@ -239,11 +235,11 @@ target_link_libraries(sandbox2_global_forkserver sapi::raw_logging sapi::status PUBLIC absl::core_headers + absl::flags absl::synchronization sandbox2::comms sandbox2::fork_client sandbox2::forkserver_proto - sapi::flags ) # sandboxed_api/sandbox2:start_global_forkserver_lib_constructor @@ -276,10 +272,10 @@ target_link_libraries(sandbox2_executor sandbox2::util sapi::base sapi::status_proto - PUBLIC absl::span + PUBLIC absl::log + absl::span absl::status absl::strings - glog::glog sapi::config sapi::fileops sapi::status @@ -317,7 +313,6 @@ target_link_libraries(sandbox2_sandbox2 sapi::config sapi::file_base sapi::fileops - sapi::flags sapi::status sapi::temp_file sandbox2::bpf_helper @@ -426,7 +421,6 @@ add_library(sandbox2::fork_client ALIAS sandbox2_fork_client) target_link_libraries(sandbox2_fork_client PRIVATE absl::core_headers absl::synchronization - glog::glog sandbox2::comms sandbox2::forkserver_proto sapi::base @@ -486,7 +480,8 @@ add_library(sandbox2_forkingclient ${SAPI_LIB_TYPE} ) add_library(sandbox2::forkingclient ALIAS sandbox2_forkingclient) target_link_libraries(sandbox2_forkingclient - PRIVATE glog::glog + PRIVATE absl::memory + absl::log sandbox2::sanitizer sapi::base PUBLIC sandbox2::client @@ -617,7 +612,7 @@ if(BUILD_TESTING AND SAPI_BUILD_TESTING) OUTPUT_NAME regs_test ) target_link_libraries(sandbox2_regs_test PRIVATE - glog::glog + absl::check sapi::config sapi::status_matchers sandbox2::bpf_helper @@ -739,14 +734,15 @@ if(BUILD_TESTING AND SAPI_BUILD_TESTING) add_executable(sandbox2_comms_test comms_test.cc ) - target_link_libraries(sandbox2_comms_test - PRIVATE absl::fixed_array - absl::strings - sandbox2::comms - sandbox2::comms_test_proto - sapi::status_matchers - sapi::test_main - PUBLIC glog::glog + target_link_libraries(sandbox2_comms_test PRIVATE + absl::check + absl::fixed_array + absl::log + absl::strings + sandbox2::comms + sandbox2::comms_test_proto + sapi::status_matchers + sapi::test_main ) gtest_discover_tests_xcompile(sandbox2_comms_test) @@ -762,11 +758,13 @@ if(BUILD_TESTING AND SAPI_BUILD_TESTING) sandbox2::testcase_minimal ) target_link_libraries(sandbox2_forkserver_test PRIVATE + absl::check absl::strings sandbox2::comms sandbox2::forkserver sandbox2::forkserver_proto sandbox2::sandbox2 + sapi::raw_logging sapi::testing sapi::test_main ) @@ -936,16 +934,16 @@ if(BUILD_TESTING AND SAPI_BUILD_TESTING) ) target_link_libraries(sandbox2_stack_trace_test PRIVATE absl::cleanup + absl::flags absl::status absl::strings sandbox2::bpf_helper - sapi::fileops sandbox2::global_forkserver sandbox2::sandbox2 + sandbox2::util + sapi::fileops sapi::temp_file sapi::testing - sandbox2::util - sapi::flags sapi::status_matchers sapi::test_main ) @@ -970,7 +968,6 @@ if(BUILD_TESTING AND SAPI_BUILD_TESTING) sandbox2::ipc sandbox2::sandbox2 sapi::testing - sapi::flags sapi::status_matchers sapi::test_main ) @@ -994,7 +991,6 @@ if(BUILD_TESTING AND SAPI_BUILD_TESTING) sandbox2::bpf_helper sandbox2::comms sapi::testing - sapi::flags sapi::status_matchers sapi::test_main PUBLIC sandbox2::sandbox2 diff --git a/sandboxed_api/sandbox2/buffer_test.cc b/sandboxed_api/sandbox2/buffer_test.cc index 71b0256..117f3e8 100644 --- a/sandboxed_api/sandbox2/buffer_test.cc +++ b/sandboxed_api/sandbox2/buffer_test.cc @@ -24,9 +24,9 @@ #include #include -#include #include "gmock/gmock.h" #include "gtest/gtest.h" +#include "absl/log/log.h" #include "sandboxed_api/config.h" #include "sandboxed_api/sandbox2/comms.h" #include "sandboxed_api/sandbox2/executor.h" diff --git a/sandboxed_api/sandbox2/comms_test.cc b/sandboxed_api/sandbox2/comms_test.cc index 3316085..b68c897 100644 --- a/sandboxed_api/sandbox2/comms_test.cc +++ b/sandboxed_api/sandbox2/comms_test.cc @@ -1,4 +1,3 @@ -// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -26,11 +25,12 @@ #include // NOLINT(build/c++11) #include -#include #include "google/protobuf/text_format.h" #include "gmock/gmock.h" #include "gtest/gtest.h" #include "absl/container/fixed_array.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/string_view.h" #include "sandboxed_api/sandbox2/comms_test.pb.h" #include "sandboxed_api/util/status_matchers.h" diff --git a/sandboxed_api/sandbox2/examples/crc4/BUILD.bazel b/sandboxed_api/sandbox2/examples/crc4/BUILD.bazel index 21c9219..90b886b 100644 --- a/sandboxed_api/sandbox2/examples/crc4/BUILD.bazel +++ b/sandboxed_api/sandbox2/examples/crc4/BUILD.bazel @@ -34,10 +34,13 @@ cc_binary( "//sandboxed_api/sandbox2", "//sandboxed_api/sandbox2:comms", "//sandboxed_api/sandbox2/util:bpf_helper", - "//sandboxed_api/util:flags", - "//sandboxed_api/util:logging", "//sandboxed_api/util:runfiles", - "@com_google_glog//:glog", + "@com_google_absl//absl/base:log_severity", + "@com_google_absl//absl/flags:flag", + "@com_google_absl//absl/flags:parse", + "@com_google_absl//absl/log", + "@com_google_absl//absl/log:globals", + "@com_google_absl//absl/log:initialize", ], ) @@ -50,8 +53,8 @@ cc_binary( "//sandboxed_api/sandbox2:client", "//sandboxed_api/sandbox2:comms", "//sandboxed_api/sandbox2:util", - "//sandboxed_api/util:flags", - "@com_google_absl//absl/base:core_headers", + "@com_google_absl//absl/flags:flag", + "@com_google_absl//absl/flags:parse", ], ) @@ -68,7 +71,7 @@ cc_test( "//sandboxed_api:testing", "//sandboxed_api/sandbox2:util", "//sandboxed_api/util:status_matchers", - "@com_google_glog//:glog", + "@com_google_absl//absl/log", "@com_google_googletest//:gtest_main", ], ) diff --git a/sandboxed_api/sandbox2/examples/crc4/CMakeLists.txt b/sandboxed_api/sandbox2/examples/crc4/CMakeLists.txt index 3f5ff52..487869b 100644 --- a/sandboxed_api/sandbox2/examples/crc4/CMakeLists.txt +++ b/sandboxed_api/sandbox2/examples/crc4/CMakeLists.txt @@ -21,13 +21,15 @@ add_dependencies(sandbox2_crc4sandbox sandbox2::crc4bin ) target_link_libraries(sandbox2_crc4sandbox PRIVATE + absl::flags + absl::flags_parse + absl::log + absl::log_initialize sandbox2::bpf_helper sandbox2::comms sapi::runfiles sandbox2::sandbox2 sapi::base - sapi::flags - sapi::logging ) # sandboxed_api/sandbox2/examples/crc4:crc4bin @@ -38,9 +40,10 @@ set_target_properties(sandbox2_crc4bin PROPERTIES OUTPUT_NAME crc4bin) add_executable(sandbox2::crc4bin ALIAS sandbox2_crc4bin) target_link_libraries(sandbox2_crc4bin PRIVATE absl::core_headers + absl::flags + absl::flags_parse sandbox2::client sandbox2::comms sandbox2::util sapi::base - sapi::flags ) diff --git a/sandboxed_api/sandbox2/examples/crc4/crc4bin.cc b/sandboxed_api/sandbox2/examples/crc4/crc4bin.cc index f55d863..1c1acf7 100644 --- a/sandboxed_api/sandbox2/examples/crc4/crc4bin.cc +++ b/sandboxed_api/sandbox2/examples/crc4/crc4bin.cc @@ -20,7 +20,8 @@ #include #include -#include "sandboxed_api/util/flag.h" +#include "absl/flags/flag.h" +#include "absl/flags/parse.h" #include "sandboxed_api/sandbox2/client.h" #include "sandboxed_api/sandbox2/comms.h" #include "sandboxed_api/sandbox2/util.h" @@ -45,7 +46,7 @@ static uint32_t ComputeCRC4Impl(const uint8_t* ptr, uint64_t len) { } int main(int argc, char* argv[]) { - gflags::ParseCommandLineFlags(&argc, &argv, false); + absl::ParseCommandLine(argc, argv); // Set-up the sandbox2::Client object, using a file descriptor (1023). sandbox2::Comms comms(sandbox2::Comms::kDefaultConnection); diff --git a/sandboxed_api/sandbox2/examples/crc4/crc4sandbox.cc b/sandboxed_api/sandbox2/examples/crc4/crc4sandbox.cc index dabfc99..a13ddd9 100644 --- a/sandboxed_api/sandbox2/examples/crc4/crc4sandbox.cc +++ b/sandboxed_api/sandbox2/examples/crc4/crc4sandbox.cc @@ -27,8 +27,12 @@ #include #include -#include -#include "sandboxed_api/util/flag.h" +#include "absl/base/log_severity.h" +#include "absl/flags/flag.h" +#include "absl/flags/parse.h" +#include "absl/log/globals.h" +#include "absl/log/initialize.h" +#include "absl/log/log.h" #include "sandboxed_api/config.h" #include "sandboxed_api/sandbox2/comms.h" #include "sandboxed_api/sandbox2/executor.h" @@ -38,12 +42,9 @@ #include "sandboxed_api/sandbox2/result.h" #include "sandboxed_api/sandbox2/sandbox2.h" #include "sandboxed_api/sandbox2/util/bpf_helper.h" -#include "sandboxed_api/util/logging.h" #include "sandboxed_api/util/runfiles.h" -using std::string; // gflags <-> Abseil Flags - -ABSL_FLAG(string, input, "", "Input to calculate CRC4 of."); +ABSL_FLAG(std::string, input, "", "Input to calculate CRC4 of."); ABSL_FLAG(bool, call_syscall_not_allowed, false, "Have sandboxee call clone (violation)."); @@ -88,8 +89,9 @@ bool SandboxedCRC4(sandbox2::Comms* comms, uint32_t* crc4) { } // namespace int main(int argc, char* argv[]) { - gflags::ParseCommandLineFlags(&argc, &argv, true); - sapi::InitLogging(argv[0]); + absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo); + absl::ParseCommandLine(argc, argv); + absl::InitializeLog(); if (absl::GetFlag(FLAGS_input).empty()) { LOG(ERROR) << "Parameter --input required."; diff --git a/sandboxed_api/sandbox2/examples/crc4/crc4sandbox_test.cc b/sandboxed_api/sandbox2/examples/crc4/crc4sandbox_test.cc index 8fe031e..5d2f362 100644 --- a/sandboxed_api/sandbox2/examples/crc4/crc4sandbox_test.cc +++ b/sandboxed_api/sandbox2/examples/crc4/crc4sandbox_test.cc @@ -18,9 +18,9 @@ #include -#include #include "gmock/gmock.h" #include "gtest/gtest.h" +#include "absl/log/log.h" #include "sandboxed_api/sandbox2/util.h" #include "sandboxed_api/testing.h" #include "sandboxed_api/util/status_matchers.h" diff --git a/sandboxed_api/sandbox2/examples/custom_fork/BUILD.bazel b/sandboxed_api/sandbox2/examples/custom_fork/BUILD.bazel index 62cd7a8..3f1167e 100644 --- a/sandboxed_api/sandbox2/examples/custom_fork/BUILD.bazel +++ b/sandboxed_api/sandbox2/examples/custom_fork/BUILD.bazel @@ -31,9 +31,13 @@ cc_binary( "//sandboxed_api/sandbox2", "//sandboxed_api/sandbox2:comms", "//sandboxed_api/sandbox2:forkserver", - "//sandboxed_api/util:flags", - "//sandboxed_api/util:logging", "//sandboxed_api/util:runfiles", + "@com_google_absl//absl/flags:flag", + "@com_google_absl//absl/flags:parse", + "@com_google_absl//absl/log", + "@com_google_absl//absl/log:check", + "@com_google_absl//absl/log:globals", + "@com_google_absl//absl/log:initialize", ], ) @@ -45,8 +49,11 @@ cc_binary( deps = [ "//sandboxed_api/sandbox2:comms", "//sandboxed_api/sandbox2:forkingclient", - "//sandboxed_api/util:flags", "//sandboxed_api/util:raw_logging", + "@com_google_absl//absl/base:log_severity", + "@com_google_absl//absl/flags:parse", + "@com_google_absl//absl/log:globals", + "@com_google_absl//absl/log:initialize", ], ) diff --git a/sandboxed_api/sandbox2/examples/custom_fork/CMakeLists.txt b/sandboxed_api/sandbox2/examples/custom_fork/CMakeLists.txt index ad8bdd0..18eb2f4 100644 --- a/sandboxed_api/sandbox2/examples/custom_fork/CMakeLists.txt +++ b/sandboxed_api/sandbox2/examples/custom_fork/CMakeLists.txt @@ -22,13 +22,16 @@ add_dependencies(sandbox2_custom_fork_sandbox ) target_link_libraries(sandbox2_custom_fork_sandbox PRIVATE absl::core_headers + absl::flags + absl::flags_parse + absl::log + absl::log_globals + absl::log_initialize sandbox2::comms sandbox2::forkserver sapi::runfiles sandbox2::sandbox2 sapi::base - sapi::flags - sapi::logging sapi::raw_logging ) @@ -41,10 +44,11 @@ set_target_properties(sandbox2_custom_fork_bin PROPERTIES ) add_executable(sandbox2::custom_fork_bin ALIAS sandbox2_custom_fork_bin) target_link_libraries(sandbox2_custom_fork_bin PRIVATE + absl::log_initialize + absl::flags_parse sandbox2::comms sandbox2::forkingclient sandbox2::util sapi::base - sapi::flags sapi::raw_logging ) diff --git a/sandboxed_api/sandbox2/examples/custom_fork/custom_fork_bin.cc b/sandboxed_api/sandbox2/examples/custom_fork/custom_fork_bin.cc index 0ccfd8b..f947f1d 100644 --- a/sandboxed_api/sandbox2/examples/custom_fork/custom_fork_bin.cc +++ b/sandboxed_api/sandbox2/examples/custom_fork/custom_fork_bin.cc @@ -20,7 +20,10 @@ #include -#include "sandboxed_api/util/flag.h" +#include "absl/base/log_severity.h" +#include "absl/flags/parse.h" +#include "absl/log/globals.h" +#include "absl/log/initialize.h" #include "sandboxed_api/sandbox2/comms.h" #include "sandboxed_api/sandbox2/forkingclient.h" #include "sandboxed_api/util/raw_logging.h" @@ -38,10 +41,11 @@ static int SandboxeeFunction(sandbox2::Comms* comms) { } int main(int argc, char* argv[]) { + absl::ParseCommandLine(argc, argv); + // Writing to stderr limits the number of invoked syscalls. - gflags::SetCommandLineOptionWithMode("logtostderr", "true", - gflags::SET_FLAG_IF_DEFAULT); - gflags::ParseCommandLineFlags(&argc, &argv, false); + absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo); + absl::InitializeLog(); // Instantiate Comms channel with the parent Executor sandbox2::Comms comms(sandbox2::Comms::kDefaultConnection); diff --git a/sandboxed_api/sandbox2/examples/custom_fork/custom_fork_sandbox.cc b/sandboxed_api/sandbox2/examples/custom_fork/custom_fork_sandbox.cc index 9a8fdfe..94dec75 100644 --- a/sandboxed_api/sandbox2/examples/custom_fork/custom_fork_sandbox.cc +++ b/sandboxed_api/sandbox2/examples/custom_fork/custom_fork_sandbox.cc @@ -23,8 +23,12 @@ #include #include -#include -#include "sandboxed_api/util/flag.h" +#include "absl/flags/flag.h" +#include "absl/flags/parse.h" +#include "absl/log/check.h" +#include "absl/log/globals.h" +#include "absl/log/initialize.h" +#include "absl/log/log.h" #include "sandboxed_api/config.h" #include "sandboxed_api/sandbox2/comms.h" #include "sandboxed_api/sandbox2/executor.h" @@ -34,7 +38,6 @@ #include "sandboxed_api/sandbox2/policybuilder.h" #include "sandboxed_api/sandbox2/result.h" #include "sandboxed_api/sandbox2/sandbox2.h" -#include "sandboxed_api/util/logging.h" #include "sandboxed_api/util/runfiles.h" std::unique_ptr GetPolicy() { @@ -93,8 +96,9 @@ static int SandboxIteration(sandbox2::ForkClient* fork_client, int32_t i) { } int main(int argc, char* argv[]) { - gflags::ParseCommandLineFlags(&argc, &argv, true); - sapi::InitLogging(argv[0]); + absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo); + absl::ParseCommandLine(argc, argv); + absl::InitializeLog(); // This test is incompatible with sanitizers. // The `SKIP_SANITIZERS_AND_COVERAGE` macro won't work for us here since we diff --git a/sandboxed_api/sandbox2/examples/network/BUILD.bazel b/sandboxed_api/sandbox2/examples/network/BUILD.bazel index dfe9598..0020694 100644 --- a/sandboxed_api/sandbox2/examples/network/BUILD.bazel +++ b/sandboxed_api/sandbox2/examples/network/BUILD.bazel @@ -34,10 +34,13 @@ cc_binary( "//sandboxed_api/sandbox2:comms", "//sandboxed_api/sandbox2/util:bpf_helper", "//sandboxed_api/util:fileops", - "//sandboxed_api/util:flags", - "//sandboxed_api/util:logging", "//sandboxed_api/util:runfiles", "@com_google_absl//absl/base:core_headers", + "@com_google_absl//absl/flags:flag", + "@com_google_absl//absl/flags:parse", + "@com_google_absl//absl/log", + "@com_google_absl//absl/log:globals", + "@com_google_absl//absl/log:initialize", ], ) @@ -49,7 +52,7 @@ cc_binary( deps = [ "//sandboxed_api/sandbox2:client", "//sandboxed_api/sandbox2:comms", - "//sandboxed_api/sandbox2:util", + "@com_google_absl//absl/log", "@com_google_absl//absl/strings:str_format", ], ) diff --git a/sandboxed_api/sandbox2/examples/network/CMakeLists.txt b/sandboxed_api/sandbox2/examples/network/CMakeLists.txt index a7ab044..8a96f07 100644 --- a/sandboxed_api/sandbox2/examples/network/CMakeLists.txt +++ b/sandboxed_api/sandbox2/examples/network/CMakeLists.txt @@ -21,14 +21,17 @@ add_dependencies(sandbox2_network_sandbox sandbox2::network_bin ) target_link_libraries(sandbox2_network_sandbox PRIVATE + absl::flags + absl::flags_parse + absl::log + absl::log_globals + absl::log_initialize sandbox2::bpf_helper sandbox2::comms sapi::fileops sapi::runfiles sandbox2::sandbox2 sapi::base - sapi::flags - sapi::logging ) # sandboxed_api/sandbox2/examples/network_bin:network_bin diff --git a/sandboxed_api/sandbox2/examples/network/network_bin.cc b/sandboxed_api/sandbox2/examples/network/network_bin.cc index 2afac93..97c1e47 100644 --- a/sandboxed_api/sandbox2/examples/network/network_bin.cc +++ b/sandboxed_api/sandbox2/examples/network/network_bin.cc @@ -22,10 +22,10 @@ #include #include +#include "absl/log/log.h" #include "absl/strings/str_format.h" #include "sandboxed_api/sandbox2/client.h" #include "sandboxed_api/sandbox2/comms.h" -#include "sandboxed_api/sandbox2/util.h" static ssize_t ReadFromFd(int fd, uint8_t* buf, size_t size) { ssize_t received = 0; @@ -73,6 +73,8 @@ int main(int argc, char* argv[]) { return 1; } - if (!CommunicationTest(client)) return 2; + if (!CommunicationTest(client)) { + return 2; + } return 0; } diff --git a/sandboxed_api/sandbox2/examples/network/network_sandbox.cc b/sandboxed_api/sandbox2/examples/network/network_sandbox.cc index f7d944f..992f358 100644 --- a/sandboxed_api/sandbox2/examples/network/network_sandbox.cc +++ b/sandboxed_api/sandbox2/examples/network/network_sandbox.cc @@ -27,9 +27,12 @@ #include #include -#include #include "absl/base/macros.h" -#include "sandboxed_api/util/flag.h" +#include "absl/flags/flag.h" +#include "absl/flags/parse.h" +#include "absl/log/globals.h" +#include "absl/log/initialize.h" +#include "absl/log/log.h" #include "sandboxed_api/config.h" #include "sandboxed_api/sandbox2/comms.h" #include "sandboxed_api/sandbox2/executor.h" @@ -38,7 +41,6 @@ #include "sandboxed_api/sandbox2/sandbox2.h" #include "sandboxed_api/sandbox2/util/bpf_helper.h" #include "sandboxed_api/util/fileops.h" -#include "sandboxed_api/util/logging.h" #include "sandboxed_api/util/runfiles.h" namespace { @@ -174,8 +176,9 @@ int main(int argc, char* argv[]) { return EXIT_SUCCESS; } - gflags::ParseCommandLineFlags(&argc, &argv, true); - sapi::InitLogging(argv[0]); + absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo); + absl::ParseCommandLine(argc, argv); + absl::InitializeLog(); int port = 8085; std::thread server_thread{Server,port}; server_thread.detach(); diff --git a/sandboxed_api/sandbox2/examples/network_proxy/BUILD.bazel b/sandboxed_api/sandbox2/examples/network_proxy/BUILD.bazel index 03b6c0d..90ab859 100644 --- a/sandboxed_api/sandbox2/examples/network_proxy/BUILD.bazel +++ b/sandboxed_api/sandbox2/examples/network_proxy/BUILD.bazel @@ -30,10 +30,13 @@ cc_binary( "//sandboxed_api/sandbox2:comms", "//sandboxed_api/sandbox2/util:bpf_helper", "//sandboxed_api/util:fileops", - "//sandboxed_api/util:flags", - "//sandboxed_api/util:logging", "//sandboxed_api/util:runfiles", "@com_google_absl//absl/base:core_headers", + "@com_google_absl//absl/flags:flag", + "@com_google_absl//absl/flags:parse", + "@com_google_absl//absl/log", + "@com_google_absl//absl/log:globals", + "@com_google_absl//absl/log:initialize", ], ) @@ -47,12 +50,15 @@ cc_binary( "//sandboxed_api/sandbox2:comms", "//sandboxed_api/sandbox2/network_proxy:client", "//sandboxed_api/util:fileops", - "//sandboxed_api/util:flags", "//sandboxed_api/util:status", - "//sandboxed_api/util:strerror", + "@com_google_absl//absl/base:log_severity", + "@com_google_absl//absl/flags:flag", + "@com_google_absl//absl/flags:parse", + "@com_google_absl//absl/log", + "@com_google_absl//absl/log:globals", + "@com_google_absl//absl/log:initialize", "@com_google_absl//absl/status", "@com_google_absl//absl/status:statusor", - "@com_google_absl//absl/strings", "@com_google_absl//absl/strings:str_format", ], ) diff --git a/sandboxed_api/sandbox2/examples/network_proxy/CMakeLists.txt b/sandboxed_api/sandbox2/examples/network_proxy/CMakeLists.txt index 53cecd5..dbe96de 100644 --- a/sandboxed_api/sandbox2/examples/network_proxy/CMakeLists.txt +++ b/sandboxed_api/sandbox2/examples/network_proxy/CMakeLists.txt @@ -21,14 +21,17 @@ add_dependencies(sandbox2_networkproxy_sandbox sandbox2::networkproxy_bin ) target_link_libraries(sandbox2_networkproxy_sandbox PRIVATE + absl::flags + absl::flags_parse + absl::log + absl::log_globals + absl::log_initialize sandbox2::bpf_helper sandbox2::comms sapi::fileops sapi::runfiles sandbox2::sandbox2 sapi::base - sapi::flags - sapi::logging ) # sandboxed_api/sandbox2/examples/networkproxy:networkproxy_bin @@ -40,6 +43,11 @@ set_target_properties(sandbox2_networkproxy_bin PROPERTIES ) add_executable(sandbox2::networkproxy_bin ALIAS sandbox2_networkproxy_bin) target_link_libraries(sandbox2_networkproxy_bin PRIVATE absl::status + absl::flags + absl::flags_parse + absl::log + absl::log_globals + absl::log_initialize absl::statusor absl::str_format sandbox2::client @@ -47,7 +55,6 @@ target_link_libraries(sandbox2_networkproxy_bin PRIVATE absl::status sapi::fileops sandbox2::network_proxy_client sapi::base - sapi::flags sapi::status sapi::strerror ) diff --git a/sandboxed_api/sandbox2/examples/network_proxy/networkproxy_bin.cc b/sandboxed_api/sandbox2/examples/network_proxy/networkproxy_bin.cc index ad2cbb9..5852aa9 100644 --- a/sandboxed_api/sandbox2/examples/network_proxy/networkproxy_bin.cc +++ b/sandboxed_api/sandbox2/examples/network_proxy/networkproxy_bin.cc @@ -11,10 +11,14 @@ #include -#include "sandboxed_api/util/flag.h" +#include "absl/base/log_severity.h" +#include "absl/flags/flag.h" +#include "absl/flags/parse.h" +#include "absl/log/globals.h" +#include "absl/log/initialize.h" +#include "absl/log/log.h" #include "absl/status/status.h" #include "absl/status/statusor.h" -#include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" #include "sandboxed_api/sandbox2/client.h" #include "sandboxed_api/sandbox2/comms.h" @@ -105,7 +109,9 @@ absl::StatusOr ConnectToServer(int port) { } // namespace int main(int argc, char* argv[]) { - gflags::ParseCommandLineFlags(&argc, &argv, false); + absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo); + absl::ParseCommandLine(argc, argv); + absl::InitializeLog(); // Set-up the sandbox2::Client object, using a file descriptor (1023). sandbox2::Comms comms(sandbox2::Comms::kDefaultConnection); diff --git a/sandboxed_api/sandbox2/examples/network_proxy/networkproxy_sandbox.cc b/sandboxed_api/sandbox2/examples/network_proxy/networkproxy_sandbox.cc index 5b4c963..e5757be 100644 --- a/sandboxed_api/sandbox2/examples/network_proxy/networkproxy_sandbox.cc +++ b/sandboxed_api/sandbox2/examples/network_proxy/networkproxy_sandbox.cc @@ -15,9 +15,12 @@ #include #include -#include #include "absl/base/macros.h" -#include "sandboxed_api/util/flag.h" +#include "absl/flags/flag.h" +#include "absl/flags/parse.h" +#include "absl/log/globals.h" +#include "absl/log/initialize.h" +#include "absl/log/log.h" #include "sandboxed_api/config.h" #include "sandboxed_api/sandbox2/comms.h" #include "sandboxed_api/sandbox2/executor.h" @@ -26,7 +29,6 @@ #include "sandboxed_api/sandbox2/sandbox2.h" #include "sandboxed_api/sandbox2/util/bpf_helper.h" #include "sandboxed_api/util/fileops.h" -#include "sandboxed_api/util/logging.h" #include "sandboxed_api/util/runfiles.h" ABSL_FLAG(bool, connect_with_handler, true, "Connect using automatic mode."); @@ -124,10 +126,11 @@ int main(int argc, char* argv[]) { return EXIT_SUCCESS; } - gflags::ParseCommandLineFlags(&argc, &argv, true); - sapi::InitLogging(argv[0]); + absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo); + absl::ParseCommandLine(argc, argv); + absl::InitializeLog(); int port = 8085; - std::thread server_thread{Server,port}; + std::thread server_thread{Server, port}; server_thread.detach(); // Note: In your own code, use sapi::GetDataDependencyFilePath() instead. diff --git a/sandboxed_api/sandbox2/examples/static/BUILD.bazel b/sandboxed_api/sandbox2/examples/static/BUILD.bazel index 6132390..5f3db29 100644 --- a/sandboxed_api/sandbox2/examples/static/BUILD.bazel +++ b/sandboxed_api/sandbox2/examples/static/BUILD.bazel @@ -34,9 +34,12 @@ cc_binary( "//sandboxed_api:config", "//sandboxed_api/sandbox2", "//sandboxed_api/sandbox2/util:bpf_helper", - "//sandboxed_api/util:flags", - "//sandboxed_api/util:logging", "//sandboxed_api/util:runfiles", + "@com_google_absl//absl/flags:flag", + "@com_google_absl//absl/flags:parse", + "@com_google_absl//absl/log", + "@com_google_absl//absl/log:globals", + "@com_google_absl//absl/log:initialize", ], ) diff --git a/sandboxed_api/sandbox2/examples/static/CMakeLists.txt b/sandboxed_api/sandbox2/examples/static/CMakeLists.txt index 0bf2bbe..c4709d4 100644 --- a/sandboxed_api/sandbox2/examples/static/CMakeLists.txt +++ b/sandboxed_api/sandbox2/examples/static/CMakeLists.txt @@ -21,12 +21,14 @@ add_dependencies(sandbox2_static_sandbox sandbox2::static_bin ) target_link_libraries(sandbox2_static_sandbox PRIVATE + absl::flags + absl::flags_parse + absl::log + absl::log_initialize sandbox2::bpf_helper sapi::runfiles sandbox2::sandbox2 sapi::base - sapi::flags - sapi::logging ) # sandboxed_api/sandbox2/examples/static:static_bin diff --git a/sandboxed_api/sandbox2/examples/static/static_sandbox.cc b/sandboxed_api/sandbox2/examples/static/static_sandbox.cc index 34067f9..2ec7968 100644 --- a/sandboxed_api/sandbox2/examples/static/static_sandbox.cc +++ b/sandboxed_api/sandbox2/examples/static/static_sandbox.cc @@ -28,8 +28,11 @@ #include #include -#include -#include "sandboxed_api/util/flag.h" +#include "absl/flags/flag.h" +#include "absl/flags/parse.h" +#include "absl/log/globals.h" +#include "absl/log/initialize.h" +#include "absl/log/log.h" #include "sandboxed_api/config.h" #include "sandboxed_api/sandbox2/executor.h" #include "sandboxed_api/sandbox2/limits.h" @@ -38,7 +41,6 @@ #include "sandboxed_api/sandbox2/result.h" #include "sandboxed_api/sandbox2/sandbox2.h" #include "sandboxed_api/sandbox2/util/bpf_helper.h" -#include "sandboxed_api/util/logging.h" #include "sandboxed_api/util/runfiles.h" std::unique_ptr GetPolicy() { @@ -126,8 +128,9 @@ int main(int argc, char* argv[]) { if constexpr (sapi::sanitizers::IsAny()) { return EXIT_SUCCESS; } - gflags::ParseCommandLineFlags(&argc, &argv, true); - sapi::InitLogging(argv[0]); + absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo); + absl::ParseCommandLine(argc, argv); + absl::InitializeLog(); // Note: In your own code, use sapi::GetDataDependencyFilePath() instead. const std::string path = sapi::internal::GetSapiDataDependencyFilePath( diff --git a/sandboxed_api/sandbox2/examples/tool/BUILD.bazel b/sandboxed_api/sandbox2/examples/tool/BUILD.bazel index 0ae2d73..6b3c940 100644 --- a/sandboxed_api/sandbox2/examples/tool/BUILD.bazel +++ b/sandboxed_api/sandbox2/examples/tool/BUILD.bazel @@ -34,8 +34,11 @@ cc_binary( "//sandboxed_api/sandbox2:util", "//sandboxed_api/sandbox2/util:bpf_helper", "//sandboxed_api/util:fileops", - "//sandboxed_api/util:flags", - "//sandboxed_api/util:logging", + "@com_google_absl//absl/flags:flag", + "@com_google_absl//absl/flags:parse", + "@com_google_absl//absl/log", + "@com_google_absl//absl/log:globals", + "@com_google_absl//absl/log:initialize", "@com_google_absl//absl/strings", "@com_google_absl//absl/strings:str_format", "@com_google_absl//absl/time", diff --git a/sandboxed_api/sandbox2/examples/tool/CMakeLists.txt b/sandboxed_api/sandbox2/examples/tool/CMakeLists.txt index 0e802d4..d4f42bf 100644 --- a/sandboxed_api/sandbox2/examples/tool/CMakeLists.txt +++ b/sandboxed_api/sandbox2/examples/tool/CMakeLists.txt @@ -19,12 +19,15 @@ add_executable(sandbox2_sandbox2tool set_target_properties(sandbox2_sandbox2tool PROPERTIES OUTPUT_NAME sandbox2tool) add_executable(sandbox2::sandbox2tool ALIAS sandbox2_sandbox2tool) target_link_libraries(sandbox2_sandbox2tool PRIVATE + absl::flags + absl::flags_parse + absl::log + absl::log_globals + absl::log_initialize absl::strings absl::time sandbox2::bpf_helper sandbox2::sandbox2 sandbox2::util sapi::base - sapi::flags - sapi::logging ) diff --git a/sandboxed_api/sandbox2/examples/tool/sandbox2tool.cc b/sandboxed_api/sandbox2/examples/tool/sandbox2tool.cc index 0d8be9c..ac9208f 100644 --- a/sandboxed_api/sandbox2/examples/tool/sandbox2tool.cc +++ b/sandboxed_api/sandbox2/examples/tool/sandbox2tool.cc @@ -34,8 +34,11 @@ #include #include -#include -#include "sandboxed_api/util/flag.h" +#include "absl/flags/flag.h" +#include "absl/flags/parse.h" +#include "absl/log/globals.h" +#include "absl/log/initialize.h" +#include "absl/log/log.h" #include "absl/strings/str_format.h" #include "absl/strings/str_split.h" #include "absl/time/time.h" @@ -49,9 +52,6 @@ #include "sandboxed_api/sandbox2/util.h" #include "sandboxed_api/sandbox2/util/bpf_helper.h" #include "sandboxed_api/util/fileops.h" -#include "sandboxed_api/util/logging.h" - -using std::string; ABSL_FLAG(bool, sandbox2tool_keep_env, false, "Keep current environment variables"); @@ -78,9 +78,9 @@ ABSL_FLAG(uint64_t, sandbox2tool_walltime_timeout, 60U, "Wall-time timeout in seconds (if >0)"); ABSL_FLAG(uint64_t, sandbox2tool_file_size_creation_limit, 1024U, "Maximum size of created files"); -ABSL_FLAG(string, sandbox2tool_cwd, "/", +ABSL_FLAG(std::string, sandbox2tool_cwd, "/", "If not empty, chdir to the directory before sandboxed"); -ABSL_FLAG(string, sandbox2tool_additional_bind_mounts, "", +ABSL_FLAG(std::string, sandbox2tool_additional_bind_mounts, "", "If user namespaces are enabled, this option will add additional " "bind mounts. Mounts are separated by comma and can optionally " "specify a target using \"=>\" " @@ -105,8 +105,9 @@ void OutputFD(int fd) { } // namespace int main(int argc, char* argv[]) { - gflags::ParseCommandLineFlags(&argc, &argv, true); - sapi::InitLogging(argv[0]); + absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo); + absl::ParseCommandLine(argc, argv); + absl::InitializeLog(); if (argc < 2) { absl::FPrintF(stderr, "Usage: %s [flags] -- cmd args...", argv[0]); diff --git a/sandboxed_api/sandbox2/examples/zlib/BUILD.bazel b/sandboxed_api/sandbox2/examples/zlib/BUILD.bazel index 5fb2c19..4494459 100644 --- a/sandboxed_api/sandbox2/examples/zlib/BUILD.bazel +++ b/sandboxed_api/sandbox2/examples/zlib/BUILD.bazel @@ -26,9 +26,12 @@ cc_binary( "//sandboxed_api/sandbox2", "//sandboxed_api/sandbox2:comms", "//sandboxed_api/sandbox2/util:bpf_helper", - "//sandboxed_api/util:flags", - "//sandboxed_api/util:logging", "//sandboxed_api/util:runfiles", + "@com_google_absl//absl/flags:flag", + "@com_google_absl//absl/flags:parse", + "@com_google_absl//absl/log", + "@com_google_absl//absl/log:globals", + "@com_google_absl//absl/log:initialize", ], ) diff --git a/sandboxed_api/sandbox2/examples/zlib/CMakeLists.txt b/sandboxed_api/sandbox2/examples/zlib/CMakeLists.txt index de3d776..c590c8c 100644 --- a/sandboxed_api/sandbox2/examples/zlib/CMakeLists.txt +++ b/sandboxed_api/sandbox2/examples/zlib/CMakeLists.txt @@ -21,13 +21,16 @@ add_dependencies(sandbox2_zpipe_sandbox sandbox2::zpipe ) target_link_libraries(sandbox2_zpipe_sandbox PRIVATE + absl::flags + absl::flags_parse + absl::log + absl::log_globals + absl::log_initialize sandbox2::bpf_helper sandbox2::comms - sapi::logging sapi::runfiles sandbox2::sandbox2 sapi::base - sapi::flags ) # sandboxed_api/sandbox2/examples/zlib:zpipe diff --git a/sandboxed_api/sandbox2/examples/zlib/zpipe_sandbox.cc b/sandboxed_api/sandbox2/examples/zlib/zpipe_sandbox.cc index 02786b7..820b6bd 100644 --- a/sandboxed_api/sandbox2/examples/zlib/zpipe_sandbox.cc +++ b/sandboxed_api/sandbox2/examples/zlib/zpipe_sandbox.cc @@ -26,8 +26,11 @@ #include #include -#include -#include "sandboxed_api/util/flag.h" +#include "absl/flags/flag.h" +#include "absl/flags/parse.h" +#include "absl/log/globals.h" +#include "absl/log/initialize.h" +#include "absl/log/log.h" #include "sandboxed_api/sandbox2/comms.h" #include "sandboxed_api/sandbox2/executor.h" #include "sandboxed_api/sandbox2/limits.h" @@ -36,13 +39,10 @@ #include "sandboxed_api/sandbox2/result.h" #include "sandboxed_api/sandbox2/sandbox2.h" #include "sandboxed_api/sandbox2/util/bpf_helper.h" -#include "sandboxed_api/util/logging.h" #include "sandboxed_api/util/runfiles.h" -using std::string; - -ABSL_FLAG(string, input, "", "Input file"); -ABSL_FLAG(string, output, "", "Output file"); +ABSL_FLAG(std::string, input, "", "Input file"); +ABSL_FLAG(std::string, output, "", "Output file"); ABSL_FLAG(bool, decompress, false, "Decompress instead of compress."); namespace { @@ -72,8 +72,9 @@ std::unique_ptr GetPolicy() { } // namespace int main(int argc, char* argv[]) { - gflags::ParseCommandLineFlags(&argc, &argv, true); - sapi::InitLogging(argv[0]); + absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo); + absl::ParseCommandLine(argc, argv); + absl::InitializeLog(); if (absl::GetFlag(FLAGS_input).empty()) { LOG(ERROR) << "Parameter --input required."; diff --git a/sandboxed_api/sandbox2/executor.cc b/sandboxed_api/sandbox2/executor.cc index b51c533..2daa5ae 100644 --- a/sandboxed_api/sandbox2/executor.cc +++ b/sandboxed_api/sandbox2/executor.cc @@ -37,6 +37,7 @@ #include "sandboxed_api/sandbox2/ipc.h" #include "sandboxed_api/sandbox2/util.h" #include "sandboxed_api/util/fileops.h" +#include "sandboxed_api/util/raw_logging.h" namespace sandbox2 { diff --git a/sandboxed_api/sandbox2/executor.h b/sandboxed_api/sandbox2/executor.h index 66a4b64..892755f 100644 --- a/sandboxed_api/sandbox2/executor.h +++ b/sandboxed_api/sandbox2/executor.h @@ -23,8 +23,9 @@ #include #include -#include #include "absl/base/macros.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/string_view.h" #include "absl/types/span.h" #include "sandboxed_api/sandbox2/fork_client.h" diff --git a/sandboxed_api/sandbox2/fork_client.cc b/sandboxed_api/sandbox2/fork_client.cc index 9cf343d..573ab7f 100644 --- a/sandboxed_api/sandbox2/fork_client.cc +++ b/sandboxed_api/sandbox2/fork_client.cc @@ -14,7 +14,8 @@ #include "sandboxed_api/sandbox2/fork_client.h" -#include +#include "absl/log/check.h" +#include "absl/log/log.h" #include "sandboxed_api/sandbox2/comms.h" #include "sandboxed_api/sandbox2/forkserver.pb.h" diff --git a/sandboxed_api/sandbox2/forkingclient.cc b/sandboxed_api/sandbox2/forkingclient.cc index 2fa1919..23c9b69 100644 --- a/sandboxed_api/sandbox2/forkingclient.cc +++ b/sandboxed_api/sandbox2/forkingclient.cc @@ -18,7 +18,7 @@ #include -#include +#include "absl/log/check.h" #include "sandboxed_api/sandbox2/sanitizer.h" namespace sandbox2 { diff --git a/sandboxed_api/sandbox2/forkserver.h b/sandboxed_api/sandbox2/forkserver.h index 3fd3389..444829d 100644 --- a/sandboxed_api/sandbox2/forkserver.h +++ b/sandboxed_api/sandbox2/forkserver.h @@ -23,7 +23,7 @@ #include #include -#include +#include "absl/log/log.h" namespace sandbox2 { diff --git a/sandboxed_api/sandbox2/forkserver_bin.cc b/sandboxed_api/sandbox2/forkserver_bin.cc index 29834c6..7952aa5 100644 --- a/sandboxed_api/sandbox2/forkserver_bin.cc +++ b/sandboxed_api/sandbox2/forkserver_bin.cc @@ -19,17 +19,15 @@ #include #include -#include "absl/base/attributes.h" -#include "absl/strings/str_cat.h" +#include "absl/log/globals.h" #include "sandboxed_api/sandbox2/comms.h" #include "sandboxed_api/sandbox2/forkserver.h" #include "sandboxed_api/sandbox2/sanitizer.h" #include "sandboxed_api/util/raw_logging.h" -#include "sandboxed_api/util/strerror.h" int main() { // Make sure the logs go stderr. - google::LogToStderr(); + absl::SetStderrThreshold(absl::LogSeverityAtLeast::kInfo); // Close all non-essential FDs to keep newly opened FD numbers consistent. absl::Status status = sandbox2::sanitizer::CloseAllFDsExcept( @@ -67,7 +65,7 @@ int main() { if (!child_pid) { // FORKSERVER_FORK sent to the global forkserver. This case does not make // sense, we thus kill the process here. - exit(0); + _Exit(0); } } } diff --git a/sandboxed_api/sandbox2/forkserver_test.cc b/sandboxed_api/sandbox2/forkserver_test.cc index 3134a8d..f7e1780 100644 --- a/sandboxed_api/sandbox2/forkserver_test.cc +++ b/sandboxed_api/sandbox2/forkserver_test.cc @@ -21,14 +21,15 @@ #include -#include #include "gtest/gtest.h" +#include "absl/log/check.h" #include "absl/strings/str_cat.h" #include "sandboxed_api/sandbox2/comms.h" #include "sandboxed_api/sandbox2/forkserver.pb.h" #include "sandboxed_api/sandbox2/global_forkclient.h" #include "sandboxed_api/sandbox2/ipc.h" #include "sandboxed_api/testing.h" +#include "sandboxed_api/util/raw_logging.h" namespace sandbox2 { @@ -36,7 +37,7 @@ using ::sapi::GetTestSourcePath; class IpcPeer { public: - explicit IpcPeer(IPC* ipc) : ipc_{ipc} {} + explicit IpcPeer(IPC* ipc) : ipc_(ipc) {} void SetUpServerSideComms(int fd) { ipc_->SetUpServerSideComms(fd); } diff --git a/sandboxed_api/sandbox2/global_forkclient.cc b/sandboxed_api/sandbox2/global_forkclient.cc index 06d7939..7198b61 100644 --- a/sandboxed_api/sandbox2/global_forkclient.cc +++ b/sandboxed_api/sandbox2/global_forkclient.cc @@ -30,8 +30,8 @@ #include #include -#include -#include "sandboxed_api/util/flag.h" +#include "absl/flags/flag.h" +#include "absl/log/log.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/ascii.h" @@ -48,12 +48,24 @@ #include "sandboxed_api/sandbox2/util.h" #include "sandboxed_api/util/fileops.h" #include "sandboxed_api/util/raw_logging.h" -#include "sandboxed_api/util/status_macros.h" namespace sandbox2 { namespace file_util = ::sapi::file_util; +namespace { + +std::string ToString(GlobalForkserverStartMode mode) { + switch (mode) { + case GlobalForkserverStartMode::kOnDemand: + return "ondemand"; + default: + return "unknown"; + } +} + +} // namespace + bool AbslParseFlag(absl::string_view text, GlobalForkserverStartModeSet* out, std::string* error) { *out = {}; @@ -72,26 +84,6 @@ bool AbslParseFlag(absl::string_view text, GlobalForkserverStartModeSet* out, return true; } -namespace { -std::string ToString(GlobalForkserverStartMode mode) { - switch (mode) { - case GlobalForkserverStartMode::kOnDemand: - return "ondemand"; - default: - return "unknown"; - } -} -bool ValidateStartMode(const char*, const std::string& flag) { - GlobalForkserverStartModeSet unused; - std::string error; - if (!AbslParseFlag(flag, &unused, &error)) { - SAPI_RAW_LOG(ERROR, "%s", error.c_str()); - return false; - } - return true; -} -} // namespace - std::string AbslUnparseFlag(GlobalForkserverStartModeSet in) { std::vector str_modes; for (size_t i = 0; i < GlobalForkserverStartModeSet::kSize; ++i) { @@ -108,22 +100,21 @@ std::string AbslUnparseFlag(GlobalForkserverStartModeSet in) { } // namespace sandbox2 -ABSL_FLAG(string, sandbox2_forkserver_binary_path, "", +ABSL_FLAG(std::string, sandbox2_forkserver_binary_path, "", "Path to forkserver_bin binary"); -ABSL_FLAG(string, sandbox2_forkserver_start_mode, "ondemand", +ABSL_FLAG(sandbox2::GlobalForkserverStartModeSet, + sandbox2_forkserver_start_mode, + sandbox2::GlobalForkserverStartModeSet( + sandbox2::GlobalForkserverStartMode::kOnDemand) + , "When Sandbox2 Forkserver process should be started"); -DEFINE_validator(sandbox2_forkserver_start_mode, &sandbox2::ValidateStartMode); namespace sandbox2 { namespace { GlobalForkserverStartModeSet GetForkserverStartMode() { - GlobalForkserverStartModeSet rv; - std::string error; - CHECK(AbslParseFlag(absl::GetFlag(FLAGS_sandbox2_forkserver_start_mode), &rv, - &error)); - return rv; + return absl::GetFlag(FLAGS_sandbox2_forkserver_start_mode); } absl::StatusOr> StartGlobalForkServer() { diff --git a/sandboxed_api/sandbox2/global_forkclient.h b/sandboxed_api/sandbox2/global_forkclient.h index 5f47f21..c9d058c 100644 --- a/sandboxed_api/sandbox2/global_forkclient.h +++ b/sandboxed_api/sandbox2/global_forkclient.h @@ -24,7 +24,7 @@ #include #include "absl/base/thread_annotations.h" -#include "sandboxed_api/util/flag.h" +#include "absl/flags/declare.h" #include "absl/strings/string_view.h" #include "absl/synchronization/mutex.h" #include "sandboxed_api/sandbox2/comms.h" @@ -106,7 +106,8 @@ std::string AbslUnparseFlag(GlobalForkserverStartModeSet in); } // namespace sandbox2 -ABSL_DECLARE_FLAG(string, sandbox2_forkserver_start_mode); -ABSL_DECLARE_FLAG(string, sandbox2_forkserver_binary_path); +ABSL_DECLARE_FLAG(sandbox2::GlobalForkserverStartModeSet, + sandbox2_forkserver_start_mode); +ABSL_DECLARE_FLAG(std::string, sandbox2_forkserver_binary_path); #endif // SANDBOXED_API_SANDBOX2_GLOBAL_FORKCLIENT_H_ diff --git a/sandboxed_api/sandbox2/ipc.cc b/sandboxed_api/sandbox2/ipc.cc index 165ebe1..f7e82c9 100644 --- a/sandboxed_api/sandbox2/ipc.cc +++ b/sandboxed_api/sandbox2/ipc.cc @@ -17,13 +17,14 @@ #include "sandboxed_api/sandbox2/ipc.h" #include -#include #include +#include -#include +#include "absl/log/log.h" #include "sandboxed_api/sandbox2/logserver.h" #include "sandboxed_api/sandbox2/logsink.h" +#include "sandboxed_api/util/raw_logging.h" namespace sandbox2 { diff --git a/sandboxed_api/sandbox2/logserver.cc b/sandboxed_api/sandbox2/logserver.cc index c853045..57fb670 100644 --- a/sandboxed_api/sandbox2/logserver.cc +++ b/sandboxed_api/sandbox2/logserver.cc @@ -16,7 +16,8 @@ #include -#include +#include "absl/base/log_severity.h" +#include "absl/log/log.h" #include "sandboxed_api/sandbox2/logserver.pb.h" namespace sandbox2 { @@ -24,18 +25,16 @@ namespace sandbox2 { LogServer::LogServer(int fd) : comms_(fd) {} void LogServer::Run() { - namespace logging = ::google; LogMessage msg; while (comms_.RecvProtoBuf(&msg)) { - logging::LogSeverity severity = msg.severity(); + absl::LogSeverity severity = absl::NormalizeLogSeverity(msg.severity()); const char* fatal_string = ""; - if (severity == logging::FATAL) { + if (severity == absl::LogSeverity::kFatal) { // We don't want to trigger an abort() in the executor for FATAL logs. - severity = logging::ERROR; + severity = absl::LogSeverity::kError; fatal_string = " FATAL"; } - logging::LogMessage log_message(msg.path().c_str(), msg.line(), severity); - log_message.stream() + LOG(LEVEL(severity)).AtLocation(msg.path().c_str(), msg.line()) << "(sandboxee " << msg.pid() << fatal_string << "): " << msg.message(); } diff --git a/sandboxed_api/sandbox2/logserver.h b/sandboxed_api/sandbox2/logserver.h index bdeddfa..5948767 100644 --- a/sandboxed_api/sandbox2/logserver.h +++ b/sandboxed_api/sandbox2/logserver.h @@ -20,7 +20,7 @@ namespace sandbox2 { // The LogServer waits for messages from the sandboxee on a given file -// descriptor and logs them using the standard base/logging facilities. +// descriptor and logs them using the standard logging facilities. class LogServer { public: explicit LogServer(int fd); diff --git a/sandboxed_api/sandbox2/logsink.cc b/sandboxed_api/sandbox2/logsink.cc index c275dfe..a59299e 100644 --- a/sandboxed_api/sandbox2/logsink.cc +++ b/sandboxed_api/sandbox2/logsink.cc @@ -17,10 +17,11 @@ #include #include -#include #include +#include "absl/log/log_sink_registry.h" #include "absl/strings/str_cat.h" +#include "absl/strings/str_format.h" #include "absl/synchronization/mutex.h" #include "sandboxed_api/sandbox2/logserver.pb.h" @@ -28,29 +29,26 @@ namespace sandbox2 { constexpr char LogSink::kLogFDName[]; -LogSink::LogSink(int fd) : comms_(fd) { AddLogSink(this); } +LogSink::LogSink(int fd) : comms_(fd) { absl::AddLogSink(this); } -LogSink::~LogSink() { RemoveLogSink(this); } +LogSink::~LogSink() { absl::RemoveLogSink(this); } -void LogSink::send(google::LogSeverity severity, const char* full_filename, - const char* base_filename, int line, - const struct tm* tm_time, const char* message, - size_t message_len) { +void LogSink::Send(const absl::LogEntry& e) { absl::MutexLock l(&lock_); LogMessage msg; - msg.set_severity(static_cast(severity)); - msg.set_path(base_filename); - msg.set_line(line); - msg.set_message(absl::StrCat(absl::string_view{message, message_len}, "\n")); + msg.set_severity(static_cast(e.log_severity())); + msg.set_path(std::string(e.source_basename())); + msg.set_line(e.source_line()); + msg.set_message(absl::StrCat(e.text_message(), "\n")); msg.set_pid(getpid()); if (!comms_.SendProtoBuf(msg)) { - std::cerr << "sending log message to supervisor failed: " << std::endl - << msg.DebugString() << std::endl; + absl::FPrintF(stderr, "sending log message to supervisor failed:\n%s\n", + e.text_message_with_prefix()); } - if (severity == google::FATAL) { + if (e.log_severity() == absl::LogSeverity::kFatal) { // Raise a SIGABRT to prevent the remaining code in logging to try to dump a // symbolized stack trace which can lead to syscall violations. kill(0, SIGABRT); diff --git a/sandboxed_api/sandbox2/logsink.h b/sandboxed_api/sandbox2/logsink.h index 5b8f78f..c4fbc96 100644 --- a/sandboxed_api/sandbox2/logsink.h +++ b/sandboxed_api/sandbox2/logsink.h @@ -15,16 +15,16 @@ #ifndef SANDBOXED_API_SANDBOX2_LOGSINK_H_ #define SANDBOXED_API_SANDBOX2_LOGSINK_H_ -#include - +#include "absl/log/log_entry.h" +#include "absl/log/log_sink.h" #include "absl/synchronization/mutex.h" #include "sandboxed_api/sandbox2/comms.h" namespace sandbox2 { -// The LogSink will register itself with the logging facilities and forward all -// log messages to the executor on a given file descriptor. -class LogSink : public google::LogSink { +// The LogSink will register itself with the facilities and forward all log +// messages to the executor on a given file descriptor. +class LogSink : public absl::LogSink { public: static constexpr char kLogFDName[] = "sb2_logsink"; @@ -34,9 +34,7 @@ class LogSink : public google::LogSink { LogSink(const LogSink&) = delete; LogSink& operator=(const LogSink&) = delete; - void send(google::LogSeverity severity, const char* full_filename, - const char* base_filename, int line, const struct tm* tm_time, - const char* message, size_t message_len) override; + void Send(const absl::LogEntry& e) override; private: Comms comms_; diff --git a/sandboxed_api/sandbox2/monitor.cc b/sandboxed_api/sandbox2/monitor.cc index 8ef8c15..16f6ef1 100644 --- a/sandboxed_api/sandbox2/monitor.cc +++ b/sandboxed_api/sandbox2/monitor.cc @@ -44,10 +44,11 @@ #include #include -#include #include "absl/cleanup/cleanup.h" #include "absl/container/flat_hash_set.h" -#include "sandboxed_api/util/flag.h" +#include "absl/flags/declare.h" +#include "absl/flags/flag.h" +#include "absl/log/log.h" #include "absl/status/status.h" #include "absl/strings/match.h" #include "absl/strings/str_cat.h" @@ -69,6 +70,7 @@ #include "sandboxed_api/sandbox2/syscall.h" #include "sandboxed_api/sandbox2/util.h" #include "sandboxed_api/util/file_helpers.h" +#include "sandboxed_api/util/raw_logging.h" #include "sandboxed_api/util/status_macros.h" #include "sandboxed_api/util/strerror.h" #include "sandboxed_api/util/temp_file.h" @@ -311,7 +313,7 @@ void Monitor::Run() { } Namespace* ns = policy_->GetNamespace(); - if (VLOG_IS_ON(1) && ns != nullptr) { + if (SAPI_VLOG_IS_ON(1) && ns != nullptr) { std::vector outside_entries; std::vector inside_entries; ns->mounts().RecursivelyListMounts( @@ -917,7 +919,7 @@ void Monitor::LogSyscallViolation(const Syscall& syscall) const { LOG(ERROR) << "SANDBOX VIOLATION : PID: " << syscall.pid() << ", PROG: '" << util::GetProgName(syscall.pid()) << "' : " << syscall.GetDescription(); - if (VLOG_IS_ON(1)) { + if (SAPI_VLOG_IS_ON(1)) { VLOG(1) << "Cmdline: " << util::GetCmdLine(syscall.pid()); VLOG(1) << "Task Name: " << util::GetProcStatusLine(syscall.pid(), "Name"); VLOG(1) << "Tgid: " << util::GetProcStatusLine(syscall.pid(), "Tgid"); @@ -1155,7 +1157,7 @@ void Monitor::StateProcessStopped(pid_t pid, int status) { if (!stack_trace.ok()) { LOG(WARNING) << "FAILED TO GET SANDBOX STACK : " << stack_trace.status(); - } else if (VLOG_IS_ON(0)) { + } else if (SAPI_VLOG_IS_ON(0)) { VLOG(0) << "SANDBOX STACK: PID: " << pid << ", ["; for (const auto& frame : *stack_trace) { VLOG(0) << " " << frame; diff --git a/sandboxed_api/sandbox2/namespace_test.cc b/sandboxed_api/sandbox2/namespace_test.cc index 91d22bd..147d833 100644 --- a/sandboxed_api/sandbox2/namespace_test.cc +++ b/sandboxed_api/sandbox2/namespace_test.cc @@ -23,9 +23,9 @@ #include #include -#include #include "gmock/gmock.h" #include "gtest/gtest.h" +#include "absl/log/log.h" #include "absl/strings/numbers.h" #include "absl/strings/str_cat.h" #include "sandboxed_api/config.h" diff --git a/sandboxed_api/sandbox2/network_proxy/BUILD.bazel b/sandboxed_api/sandbox2/network_proxy/BUILD.bazel index d95d6b2..30a93cc 100644 --- a/sandboxed_api/sandbox2/network_proxy/BUILD.bazel +++ b/sandboxed_api/sandbox2/network_proxy/BUILD.bazel @@ -29,9 +29,8 @@ cc_library( ":filtering", "//sandboxed_api/sandbox2:comms", "//sandboxed_api/util:fileops", + "@com_google_absl//absl/log", "@com_google_absl//absl/status:statusor", - "@com_google_absl//absl/strings", - "@com_google_glog//:glog", ], ) @@ -45,11 +44,10 @@ cc_library( "//sandboxed_api:config", "//sandboxed_api/sandbox2:comms", "//sandboxed_api/util:status", - "//sandboxed_api/util:strerror", + "@com_google_absl//absl/log", + "@com_google_absl//absl/log:check", "@com_google_absl//absl/status", - "@com_google_absl//absl/strings", "@com_google_absl//absl/synchronization", - "@com_google_glog//:glog", ], ) @@ -61,11 +59,10 @@ cc_library( deps = [ "//sandboxed_api/sandbox2:comms", "//sandboxed_api/util:status", - "//sandboxed_api/util:strerror", + "@com_google_absl//absl/log", "@com_google_absl//absl/status", "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/strings", - "@com_google_glog//:glog", ], ) @@ -75,9 +72,8 @@ cc_test( copts = sapi_platform_copts(), deps = [ ":filtering", - "//sandboxed_api:testing", "//sandboxed_api/util:status_matchers", - "@com_google_glog//:glog", + "@com_google_absl//absl/log:check", "@com_google_googletest//:gtest_main", ], ) diff --git a/sandboxed_api/sandbox2/network_proxy/CMakeLists.txt b/sandboxed_api/sandbox2/network_proxy/CMakeLists.txt index d960d72..7d86c40 100644 --- a/sandboxed_api/sandbox2/network_proxy/CMakeLists.txt +++ b/sandboxed_api/sandbox2/network_proxy/CMakeLists.txt @@ -37,7 +37,7 @@ target_link_libraries(sandbox2_network_proxy_filtering sapi::fileops sapi::base PUBLIC absl::statusor - glog::glog + absl::log sapi::strerror sapi::status ) @@ -49,9 +49,10 @@ add_library(sandbox2_network_proxy_client ${SAPI_LIB_TYPE} ) add_library(sandbox2::network_proxy_client ALIAS sandbox2_network_proxy_client) target_link_libraries(sandbox2_network_proxy_client PRIVATE + absl::check absl::strings absl::synchronization - glog::glog + absl::log sandbox2::comms sapi::config sapi::strerror @@ -68,6 +69,7 @@ if(BUILD_TESTING AND SAPI_BUILD_TESTING) OUTPUT_NAME filtering_test ) target_link_libraries(sandbox2_filtering_test PRIVATE + absl::check absl::strings sandbox2::network_proxy_filtering sapi::testing diff --git a/sandboxed_api/sandbox2/network_proxy/client.cc b/sandboxed_api/sandbox2/network_proxy/client.cc index 242e455..1f5a239 100644 --- a/sandboxed_api/sandbox2/network_proxy/client.cc +++ b/sandboxed_api/sandbox2/network_proxy/client.cc @@ -24,9 +24,9 @@ #include #include -#include +#include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/status/status.h" -#include "absl/strings/str_cat.h" #include "sandboxed_api/config.h" #include "sandboxed_api/util/status_macros.h" diff --git a/sandboxed_api/sandbox2/network_proxy/filtering.cc b/sandboxed_api/sandbox2/network_proxy/filtering.cc index ea6e461..f67e73c 100644 --- a/sandboxed_api/sandbox2/network_proxy/filtering.cc +++ b/sandboxed_api/sandbox2/network_proxy/filtering.cc @@ -16,7 +16,7 @@ #include -#include +#include "absl/log/log.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/match.h" diff --git a/sandboxed_api/sandbox2/network_proxy/filtering_test.cc b/sandboxed_api/sandbox2/network_proxy/filtering_test.cc index 8da3108..bc185c9 100644 --- a/sandboxed_api/sandbox2/network_proxy/filtering_test.cc +++ b/sandboxed_api/sandbox2/network_proxy/filtering_test.cc @@ -18,10 +18,9 @@ #include #include -#include #include "gmock/gmock.h" #include "gtest/gtest.h" -#include "sandboxed_api/testing.h" +#include "absl/log/check.h" #include "sandboxed_api/util/status_matchers.h" namespace sandbox2 { diff --git a/sandboxed_api/sandbox2/network_proxy/server.cc b/sandboxed_api/sandbox2/network_proxy/server.cc index fdb4fe7..93b630f 100644 --- a/sandboxed_api/sandbox2/network_proxy/server.cc +++ b/sandboxed_api/sandbox2/network_proxy/server.cc @@ -26,7 +26,7 @@ #include #include -#include +#include "absl/log/log.h" #include "absl/status/statusor.h" #include "sandboxed_api/util/fileops.h" @@ -37,7 +37,7 @@ namespace file_util = ::sapi::file_util; NetworkProxyServer::NetworkProxyServer(int fd, AllowedHosts* allowed_hosts, pthread_t monitor_thread_id) : violation_occurred_(false), - comms_{std::make_unique(fd)}, + comms_(std::make_unique(fd)), fatal_error_(false), monitor_thread_id_(monitor_thread_id), allowed_hosts_(allowed_hosts) {} diff --git a/sandboxed_api/sandbox2/notify.h b/sandboxed_api/sandbox2/notify.h index 9b4e181..8d00a7f 100644 --- a/sandboxed_api/sandbox2/notify.h +++ b/sandboxed_api/sandbox2/notify.h @@ -19,8 +19,8 @@ #include -#include #include "absl/base/attributes.h" +#include "absl/log/log.h" #include "sandboxed_api/config.h" #include "sandboxed_api/sandbox2/comms.h" #include "sandboxed_api/sandbox2/result.h" diff --git a/sandboxed_api/sandbox2/notify_test.cc b/sandboxed_api/sandbox2/notify_test.cc index 7017734..ca92dc2 100644 --- a/sandboxed_api/sandbox2/notify_test.cc +++ b/sandboxed_api/sandbox2/notify_test.cc @@ -21,9 +21,9 @@ #include #include -#include #include "gmock/gmock.h" #include "gtest/gtest.h" +#include "absl/log/log.h" #include "absl/strings/str_join.h" #include "sandboxed_api/sandbox2/comms.h" #include "sandboxed_api/sandbox2/executor.h" diff --git a/sandboxed_api/sandbox2/policy.cc b/sandboxed_api/sandbox2/policy.cc index d8bcc35..9ec1ed3 100644 --- a/sandboxed_api/sandbox2/policy.cc +++ b/sandboxed_api/sandbox2/policy.cc @@ -25,24 +25,22 @@ #include #include -#include -#include "sandboxed_api/util/flag.h" +#include "absl/flags/flag.h" +#include "absl/log/log.h" #include "sandboxed_api/config.h" #include "sandboxed_api/sandbox2/bpfdisassembler.h" #include "sandboxed_api/sandbox2/comms.h" -#include "sandboxed_api/sandbox2/regs.h" #include "sandboxed_api/sandbox2/syscall.h" #include "sandboxed_api/sandbox2/util/bpf_helper.h" +#include "sandboxed_api/util/raw_logging.h" #ifndef SECCOMP_FILTER_FLAG_NEW_LISTENER #define SECCOMP_FILTER_FLAG_NEW_LISTENER (1UL << 3) #endif -using std::string; - ABSL_FLAG(bool, sandbox2_danger_danger_permit_all, false, "Allow all syscalls, useful for testing"); -ABSL_FLAG(string, sandbox2_danger_danger_permit_all_and_log, "", +ABSL_FLAG(std::string, sandbox2_danger_danger_permit_all_and_log, "", "Allow all syscalls and log them into specified file"); namespace sandbox2 { diff --git a/sandboxed_api/sandbox2/policybuilder.cc b/sandboxed_api/sandbox2/policybuilder.cc index 9bad73e..1d6bc28 100644 --- a/sandboxed_api/sandbox2/policybuilder.cc +++ b/sandboxed_api/sandbox2/policybuilder.cc @@ -36,6 +36,7 @@ #include #include +#include "absl/log/log.h" #include "absl/memory/memory.h" #include "absl/status/status.h" #include "absl/status/statusor.h" diff --git a/sandboxed_api/sandbox2/policybuilder.h b/sandboxed_api/sandbox2/policybuilder.h index 01a7330..d363440 100644 --- a/sandboxed_api/sandbox2/policybuilder.h +++ b/sandboxed_api/sandbox2/policybuilder.h @@ -26,9 +26,9 @@ #include #include -#include #include "absl/base/macros.h" #include "absl/container/flat_hash_set.h" +#include "absl/log/check.h" #include "absl/status/statusor.h" #include "absl/strings/string_view.h" #include "absl/types/span.h" diff --git a/sandboxed_api/sandbox2/policybuilder_test.cc b/sandboxed_api/sandbox2/policybuilder_test.cc index 505c0d8..fb2d2af 100644 --- a/sandboxed_api/sandbox2/policybuilder_test.cc +++ b/sandboxed_api/sandbox2/policybuilder_test.cc @@ -21,9 +21,9 @@ #include #include -#include #include "gmock/gmock.h" #include "gtest/gtest.h" +#include "absl/log/log.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/match.h" diff --git a/sandboxed_api/sandbox2/regs_test.cc b/sandboxed_api/sandbox2/regs_test.cc index 850e7fc..45caa2a 100644 --- a/sandboxed_api/sandbox2/regs_test.cc +++ b/sandboxed_api/sandbox2/regs_test.cc @@ -12,9 +12,9 @@ #include #include -#include #include "gmock/gmock.h" #include "gtest/gtest.h" +#include "absl/log/check.h" #include "sandboxed_api/sandbox2/sanitizer.h" #include "sandboxed_api/sandbox2/util.h" #include "sandboxed_api/sandbox2/util/bpf_helper.h" diff --git a/sandboxed_api/sandbox2/sandbox2.cc b/sandboxed_api/sandbox2/sandbox2.cc index 814e6bb..b0f472a 100644 --- a/sandboxed_api/sandbox2/sandbox2.cc +++ b/sandboxed_api/sandbox2/sandbox2.cc @@ -20,11 +20,13 @@ #include #include +#include "absl/log/check.h" #include "absl/status/statusor.h" #include "absl/synchronization/mutex.h" #include "absl/time/time.h" #include "sandboxed_api/sandbox2/monitor.h" #include "sandboxed_api/sandbox2/result.h" +#include "sandboxed_api/util/raw_logging.h" namespace sandbox2 { diff --git a/sandboxed_api/sandbox2/sandbox2.h b/sandboxed_api/sandbox2/sandbox2.h index fdf61cb..cf80b72 100644 --- a/sandboxed_api/sandbox2/sandbox2.h +++ b/sandboxed_api/sandbox2/sandbox2.h @@ -23,8 +23,8 @@ #include // NOLINT(build/c++11) #include -#include #include "absl/base/macros.h" +#include "absl/log/log.h" #include "absl/status/statusor.h" #include "absl/synchronization/mutex.h" #include "sandboxed_api/sandbox2/comms.h" diff --git a/sandboxed_api/sandbox2/sanitizer_test.cc b/sandboxed_api/sandbox2/sanitizer_test.cc index 38bd473..ffd5ac8 100644 --- a/sandboxed_api/sandbox2/sanitizer_test.cc +++ b/sandboxed_api/sandbox2/sanitizer_test.cc @@ -24,10 +24,10 @@ #include #include -#include #include "gmock/gmock.h" #include "gtest/gtest.h" #include "absl/container/flat_hash_set.h" +#include "absl/log/log.h" #include "absl/strings/numbers.h" #include "absl/strings/str_cat.h" #include "sandboxed_api/sandbox2/comms.h" diff --git a/sandboxed_api/sandbox2/stack_trace.cc b/sandboxed_api/sandbox2/stack_trace.cc index e4b2f91..ae5d6a4 100644 --- a/sandboxed_api/sandbox2/stack_trace.cc +++ b/sandboxed_api/sandbox2/stack_trace.cc @@ -23,9 +23,9 @@ #include #include -#include #include "absl/cleanup/cleanup.h" -#include "sandboxed_api/util/flag.h" +#include "absl/flags/flag.h" +#include "absl/log/log.h" #include "absl/memory/memory.h" #include "absl/status/status.h" #include "absl/strings/numbers.h" @@ -47,6 +47,7 @@ #include "sandboxed_api/sandbox2/util/bpf_helper.h" #include "sandboxed_api/util/fileops.h" #include "sandboxed_api/util/path.h" +#include "sandboxed_api/util/raw_logging.h" #include "sandboxed_api/util/status_macros.h" ABSL_FLAG(bool, sandbox_disable_all_stack_traces, false, diff --git a/sandboxed_api/sandbox2/stack_trace_test.cc b/sandboxed_api/sandbox2/stack_trace_test.cc index 3681386..3559b1a 100644 --- a/sandboxed_api/sandbox2/stack_trace_test.cc +++ b/sandboxed_api/sandbox2/stack_trace_test.cc @@ -25,7 +25,9 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" #include "absl/cleanup/cleanup.h" -#include "sandboxed_api/util/flag.h" +#include "absl/flags/declare.h" +#include "absl/flags/flag.h" +#include "absl/flags/reflection.h" #include "absl/strings/match.h" #include "absl/strings/str_cat.h" #include "sandboxed_api/sandbox2/executor.h" @@ -55,24 +57,6 @@ using ::testing::IsEmpty; using ::testing::IsTrue; using ::testing::Not; -// Temporarily overrides a flag, restores the original flag value when it goes -// out of scope. -template -class TemporaryFlagOverride { - public: - using Flag = T; - TemporaryFlagOverride(Flag* flag, T value) - : flag_(flag), original_value_(absl::GetFlag(*flag)) { - absl::SetFlag(flag, value); - } - - ~TemporaryFlagOverride() { absl::SetFlag(flag_, original_value_); } - - private: - Flag* flag_; - T original_value_; -}; - // Test that symbolization of stack traces works. void SymbolizationWorksCommon( const std::function& modify_policy) { @@ -108,30 +92,34 @@ void SymbolizationWorksCommon( TEST(StackTraceTest, SymbolizationWorksNonSandboxedLibunwind) { SKIP_SANITIZERS_AND_COVERAGE; - TemporaryFlagOverride temp_override( - &FLAGS_sandbox_libunwind_crash_handler, false); + absl::FlagSaver fs; + absl::SetFlag(&FLAGS_sandbox_libunwind_crash_handler, false); + SymbolizationWorksCommon([](PolicyBuilder*) {}); } TEST(StackTraceTest, SymbolizationWorksSandboxedLibunwind) { SKIP_SANITIZERS_AND_COVERAGE; - TemporaryFlagOverride temp_override( - &FLAGS_sandbox_libunwind_crash_handler, true); + absl::FlagSaver fs; + absl::SetFlag(&FLAGS_sandbox_libunwind_crash_handler, true); + SymbolizationWorksCommon([](PolicyBuilder*) {}); } TEST(StackTraceTest, SymbolizationWorksSandboxedLibunwindProcDirMounted) { SKIP_SANITIZERS_AND_COVERAGE; - TemporaryFlagOverride temp_override( - &FLAGS_sandbox_libunwind_crash_handler, true); + absl::FlagSaver fs; + absl::SetFlag(&FLAGS_sandbox_libunwind_crash_handler, true); + SymbolizationWorksCommon( [](PolicyBuilder* builder) { builder->AddDirectory("/proc"); }); } TEST(StackTraceTest, SymbolizationWorksSandboxedLibunwindProcFileMounted) { SKIP_SANITIZERS_AND_COVERAGE; - TemporaryFlagOverride temp_override( - &FLAGS_sandbox_libunwind_crash_handler, true); + absl::FlagSaver fs; + absl::SetFlag(&FLAGS_sandbox_libunwind_crash_handler, true); + SymbolizationWorksCommon([](PolicyBuilder* builder) { builder->AddFile("/proc/sys/vm/overcommit_memory"); }); @@ -139,16 +127,18 @@ TEST(StackTraceTest, SymbolizationWorksSandboxedLibunwindProcFileMounted) { TEST(StackTraceTest, SymbolizationWorksSandboxedLibunwindSysDirMounted) { SKIP_SANITIZERS_AND_COVERAGE; - TemporaryFlagOverride temp_override( - &FLAGS_sandbox_libunwind_crash_handler, true); + absl::FlagSaver fs; + absl::SetFlag(&FLAGS_sandbox_libunwind_crash_handler, true); + SymbolizationWorksCommon( [](PolicyBuilder* builder) { builder->AddDirectory("/sys"); }); } TEST(StackTraceTest, SymbolizationWorksSandboxedLibunwindSysFileMounted) { SKIP_SANITIZERS_AND_COVERAGE; - TemporaryFlagOverride temp_override( - &FLAGS_sandbox_libunwind_crash_handler, true); + absl::FlagSaver fs; + absl::SetFlag(&FLAGS_sandbox_libunwind_crash_handler, true); + SymbolizationWorksCommon([](PolicyBuilder* builder) { builder->AddFile("/sys/devices/system/cpu/online"); }); @@ -163,8 +153,8 @@ static size_t FileCountInDirectory(const std::string& path) { TEST(StackTraceTest, ForkEnterNsLibunwindDoesNotLeakFDs) { SKIP_SANITIZERS_AND_COVERAGE; - TemporaryFlagOverride temp_override( - &FLAGS_sandbox_libunwind_crash_handler, true); + absl::FlagSaver fs; + absl::SetFlag(&FLAGS_sandbox_libunwind_crash_handler, true); // Very first sanitization might create some fds (e.g. for initial // namespaces). diff --git a/sandboxed_api/sandbox2/syscall.cc b/sandboxed_api/sandbox2/syscall.cc index c83f57c..581322a 100644 --- a/sandboxed_api/sandbox2/syscall.cc +++ b/sandboxed_api/sandbox2/syscall.cc @@ -22,7 +22,6 @@ #include #include -#include #include "absl/strings/str_format.h" #include "absl/strings/str_join.h" #include "sandboxed_api/config.h" diff --git a/sandboxed_api/sandbox2/syscall_defs.cc b/sandboxed_api/sandbox2/syscall_defs.cc index d737b50..eada2cd 100644 --- a/sandboxed_api/sandbox2/syscall_defs.cc +++ b/sandboxed_api/sandbox2/syscall_defs.cc @@ -3,8 +3,8 @@ #include #include -#include #include "absl/algorithm/container.h" +#include "absl/log/log.h" #include "absl/strings/escaping.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" diff --git a/sandboxed_api/sandbox2/testcases/BUILD.bazel b/sandboxed_api/sandbox2/testcases/BUILD.bazel index 6e7ab7b..c30314f 100644 --- a/sandboxed_api/sandbox2/testcases/BUILD.bazel +++ b/sandboxed_api/sandbox2/testcases/BUILD.bazel @@ -152,8 +152,8 @@ cc_binary( deps = [ "//sandboxed_api/sandbox2:sanitizer", "@com_google_absl//absl/container:flat_hash_set", + "@com_google_absl//absl/log:check", "@com_google_absl//absl/strings", - "@com_google_glog//:glog", ], ) diff --git a/sandboxed_api/sandbox2/testcases/CMakeLists.txt b/sandboxed_api/sandbox2/testcases/CMakeLists.txt index 2cb0501..f20a5ac 100644 --- a/sandboxed_api/sandbox2/testcases/CMakeLists.txt +++ b/sandboxed_api/sandbox2/testcases/CMakeLists.txt @@ -186,9 +186,9 @@ set_target_properties(sandbox2_testcase_close_fds PROPERTIES ) target_link_libraries(sandbox2_testcase_close_fds PRIVATE sapi::base + absl::check absl::strings absl::flat_hash_set - glog::glog sandbox2::sanitizer ) diff --git a/sandboxed_api/sandbox2/testcases/close_fds.cc b/sandboxed_api/sandbox2/testcases/close_fds.cc index b106564..156a8aa 100644 --- a/sandboxed_api/sandbox2/testcases/close_fds.cc +++ b/sandboxed_api/sandbox2/testcases/close_fds.cc @@ -4,8 +4,8 @@ #include -#include #include "absl/container/flat_hash_set.h" +#include "absl/log/check.h" #include "absl/strings/numbers.h" #include "sandboxed_api/sandbox2/sanitizer.h" diff --git a/sandboxed_api/tools/clang_generator/generator.cc b/sandboxed_api/tools/clang_generator/generator.cc index 20b3680..a14381e 100644 --- a/sandboxed_api/tools/clang_generator/generator.cc +++ b/sandboxed_api/tools/clang_generator/generator.cc @@ -106,6 +106,7 @@ bool GeneratorFactory::runInvocation( // TODO(b/222241644): Figure out how to deal with intrinsics properly // Note: The definitions below just need to parse, they don't need to // compile into useful code. + "__builtin_ia32_cvtsbf162ss_32=[](auto)->long long{return 0;}", "__builtin_ia32_paddsb128=", "__builtin_ia32_paddsb256=", "__builtin_ia32_paddsb512=", diff --git a/sandboxed_api/transaction.h b/sandboxed_api/transaction.h index 499925d..bff3751 100644 --- a/sandboxed_api/transaction.h +++ b/sandboxed_api/transaction.h @@ -17,7 +17,7 @@ #include -#include +#include "absl/log/log.h" #include "absl/status/status.h" #include "absl/strings/str_cat.h" #include "absl/time/time.h" diff --git a/sandboxed_api/util/BUILD.bazel b/sandboxed_api/util/BUILD.bazel index d33f97c..c21ba25 100644 --- a/sandboxed_api/util/BUILD.bazel +++ b/sandboxed_api/util/BUILD.bazel @@ -95,26 +95,6 @@ cc_test( ], ) -# Compatibility layer for Abseil's flags vs. gFlags -cc_library( - name = "flags", - hdrs = ["flag.h"], - copts = sapi_platform_copts(), - deps = ["@com_github_gflags_gflags//:gflags"], -) - -# Transitional library that helps configure glog with Abseil flags to -# avoid a dependency on gflags. -cc_library( - name = "logging", - srcs = ["logging.cc"], - hdrs = ["logging.h"], - copts = sapi_platform_copts(), - deps = [ - "@com_google_glog//:glog", - ], -) - # Small support library emulating verbose logging using Abseil's raw logging # facility. cc_library( @@ -141,7 +121,6 @@ cc_library( visibility = ["//visibility:public"], deps = [ ":file_base", - ":flags", ":raw_logging", "@bazel_tools//tools/cpp/runfiles", "@com_google_absl//absl/strings", diff --git a/sandboxed_api/util/CMakeLists.txt b/sandboxed_api/util/CMakeLists.txt index 2612290..df8172d 100644 --- a/sandboxed_api/util/CMakeLists.txt +++ b/sandboxed_api/util/CMakeLists.txt @@ -47,29 +47,6 @@ target_link_libraries(sapi_util_fileops PRIVATE sapi::base ) -# sandboxed_api/util:flag -add_library(sapi_util_flags ${SAPI_LIB_TYPE} - flag.h - "${SAPI_BINARY_DIR}/sapi_force_cxx_linkage.cc" -) -add_library(sapi::flags ALIAS sapi_util_flags) -target_link_libraries(sapi_util_flags PUBLIC - glog::glog - gflags::gflags -) - -# sandboxed_api/util:logging -add_library(sapi_util_logging ${SAPI_LIB_TYPE} - logging.cc - logging.h -) -add_library(sapi::logging ALIAS sapi_util_logging) -target_link_libraries(sapi_util_logging - PUBLIC glog::glog - PRIVATE sapi::base - INTERFACE absl::core_headers -) - # sandboxed_api/util:raw_logging add_library(sapi_util_raw_logging ${SAPI_LIB_TYPE} raw_logging.cc @@ -96,7 +73,6 @@ target_link_libraries(sapi_util_runfiles PRIVATE absl::strings sapi::file_base sapi::base - sapi::flags sapi::raw_logging ) diff --git a/sandboxed_api/util/flag.h b/sandboxed_api/util/flag.h deleted file mode 100644 index b829904..0000000 --- a/sandboxed_api/util/flag.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2019 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SANDBOXED_API_UTIL_FLAG_H_ -#define SANDBOXED_API_UTIL_FLAG_H_ - -#include - -#define ABSL_FLAG(type, name, default_value, help) \ - DEFINE_##type(name, default_value, help) -#define ABSL_RETIRED_FLAG ABSL_FLAG -#define ABSL_DECLARE_FLAG(type, name) DECLARE_##type(name) - -// Internal defines for compatility with gflags and standard integer types. -#define DECLARE_int32_t DECLARE_int32 -#define DECLARE_int64_t DECLARE_int64 -#define DECLARE_uint32_t DECLARE_uint32 -#define DECLARE_uint64_t DECLARE_uint64 -#define DEFINE_int32_t DEFINE_int32 -#define DEFINE_int64_t DEFINE_int64 -#define DEFINE_uint32_t DEFINE_uint32 -#define DEFINE_uint64_t DEFINE_uint64 - -namespace absl { - -template -const T& GetFlag(const T& flag) { - return flag; -} - -template -void SetFlag(T* flag, const T& value) { - *flag = value; -} - -} // namespace absl - -#endif // SANDBOXED_API_UTIL_FLAG_H_ diff --git a/sandboxed_api/util/logging.cc b/sandboxed_api/util/logging.cc deleted file mode 100644 index 58f756b..0000000 --- a/sandboxed_api/util/logging.cc +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "sandboxed_api/util/logging.h" - -#include - -namespace sapi { - -void InitLogging(const char* argv0) { - google::InitGoogleLogging(argv0); -} - -} // namespace sapi diff --git a/sandboxed_api/util/logging.h b/sandboxed_api/util/logging.h deleted file mode 100644 index 2294632..0000000 --- a/sandboxed_api/util/logging.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef SANDBOXED_API_UTIL_LOGGING_H_ -#define SANDBOXED_API_UTIL_LOGGING_H_ - -namespace sapi { - -// Initialize the logging library. The program name specified by argv0 will be -// visible in log outputs. -void InitLogging(const char* argv0); - -} // namespace sapi - -#endif // SANDBOXED_API_UTIL_LOGGING_H_ diff --git a/sandboxed_api/util/raw_logging.h b/sandboxed_api/util/raw_logging.h index 93efcb5..db1f08e 100644 --- a/sandboxed_api/util/raw_logging.h +++ b/sandboxed_api/util/raw_logging.h @@ -96,6 +96,20 @@ #define SAPI_VLOG_IS_ON(verbose_level) \ ::sapi::raw_logging_internal::VLogIsOn(verbose_level) +#ifndef VLOG +// `VLOG` uses numeric levels to provide verbose logging that can configured at +// runtime, globally. `VLOG` statements are logged at `INFO` severity if they +// are logged at all; the numeric levels are on a different scale than the +// proper severity levels. Positive levels are disabled by default. Negative +// levels should not be used. +#define VLOG(verbose_level) \ + for (int sapi_logging_internal_verbose_level = (verbose_level), \ + sapi_logging_internal_log_loop = 1; \ + sapi_logging_internal_log_loop; sapi_logging_internal_log_loop = 0) \ + LOG_IF(INFO, SAPI_VLOG_IS_ON(sapi_logging_internal_verbose_level)) \ + .WithVerbosity(sapi_logging_internal_verbose_level) +#endif + // Like SAPI_RAW_LOG(), but also logs the current value of errno and its // corresponding error message. #define SAPI_RAW_PLOG(severity, format, ...) \ diff --git a/sandboxed_api/var_abstract.cc b/sandboxed_api/var_abstract.cc index 976c7bb..82308b4 100644 --- a/sandboxed_api/var_abstract.cc +++ b/sandboxed_api/var_abstract.cc @@ -20,10 +20,10 @@ #include -#include +#include "absl/log/log.h" #include "absl/strings/str_cat.h" #include "sandboxed_api/rpcchannel.h" -#include "sandboxed_api/sandbox2/comms.h" +#include "sandboxed_api/util/raw_logging.h" #include "sandboxed_api/util/status_macros.h" #include "sandboxed_api/var_ptr.h" diff --git a/sandboxed_api/var_array.h b/sandboxed_api/var_array.h index 8f32c4e..71657e2 100644 --- a/sandboxed_api/var_array.h +++ b/sandboxed_api/var_array.h @@ -19,8 +19,9 @@ #include #include -#include #include "absl/base/macros.h" +#include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/status/status.h" #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" diff --git a/sandboxed_api/var_int.cc b/sandboxed_api/var_int.cc index 83439f6..d2859d5 100644 --- a/sandboxed_api/var_int.cc +++ b/sandboxed_api/var_int.cc @@ -14,6 +14,7 @@ #include "sandboxed_api/var_int.h" +#include "absl/log/log.h" #include "sandboxed_api/rpcchannel.h" #include "sandboxed_api/util/status_macros.h" diff --git a/sandboxed_api/var_lenval.cc b/sandboxed_api/var_lenval.cc index a60922f..ab99700 100644 --- a/sandboxed_api/var_lenval.cc +++ b/sandboxed_api/var_lenval.cc @@ -16,9 +16,8 @@ #include -#include +#include "absl/log/log.h" #include "sandboxed_api/rpcchannel.h" -#include "sandboxed_api/sandbox2/comms.h" #include "sandboxed_api/util/status_macros.h" namespace sapi::v { diff --git a/sandboxed_api/var_reg.h b/sandboxed_api/var_reg.h index b1bf390..63bd53c 100644 --- a/sandboxed_api/var_reg.h +++ b/sandboxed_api/var_reg.h @@ -19,7 +19,6 @@ #include #include -#include #include "absl/strings/str_format.h" #include "sandboxed_api/var_abstract.h"