Ejemplo n.º 1
0
func Write(fd int, p []byte) (n int, err error) {
	if race.Enabled {
		race.ReleaseMerge(unsafe.Pointer(&ioSync))
	}
	n, err = write(fd, p)
	if race.Enabled && n > 0 {
		race.ReadRange(unsafe.Pointer(&p[0]), n)
	}
	if msanenabled && n > 0 {
		msanRead(unsafe.Pointer(&p[0]), n)
	}
	return
}
Ejemplo n.º 2
0
func Write(fd Handle, p []byte) (n int, err error) {
	if race.Enabled {
		race.ReleaseMerge(unsafe.Pointer(&ioSync))
	}
	var done uint32
	e := WriteFile(fd, p, &done, nil)
	if e != nil {
		return 0, e
	}
	if race.Enabled && done > 0 {
		race.ReadRange(unsafe.Pointer(&p[0]), int(done))
	}
	if msanenabled && done > 0 {
		msanRead(unsafe.Pointer(&p[0]), int(done))
	}
	return int(done), nil
}