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

Method MMIOWrite

pkg/eventfd/eventfd.go:103–114  ·  view source on GitHub ↗

MMIOWrite is equivalent to Write, but returns an error if the write cannot be implemented by writing to the address set by EnableMMIO. This is primarily useful for testing.

(val uint64)

Source from the content-addressed store, hash-verified

101// implemented by writing to the address set by EnableMMIO. This is primarily
102// useful for testing.
103func (ev Eventfd) MMIOWrite(val uint64) error {
104 var buf [sizeofUint64]byte
105 hostarch.ByteOrder.PutUint64(buf[:], val)
106 if ev.mmioAddr == 0 {
107 return fmt.Errorf("no MMIO address set")
108 }
109 if !ev.mmioCtrl.Enabled() {
110 return fmt.Errorf("MMIO is temporarily disabled")
111 }
112 _, err := safecopy.CopyOut(ev.mmioPtr(), buf[:])
113 return err
114}
115
116// Wait blocks until eventfd is non-zero (i.e. someone calls Notify or Write).
117func (ev Eventfd) Wait() error {

Callers 1

TestIoeventfdFunction · 0.80

Calls 4

mmioPtrMethod · 0.95
CopyOutFunction · 0.92
ErrorfMethod · 0.65
EnabledMethod · 0.65

Tested by 1

TestIoeventfdFunction · 0.64