| // Copyright 2011 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| // +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris |
| // for testing: whatever interrupts a sleep |
| syscall.Kill(syscall.Getpid(), syscall.SIGCHLD) |
| func open(name string) (uintptr, error) { |
| fd, err := syscall.Open(name, syscall.O_RDONLY, 0) |
| func read(fd uintptr, buf []byte) (int, error) { |
| return syscall.Read(int(fd), buf) |
| func closefd(fd uintptr) { |
| func preadn(fd uintptr, buf []byte, off int) error { |
| if _, err := syscall.Seek(int(fd), int64(off), whence); err != nil { |
| m, err := syscall.Read(int(fd), buf) |
| return errors.New("short read") |