MCPcopy
hub / github.com/google/gvisor / CallTest

Function CallTest

pkg/sentry/fsimpl/fuse/dev_test.go:164–188  ·  view source on GitHub ↗

CallTest makes a request to the server and blocks the invoking goroutine until a server responds with a response. Doesn't block a kernel.Task. Analogous to Connection.Call but used for testing.

(conn *connection, t *kernel.Task, r *Request, i uint32)

Source from the content-addressed store, hash-verified

162// goroutine until a server responds with a response. Doesn't block
163// a kernel.Task. Analogous to Connection.Call but used for testing.
164func CallTest(conn *connection, t *kernel.Task, r *Request, i uint32) (*Response, error) {
165 conn.mu.Lock()
166
167 // Wait until we're certain that a new request can be processed.
168 for conn.numActiveRequests == conn.maxActiveRequests {
169 conn.mu.Unlock()
170 <-conn.fullQueueCh
171 conn.mu.Lock()
172 }
173
174 fut, err := conn.callFutureLocked(r) // No task given.
175 conn.mu.Unlock()
176
177 if err != nil {
178 return nil, err
179 }
180
181 // Resolve the response.
182 //
183 // Block without a task.
184 <-fut.ch
185
186 // A response is ready. Resolve and return it.
187 return fut.getResponse(), nil
188}
189
190// ReadTest is analogous to vfs.FileDescription.Read and reads from the FUSE
191// device. However, it does so by - not blocking the task that is calling - and

Callers 1

fuseClientRunFunction · 0.85

Calls 4

callFutureLockedMethod · 0.80
getResponseMethod · 0.80
LockMethod · 0.65
UnlockMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…