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