Fix WriteWithSize() on shm_syscall
This commit is contained in:
parent
327cefbfda
commit
ba1ce996bb
1 changed files with 5 additions and 1 deletions
|
|
@ -114,7 +114,11 @@ func (self *syscall_based_mmap) Write(b []byte) (int, error) {
|
|||
}
|
||||
|
||||
func (self *syscall_based_mmap) WriteWithSize(b []byte) error {
|
||||
return write_with_size(self.f, b)
|
||||
szbuf := []byte{0, 0, 0, 0}
|
||||
binary.BigEndian.PutUint32(szbuf, uint32(len(b)))
|
||||
copy(self.Slice(), szbuf)
|
||||
copy(self.Slice()[4:], b)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *syscall_based_mmap) ReadWithSize() ([]byte, error) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue