MCPcopy Index your code
hub / github.com/google/gvisor / createMemoryFile

Function createMemoryFile

pkg/sentry/fsimpl/testutil/kernel.go:184–197  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

182}
183
184func createMemoryFile() (*pgalloc.MemoryFile, error) {
185 const memfileName = "test-memory"
186 memfd, err := memutil.CreateMemFD(memfileName, 0)
187 if err != nil {
188 return nil, fmt.Errorf("error creating memfd: %v", err)
189 }
190 memfile := os.NewFile(uintptr(memfd), memfileName)
191 mf, err := pgalloc.NewMemoryFile(memfile, pgalloc.MemoryFileOpts{})
192 if err != nil {
193 _ = memfile.Close()
194 return nil, fmt.Errorf("error creating pgalloc.MemoryFile: %v", err)
195 }
196 return mf, nil
197}

Callers 1

BootFunction · 0.70

Calls 5

CreateMemFDFunction · 0.92
NewMemoryFileFunction · 0.92
ErrorfMethod · 0.65
NewFileMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…