mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
StatusOr
cleanups
PiperOrigin-RevId: 328318284 Change-Id: I207570c0fee6797dbc8995d36ef2130b0bff28fa
This commit is contained in:
parent
b76cb15f26
commit
82c56775ef
|
@ -22,8 +22,8 @@
|
|||
#include <vector>
|
||||
|
||||
#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 {
|
||||
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
#include <cstddef>
|
||||
|
||||
#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 {
|
||||
|
||||
|
|
|
@ -102,8 +102,9 @@ class Sandbox {
|
|||
absl::Status TransferToSandboxee(v::Var* var);
|
||||
absl::Status TransferFromSandboxee(v::Var* var);
|
||||
|
||||
sapi::StatusOr<std::string> GetCString(
|
||||
const v::RemotePtr& str, uint64_t max_length = 10ULL << 20 /* 10 MiB*/
|
||||
sapi::StatusOr<std::string> GetCString(const v::RemotePtr& str,
|
||||
uint64_t max_length = 10ULL
|
||||
<< 20 /* 10 MiB*/
|
||||
);
|
||||
|
||||
// Waits until the sandbox terminated and returns the result.
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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",
|
||||
],
|
||||
)
|
||||
|
|
|
@ -12,15 +12,15 @@
|
|||
#include <cstring>
|
||||
|
||||
#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.");
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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",
|
||||
],
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
|
||||
#include <glog/logging.h>
|
||||
#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 {
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include "absl/status/status.h"
|
||||
#include "absl/synchronization/mutex.h"
|
||||
#include "sandboxed_api/sandbox2/comms.h"
|
||||
#include "sandboxed_api/util/status.h"
|
||||
|
||||
namespace sandbox2 {
|
||||
|
||||
|
|
|
@ -17,11 +17,12 @@
|
|||
#include <arpa/inet.h>
|
||||
|
||||
#include <glog/logging.h>
|
||||
#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 {
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
|
||||
#include <memory>
|
||||
|
||||
#include "sandboxed_api/sandbox2/comms.h"
|
||||
#include "sandboxed_api/util/statusor.h"
|
||||
#include "sandboxed_api/sandbox2/comms.h"
|
||||
|
||||
namespace sandbox2 {
|
||||
|
||||
|
|
|
@ -29,11 +29,11 @@
|
|||
#include <glog/logging.h>
|
||||
#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;
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <glog/logging.h>
|
||||
#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 {
|
||||
|
||||
|
|
|
@ -219,8 +219,7 @@ absl::Status ElfParser::ReadFileHeader() {
|
|||
return absl::OkStatus();
|
||||
}
|
||||
|
||||
sapi::StatusOr<Elf64_Shdr> ElfParser::ReadSectionHeader(
|
||||
absl::string_view src) {
|
||||
sapi::StatusOr<Elf64_Shdr> 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<std::string> ElfParser::ReadSectionContents(
|
|||
return rv;
|
||||
}
|
||||
|
||||
sapi::StatusOr<Elf64_Phdr> ElfParser::ReadProgramHeader(
|
||||
absl::string_view src) {
|
||||
sapi::StatusOr<Elf64_Phdr> ElfParser::ReadProgramHeader(absl::string_view src) {
|
||||
if (src.size() < sizeof(Elf64_Phdr)) {
|
||||
return absl::FailedPreconditionError(
|
||||
absl::StrCat("invalid program header data: got ", src.size(),
|
||||
|
|
|
@ -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 =
|
||||
|
|
|
@ -18,12 +18,12 @@
|
|||
#include <string>
|
||||
|
||||
#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 {
|
||||
|
||||
|
|
|
@ -18,12 +18,12 @@
|
|||
#include <iostream>
|
||||
|
||||
#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 {
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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(), ">");
|
||||
}
|
||||
|
||||
|
|
|
@ -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_
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user