diff --git a/sandboxed_api/proto_helper.h b/sandboxed_api/proto_helper.h index 53ac26d..b00a73e 100644 --- a/sandboxed_api/proto_helper.h +++ b/sandboxed_api/proto_helper.h @@ -22,8 +22,8 @@ #include #include "absl/status/status.h" -#include "sandboxed_api/proto_arg.pb.h" #include "sandboxed_api/util/statusor.h" +#include "sandboxed_api/proto_arg.pb.h" namespace sapi { diff --git a/sandboxed_api/rpcchannel.h b/sandboxed_api/rpcchannel.h index ed50326..c54ef8e 100644 --- a/sandboxed_api/rpcchannel.h +++ b/sandboxed_api/rpcchannel.h @@ -18,11 +18,11 @@ #include #include "absl/status/status.h" +#include "sandboxed_api/util/statusor.h" #include "absl/synchronization/mutex.h" #include "sandboxed_api/call.h" #include "sandboxed_api/sandbox2/comms.h" #include "sandboxed_api/var_type.h" -#include "sandboxed_api/util/statusor.h" namespace sapi { diff --git a/sandboxed_api/sandbox.cc b/sandboxed_api/sandbox.cc index b29646b..18239a4 100644 --- a/sandboxed_api/sandbox.cc +++ b/sandboxed_api/sandbox.cc @@ -392,7 +392,7 @@ absl::Status Sandbox::TransferFromSandboxee(v::Var* var) { } sapi::StatusOr Sandbox::GetCString(const v::RemotePtr& str, - uint64_t max_length) { + uint64_t max_length) { if (!is_active()) { return absl::UnavailableError("Sandbox not active"); } diff --git a/sandboxed_api/sandbox.h b/sandboxed_api/sandbox.h index d8f37ef..8b4ee6a 100644 --- a/sandboxed_api/sandbox.h +++ b/sandboxed_api/sandbox.h @@ -102,8 +102,9 @@ class Sandbox { absl::Status TransferToSandboxee(v::Var* var); absl::Status TransferFromSandboxee(v::Var* var); - sapi::StatusOr GetCString( - const v::RemotePtr& str, uint64_t max_length = 10ULL << 20 /* 10 MiB*/ + sapi::StatusOr GetCString(const v::RemotePtr& str, + uint64_t max_length = 10ULL + << 20 /* 10 MiB*/ ); // Waits until the sandbox terminated and returns the result. diff --git a/sandboxed_api/sandbox2/comms.cc b/sandboxed_api/sandbox2/comms.cc index 6bb891c..3e61013 100644 --- a/sandboxed_api/sandbox2/comms.cc +++ b/sandboxed_api/sandbox2/comms.cc @@ -36,6 +36,7 @@ #include "google/protobuf/message.h" #include "absl/memory/memory.h" #include "absl/status/status.h" +#include "sandboxed_api/util/statusor.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" #include "absl/synchronization/mutex.h" @@ -44,7 +45,6 @@ #include "sandboxed_api/util/raw_logging.h" #include "sandboxed_api/util/status.h" #include "sandboxed_api/util/status_macros.h" -#include "sandboxed_api/util/statusor.h" #ifdef MEMORY_SANITIZER #include "base/dynamic_annotations.h" diff --git a/sandboxed_api/sandbox2/examples/network_proxy/BUILD.bazel b/sandboxed_api/sandbox2/examples/network_proxy/BUILD.bazel index 133cb88..480c078 100644 --- a/sandboxed_api/sandbox2/examples/network_proxy/BUILD.bazel +++ b/sandboxed_api/sandbox2/examples/network_proxy/BUILD.bazel @@ -49,6 +49,7 @@ cc_binary( "//sandboxed_api/util:flags", "//sandboxed_api/util:status", "//sandboxed_api/util:statusor", + "@com_google_absl//absl/status", "@com_google_absl//absl/strings:str_format", ], ) diff --git a/sandboxed_api/sandbox2/examples/network_proxy/networkproxy_bin.cc b/sandboxed_api/sandbox2/examples/network_proxy/networkproxy_bin.cc index c22947d..b355522 100644 --- a/sandboxed_api/sandbox2/examples/network_proxy/networkproxy_bin.cc +++ b/sandboxed_api/sandbox2/examples/network_proxy/networkproxy_bin.cc @@ -12,15 +12,15 @@ #include #include "sandboxed_api/util/flag.h" +#include "absl/status/status.h" +#include "sandboxed_api/util/statusor.h" #include "absl/strings/str_format.h" #include "sandboxed_api/sandbox2/client.h" #include "sandboxed_api/sandbox2/comms.h" #include "sandboxed_api/sandbox2/network_proxy/client.h" #include "sandboxed_api/sandbox2/util/fileops.h" #include "sandboxed_api/sandbox2/util/strerror.h" -#include "sandboxed_api/util/status.h" #include "sandboxed_api/util/status_macros.h" -#include "sandboxed_api/util/statusor.h" ABSL_FLAG(bool, connect_with_handler, true, "Connect using automatic mode."); diff --git a/sandboxed_api/sandbox2/forkserver.cc b/sandboxed_api/sandbox2/forkserver.cc index 2125927..d0b637c 100644 --- a/sandboxed_api/sandbox2/forkserver.cc +++ b/sandboxed_api/sandbox2/forkserver.cc @@ -36,6 +36,7 @@ #include "absl/memory/memory.h" #include "absl/status/status.h" +#include "sandboxed_api/util/statusor.h" #include "absl/strings/match.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" @@ -55,7 +56,6 @@ #include "sandboxed_api/sandbox2/util/fileops.h" #include "sandboxed_api/sandbox2/util/strerror.h" #include "sandboxed_api/util/raw_logging.h" -#include "sandboxed_api/util/statusor.h" namespace { // "Moves" the old FD to the new FD number. diff --git a/sandboxed_api/sandbox2/mounts.cc b/sandboxed_api/sandbox2/mounts.cc index 2f734e2..e1c0198 100644 --- a/sandboxed_api/sandbox2/mounts.cc +++ b/sandboxed_api/sandbox2/mounts.cc @@ -27,6 +27,7 @@ #include "google/protobuf/util/message_differencer.h" #include "absl/container/flat_hash_set.h" +#include "sandboxed_api/util/statusor.h" #include "absl/strings/ascii.h" #include "absl/strings/match.h" #include "absl/strings/str_cat.h" @@ -39,7 +40,6 @@ #include "sandboxed_api/sandbox2/util/strerror.h" #include "sandboxed_api/util/raw_logging.h" #include "sandboxed_api/util/status_macros.h" -#include "sandboxed_api/util/statusor.h" namespace sandbox2 { namespace { diff --git a/sandboxed_api/sandbox2/network_proxy/BUILD.bazel b/sandboxed_api/sandbox2/network_proxy/BUILD.bazel index 3a3a9d6..5935390 100644 --- a/sandboxed_api/sandbox2/network_proxy/BUILD.bazel +++ b/sandboxed_api/sandbox2/network_proxy/BUILD.bazel @@ -46,6 +46,7 @@ cc_library( "//sandboxed_api/sandbox2/util:strerror", "//sandboxed_api/util:status", "@com_google_absl//absl/memory", + "@com_google_absl//absl/status", "@com_google_absl//absl/strings", "@com_google_absl//absl/synchronization", "@com_google_glog//:glog", @@ -62,6 +63,7 @@ cc_library( "//sandboxed_api/sandbox2/util:strerror", "//sandboxed_api/util:status", "//sandboxed_api/util:statusor", + "@com_google_absl//absl/status", "@com_google_absl//absl/strings", "@com_google_glog//:glog", ], diff --git a/sandboxed_api/sandbox2/network_proxy/client.cc b/sandboxed_api/sandbox2/network_proxy/client.cc index 586d201..e528041 100644 --- a/sandboxed_api/sandbox2/network_proxy/client.cc +++ b/sandboxed_api/sandbox2/network_proxy/client.cc @@ -25,9 +25,9 @@ #include #include "absl/memory/memory.h" +#include "absl/status/status.h" #include "absl/strings/str_cat.h" #include "sandboxed_api/sandbox2/util/strerror.h" -#include "sandboxed_api/util/status.h" #include "sandboxed_api/util/status_macros.h" namespace sandbox2 { diff --git a/sandboxed_api/sandbox2/network_proxy/client.h b/sandboxed_api/sandbox2/network_proxy/client.h index e7af4dc..7318993 100644 --- a/sandboxed_api/sandbox2/network_proxy/client.h +++ b/sandboxed_api/sandbox2/network_proxy/client.h @@ -17,9 +17,9 @@ #include +#include "absl/status/status.h" #include "absl/synchronization/mutex.h" #include "sandboxed_api/sandbox2/comms.h" -#include "sandboxed_api/util/status.h" namespace sandbox2 { diff --git a/sandboxed_api/sandbox2/network_proxy/filtering.cc b/sandboxed_api/sandbox2/network_proxy/filtering.cc index d6389d8..fc93e6c 100644 --- a/sandboxed_api/sandbox2/network_proxy/filtering.cc +++ b/sandboxed_api/sandbox2/network_proxy/filtering.cc @@ -17,11 +17,12 @@ #include #include +#include "absl/status/status.h" +#include "sandboxed_api/util/statusor.h" #include "absl/strings/numbers.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_split.h" #include "sandboxed_api/sandbox2/util/strerror.h" -#include "sandboxed_api/util/status.h" #include "sandboxed_api/util/status_macros.h" namespace sandbox2 { diff --git a/sandboxed_api/sandbox2/network_proxy/filtering.h b/sandboxed_api/sandbox2/network_proxy/filtering.h index fb6714a..c0a235b 100644 --- a/sandboxed_api/sandbox2/network_proxy/filtering.h +++ b/sandboxed_api/sandbox2/network_proxy/filtering.h @@ -19,8 +19,8 @@ #include -#include "sandboxed_api/sandbox2/comms.h" #include "sandboxed_api/util/statusor.h" +#include "sandboxed_api/sandbox2/comms.h" namespace sandbox2 { diff --git a/sandboxed_api/sandbox2/policybuilder.h b/sandboxed_api/sandbox2/policybuilder.h index f05023c..07095ba 100644 --- a/sandboxed_api/sandbox2/policybuilder.h +++ b/sandboxed_api/sandbox2/policybuilder.h @@ -29,11 +29,11 @@ #include #include "absl/base/macros.h" #include "absl/memory/memory.h" +#include "sandboxed_api/util/statusor.h" #include "absl/strings/string_view.h" #include "sandboxed_api/sandbox2/mounts.h" #include "sandboxed_api/sandbox2/network_proxy/filtering.h" #include "sandboxed_api/sandbox2/policy.h" -#include "sandboxed_api/util/statusor.h" struct bpf_labels; diff --git a/sandboxed_api/sandbox2/sandbox2.h b/sandboxed_api/sandbox2/sandbox2.h index 9527ff2..633297f 100644 --- a/sandboxed_api/sandbox2/sandbox2.h +++ b/sandboxed_api/sandbox2/sandbox2.h @@ -26,6 +26,7 @@ #include #include "absl/base/macros.h" #include "absl/memory/memory.h" +#include "sandboxed_api/util/statusor.h" #include "sandboxed_api/sandbox2/comms.h" #include "sandboxed_api/sandbox2/executor.h" #include "sandboxed_api/sandbox2/ipc.h" @@ -33,7 +34,6 @@ #include "sandboxed_api/sandbox2/notify.h" #include "sandboxed_api/sandbox2/policy.h" #include "sandboxed_api/sandbox2/result.h" -#include "sandboxed_api/util/statusor.h" namespace sandbox2 { diff --git a/sandboxed_api/sandbox2/util.cc b/sandboxed_api/sandbox2/util.cc index 24d4a36..b760d26 100644 --- a/sandboxed_api/sandbox2/util.cc +++ b/sandboxed_api/sandbox2/util.cc @@ -183,8 +183,8 @@ bool CreateMemFd(int* fd, const char* name) { } sapi::StatusOr Communicate(const std::vector& argv, - const std::vector& envv, - std::string* output) { + const std::vector& envv, + std::string* output) { int cout_pipe[2]; posix_spawn_file_actions_t action; diff --git a/sandboxed_api/sandbox2/util.h b/sandboxed_api/sandbox2/util.h index 87fe31c..e42bf72 100644 --- a/sandboxed_api/sandbox2/util.h +++ b/sandboxed_api/sandbox2/util.h @@ -63,8 +63,8 @@ bool CreateMemFd(int* fd, const char* name = "buffer_file"); // Executes a the program given by argv and the specified environment and // captures any output to stdout/stderr. sapi::StatusOr Communicate(const std::vector& argv, - const std::vector& envv, - std::string* output); + const std::vector& envv, + std::string* output); // Returns signal description. std::string GetSignalName(int signo); diff --git a/sandboxed_api/sandbox2/util/minielf.cc b/sandboxed_api/sandbox2/util/minielf.cc index 3eac979..dce033b 100644 --- a/sandboxed_api/sandbox2/util/minielf.cc +++ b/sandboxed_api/sandbox2/util/minielf.cc @@ -219,8 +219,7 @@ absl::Status ElfParser::ReadFileHeader() { return absl::OkStatus(); } -sapi::StatusOr ElfParser::ReadSectionHeader( - absl::string_view src) { +sapi::StatusOr ElfParser::ReadSectionHeader(absl::string_view src) { if (src.size() < sizeof(Elf64_Shdr)) { return absl::FailedPreconditionError( absl::StrCat("invalid section header data: got ", src.size(), @@ -293,8 +292,7 @@ sapi::StatusOr ElfParser::ReadSectionContents( return rv; } -sapi::StatusOr ElfParser::ReadProgramHeader( - absl::string_view src) { +sapi::StatusOr ElfParser::ReadProgramHeader(absl::string_view src) { if (src.size() < sizeof(Elf64_Phdr)) { return absl::FailedPreconditionError( absl::StrCat("invalid program header data: got ", src.size(), @@ -514,7 +512,7 @@ sapi::StatusOr ElfParser::Parse(FILE* elf, uint32_t features) { } sapi::StatusOr ElfFile::ParseFromFile(const std::string& filename, - uint32_t features) { + uint32_t features) { std::unique_ptr elf{fopen(filename.c_str(), "r"), [](FILE* f) { fclose(f); }}; if (!elf) { diff --git a/sandboxed_api/sandbox2/util/minielf.h b/sandboxed_api/sandbox2/util/minielf.h index 247d271..c33a604 100644 --- a/sandboxed_api/sandbox2/util/minielf.h +++ b/sandboxed_api/sandbox2/util/minielf.h @@ -34,7 +34,7 @@ class ElfFile { }; static sapi::StatusOr ParseFromFile(const std::string& filename, - uint32_t features); + uint32_t features); int64_t file_size() const { return file_size_; } const std::string& interpreter() const { return interpreter_; } diff --git a/sandboxed_api/tools/clang_generator/emitter.cc b/sandboxed_api/tools/clang_generator/emitter.cc index 18fdcd9..78b9a9a 100644 --- a/sandboxed_api/tools/clang_generator/emitter.cc +++ b/sandboxed_api/tools/clang_generator/emitter.cc @@ -46,10 +46,10 @@ constexpr absl::string_view kHeaderProlog = #include "absl/base/macros.h" #include "absl/status/status.h" +#include "sandboxed_api/util/statusor.h" #include "sandboxed_api/sandbox.h" #include "sandboxed_api/vars.h" #include "sandboxed_api/util/status_macros.h" -#include "sandboxed_api/util/statusor.h" )"; constexpr absl::string_view kHeaderEpilog = diff --git a/sandboxed_api/tools/clang_generator/emitter.h b/sandboxed_api/tools/clang_generator/emitter.h index 42ba92d..ad9f5f8 100644 --- a/sandboxed_api/tools/clang_generator/emitter.h +++ b/sandboxed_api/tools/clang_generator/emitter.h @@ -18,12 +18,12 @@ #include #include "absl/status/status.h" +#include "sandboxed_api/util/statusor.h" #include "absl/strings/string_view.h" #include "clang/AST/Decl.h" #include "clang/AST/Type.h" #include "sandboxed_api/tools/clang_generator/generator.h" #include "sandboxed_api/tools/clang_generator/types.h" -#include "sandboxed_api/util/statusor.h" namespace sapi { diff --git a/sandboxed_api/tools/clang_generator/generator.cc b/sandboxed_api/tools/clang_generator/generator.cc index 508877e..ffe2106 100644 --- a/sandboxed_api/tools/clang_generator/generator.cc +++ b/sandboxed_api/tools/clang_generator/generator.cc @@ -18,12 +18,12 @@ #include #include "absl/status/status.h" +#include "sandboxed_api/util/statusor.h" #include "clang/Format/Format.h" #include "sandboxed_api/sandbox2/util/fileops.h" #include "sandboxed_api/tools/clang_generator/diagnostics.h" #include "sandboxed_api/tools/clang_generator/emitter.h" #include "sandboxed_api/util/status_macros.h" -#include "sandboxed_api/util/statusor.h" namespace sapi { namespace { @@ -68,7 +68,7 @@ bool GeneratorASTVisitor::VisitFunctionDecl(clang::FunctionDecl* decl) { namespace internal { sapi::StatusOr ReformatGoogleStyle(const std::string& filename, - const std::string& code) { + const std::string& code) { // Configure code style based on Google style, but enforce pointer alignment clang::format::FormatStyle style = clang::format::getGoogleStyle(clang::format::FormatStyle::LK_Cpp); diff --git a/sandboxed_api/tools/clang_generator/generator.h b/sandboxed_api/tools/clang_generator/generator.h index 24e2658..3b9680b 100644 --- a/sandboxed_api/tools/clang_generator/generator.h +++ b/sandboxed_api/tools/clang_generator/generator.h @@ -20,13 +20,13 @@ #include "absl/container/flat_hash_set.h" #include "absl/memory/memory.h" #include "absl/status/status.h" +#include "sandboxed_api/util/statusor.h" #include "clang/AST/ASTConsumer.h" #include "clang/AST/RecursiveASTVisitor.h" #include "clang/Frontend/CompilerInstance.h" #include "clang/Frontend/FrontendAction.h" #include "clang/Tooling/Tooling.h" #include "sandboxed_api/tools/clang_generator/types.h" -#include "sandboxed_api/util/statusor.h" namespace sapi { @@ -67,7 +67,7 @@ class GeneratorASTVisitor namespace internal { sapi::StatusOr ReformatGoogleStyle(const std::string& filename, - const std::string& code); + const std::string& code); } // namespace internal diff --git a/sandboxed_api/tools/clang_generator/types.cc b/sandboxed_api/tools/clang_generator/types.cc index 4d91499..321d1e2 100644 --- a/sandboxed_api/tools/clang_generator/types.cc +++ b/sandboxed_api/tools/clang_generator/types.cc @@ -208,7 +208,7 @@ std::string MapQualTypeReturn(const clang::ASTContext& context, return "absl::Status"; } // Remove const qualifier like in MapQualType(). - return absl::StrCat("::sapi::StatusOr<", + return absl::StrCat("sapi::StatusOr<", MaybeRemoveConst(context, qual).getAsString(), ">"); } diff --git a/sandboxed_api/util/status.h b/sandboxed_api/util/status.h index 6390bc0..d9962fd 100644 --- a/sandboxed_api/util/status.h +++ b/sandboxed_api/util/status.h @@ -12,10 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -// This file and it's implementation provide a custom fork of -// util/task/status.h. This will become obsolete and will be replaced once -// Abseil releases absl::Status. - #ifndef THIRD_PARTY_SAPI_UTIL_STATUS_H_ #define THIRD_PARTY_SAPI_UTIL_STATUS_H_