OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgo/] [go/] [syscall/] [errstr_nor.go] - Blame information for rev 801

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 747 jeremybenn
// errstr.go -- Error strings when there is no strerror_r.
2
 
3
// Copyright 2011 The Go Authors. All rights reserved.
4
// Use of this source code is governed by a BSD-style
5
// license that can be found in the LICENSE file.
6
 
7
package syscall
8
 
9
import (
10
        "sync"
11
        "unsafe"
12
)
13
 
14
//sysnb strerror(errnum int) (buf *byte)
15
//strerror(errnum int) *byte
16
 
17
var errstr_lock sync.Mutex
18
 
19
func Errstr(errno int) string {
20
        errstr_lock.Lock()
21
 
22
        bp := strerror(errno)
23
        b := (*[1000]byte)(unsafe.Pointer(bp))
24
        i := 0
25
        for b[i] != 0 {
26
                i++
27
        }
28
        s := string(b[:i])
29
 
30
        errstr_lock.Unlock()
31
 
32
        return s
33
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.