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.
12 // for testing: whatever interrupts a sleep
16 func open(name
string) (uintptr, error
) {
17 fd
, err
:= syscall
.Open(name
, syscall
.O_RDONLY
, 0)
21 return uintptr(fd
), nil
24 func read(fd
uintptr, buf
[]byte) (int, error
) {
25 return syscall
.Read(syscall
.Handle(fd
), buf
)
28 func closefd(fd
uintptr) {
29 syscall
.Close(syscall
.Handle(fd
))
32 func preadn(fd
uintptr, buf
[]byte, off
int) error
{
37 if _
, err
:= syscall
.Seek(syscall
.Handle(fd
), int64(off
), whence
); err
!= nil {
41 m
, err
:= syscall
.Read(syscall
.Handle(fd
), buf
)
44 return errors
.New("short read")