diff options
Diffstat (limited to 'libgo/syscalls/syscall_unix.go')
-rw-r--r-- | libgo/syscalls/syscall_unix.go | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/libgo/syscalls/syscall_unix.go b/libgo/syscalls/syscall_unix.go deleted file mode 100644 index e633ea1..0000000 --- a/libgo/syscalls/syscall_unix.go +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2009 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. - -package syscall - -import "unsafe" - -var ( - Stdin = 0 - Stdout = 1 - Stderr = 2 -) - -const ENONE = 0 - -func GetErrno() int -func SetErrno(int) - -func Uname(buf *Utsname) (errno int) { - r := libc_uname(buf) - if r < 0 { - errno = GetErrno() - } - return -} - -var mapper = &mmapper{ - active: make(map[*byte][]byte), - mmap: mmap, - munmap: munmap, -} - -func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, errno int) { - return mapper.Mmap(fd, offset, length, prot, flags) -} - -func Munmap(b []byte) (errno int) { - return mapper.Munmap(b) -} - -func libc_munmap(*byte, Size_t) int __asm__ ("munmap") - -func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, errno int) { - r0 := libc_mmap((*byte)(unsafe.Pointer(addr)), Size_t(length), prot, flag, fd, Offset_t(pos)) - ret = uintptr(unsafe.Pointer(r0)) - if ret + 1 == 0 { - errno = GetErrno() - } - return -} - -func munmap(addr uintptr, length uintptr) (errno int) { - if libc_munmap((*byte)(unsafe.Pointer(addr)), Size_t(length)) < 0 { - errno = GetErrno() - } - return -} - -func libc_getrusage(who int, rusage *Rusage) int __asm__ ("getrusage") - -func Getrusage(who int, rusage *Rusage) (errno int) { - if libc_getrusage(who, rusage) < 0 { - errno = GetErrno() - } - return -} |