Skip to content

Commit 998b8ea

Browse files
Sandboxed API Teamcopybara-github
authored andcommitted
Use non-pointer version of absl::MutexLock's constructor
PiperOrigin-RevId: 815605240 Change-Id: Id849f2861d5024b93986e287fc6d0aa814188203
1 parent 89df24c commit 998b8ea

3 files changed

Lines changed: 13 additions & 13 deletions

File tree

sandboxed_api/embed_file.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ int EmbedFile::CreateFdForFileToc(const FileToc* toc) {
102102

103103
int EmbedFile::GetFdForFileToc(const FileToc* toc) {
104104
// Access to file_tocs_ must be guarded.
105-
absl::MutexLock lock{&file_tocs_mutex_};
105+
absl::MutexLock lock{file_tocs_mutex_};
106106

107107
// If a file-descriptor for this toc already exists, just return it.
108108
auto entry = file_tocs_.find(toc);

sandboxed_api/rpcchannel.cc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace sapi {
3030

3131
absl::Status RPCChannel::Call(const FuncCall& call, uint32_t tag, FuncRet* ret,
3232
v::Type exp_type) {
33-
absl::MutexLock lock(&mutex_);
33+
absl::MutexLock lock(mutex_);
3434
if (!comms_->SendTLV(tag, sizeof(call), &call)) {
3535
return absl::UnavailableError("Sending TLV value failed");
3636
}
@@ -64,7 +64,7 @@ absl::StatusOr<FuncRet> RPCChannel::Return(v::Type exp_type) {
6464
}
6565

6666
absl::Status RPCChannel::Allocate(size_t size, void** addr) {
67-
absl::MutexLock lock(&mutex_);
67+
absl::MutexLock lock(mutex_);
6868
if (!comms_->SendTLV(comms::kMsgAllocate, sizeof(size), &size)) {
6969
return absl::UnavailableError("Sending TLV value failed");
7070
}
@@ -76,7 +76,7 @@ absl::Status RPCChannel::Allocate(size_t size, void** addr) {
7676

7777
absl::Status RPCChannel::Reallocate(void* old_addr, size_t size,
7878
void** new_addr) {
79-
absl::MutexLock lock(&mutex_);
79+
absl::MutexLock lock(mutex_);
8080
comms::ReallocRequest req = {
8181
.old_addr = reinterpret_cast<uintptr_t>(old_addr),
8282
.size = size,
@@ -99,7 +99,7 @@ absl::Status RPCChannel::Reallocate(void* old_addr, size_t size,
9999
}
100100

101101
absl::Status RPCChannel::Free(void* addr) {
102-
absl::MutexLock lock(&mutex_);
102+
absl::MutexLock lock(mutex_);
103103
uintptr_t remote = reinterpret_cast<uintptr_t>(addr);
104104
if (!comms_->SendTLV(comms::kMsgFree, sizeof(remote), &remote)) {
105105
return absl::UnavailableError("Sending TLV value failed");
@@ -113,7 +113,7 @@ absl::Status RPCChannel::Free(void* addr) {
113113
}
114114

115115
absl::Status RPCChannel::Symbol(const char* symname, void** addr) {
116-
absl::MutexLock lock(&mutex_);
116+
absl::MutexLock lock(mutex_);
117117
if (!comms_->SendTLV(comms::kMsgSymbol, strlen(symname) + 1, symname)) {
118118
return absl::UnavailableError("Sending TLV value failed");
119119
}
@@ -124,7 +124,7 @@ absl::Status RPCChannel::Symbol(const char* symname, void** addr) {
124124
}
125125

126126
absl::Status RPCChannel::Exit() {
127-
absl::MutexLock lock(&mutex_);
127+
absl::MutexLock lock(mutex_);
128128
if (comms_->IsTerminated()) {
129129
VLOG(2) << "Comms channel already terminated";
130130
return absl::OkStatus();
@@ -137,7 +137,7 @@ absl::Status RPCChannel::Exit() {
137137
}
138138

139139
absl::Status RPCChannel::SendFD(int local_fd, int* remote_fd) {
140-
absl::MutexLock lock(&mutex_);
140+
absl::MutexLock lock(mutex_);
141141
if (!comms_->SendTLV(comms::kMsgSendFd, 0, nullptr)) {
142142
return absl::UnavailableError("Sending TLV value failed");
143143
}
@@ -154,7 +154,7 @@ absl::Status RPCChannel::SendFD(int local_fd, int* remote_fd) {
154154
}
155155

156156
absl::Status RPCChannel::RecvFD(int remote_fd, int* local_fd) {
157-
absl::MutexLock lock(&mutex_);
157+
absl::MutexLock lock(mutex_);
158158
if (!comms_->SendTLV(comms::kMsgRecvFd, sizeof(remote_fd), &remote_fd)) {
159159
return absl::UnavailableError("Sending TLV value failed");
160160
}
@@ -171,7 +171,7 @@ absl::Status RPCChannel::RecvFD(int remote_fd, int* local_fd) {
171171
}
172172

173173
absl::Status RPCChannel::Close(int remote_fd) {
174-
absl::MutexLock lock(&mutex_);
174+
absl::MutexLock lock(mutex_);
175175
if (!comms_->SendTLV(comms::kMsgClose, sizeof(remote_fd), &remote_fd)) {
176176
return absl::UnavailableError("Sending TLV value failed");
177177
}
@@ -184,7 +184,7 @@ absl::Status RPCChannel::Close(int remote_fd) {
184184
}
185185

186186
absl::StatusOr<size_t> RPCChannel::Strlen(void* str) {
187-
absl::MutexLock lock(&mutex_);
187+
absl::MutexLock lock(mutex_);
188188
if (!comms_->SendTLV(comms::kMsgStrlen, sizeof(str), &str)) {
189189
return absl::UnavailableError("Sending TLV value failed");
190190
}

sandboxed_api/sandbox.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ absl::Status Sandbox::Init(bool use_unotify_monitor) {
180180
std::shared_ptr<sandbox2::Executor> fork_client_executor;
181181
std::shared_ptr<sandbox2::ForkClient> fork_client;
182182
{
183-
absl::MutexLock lock(&fork_client_context_->mu_);
183+
absl::MutexLock lock(fork_client_context_->mu_);
184184
// Initialize the forkserver if it is not already running.
185185
if (!fork_client_context_->client_) {
186186
// If FileToc was specified, it will be used over any paths to the SAPI
@@ -266,7 +266,7 @@ absl::Status Sandbox::Init(bool use_unotify_monitor) {
266266
if (!res) {
267267
// Allow recovering from a bad fork client state.
268268
{
269-
absl::MutexLock lock(&fork_client_context_->mu_);
269+
absl::MutexLock lock(fork_client_context_->mu_);
270270
fork_client_context_->client_.reset();
271271
}
272272
Terminate();

0 commit comments

Comments
 (0)