| Index: sandbox/linux/syscall_broker/broker_client.h
|
| diff --git a/sandbox/linux/syscall_broker/broker_client.h b/sandbox/linux/syscall_broker/broker_client.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..9ca45cb21aa057004cbb45cc04c9e05babdbae73
|
| --- /dev/null
|
| +++ b/sandbox/linux/syscall_broker/broker_client.h
|
| @@ -0,0 +1,56 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef SANDBOX_LINUX_SYSCALL_BROKER_BROKER_CLIENT_H_
|
| +#define SANDBOX_LINUX_SYSCALL_BROKER_BROKER_CLIENT_H_
|
| +
|
| +#include "base/macros.h"
|
| +#include "sandbox/linux/syscall_broker/broker_common.h"
|
| +
|
| +namespace sandbox {
|
| +
|
| +namespace syscall_broker {
|
| +
|
| +class BrokerPolicy;
|
| +
|
| +class BrokerClient {
|
| + public:
|
| + BrokerClient(const BrokerPolicy& broker_policy,
|
| + int ipc_channel,
|
| + bool fast_check_in_client = true,
|
| + bool quiet_failures_for_tests = false);
|
| + ~BrokerClient();
|
| +
|
| + // Can be used in place of access(). Will be async signal safe.
|
| + // X_OK will always return an error in practice since the broker process
|
| + // doesn't support execute permissions.
|
| + // It's similar to the access() system call and will return -errno on errors.
|
| + int Access(const char* pathname, int mode) const;
|
| + // Can be used in place of open(). Will be async signal safe.
|
| + // The implementation only supports certain white listed flags and will
|
| + // return -EPERM on other flags.
|
| + // It's similar to the open() system call and will return -errno on errors.
|
| + int Open(const char* pathname, int flags) const;
|
| +
|
| + private:
|
| + const BrokerPolicy& broker_policy_;
|
| + const int ipc_channel_;
|
| + const bool fast_check_in_client_; // Whether to forward a request that we
|
| + // know will be denied to the broker. (Used
|
| + // for tests).
|
| + const bool quiet_failures_for_tests_; // Disable certain error message when
|
| + // testing for failures.
|
| +
|
| + int PathAndFlagsSyscall(enum IPCCommands syscall_type,
|
| + const char* pathname,
|
| + int flags) const;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(BrokerClient);
|
| +};
|
| +
|
| +} // namespace syscall_broker
|
| +
|
| +} // namespace sandbox
|
| +
|
| +#endif // SANDBOX_LINUX_SYSCALL_BROKER_BROKER_CLIENT_H_
|
|
|