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

Subversion Repositories openrisc

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

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

Line No. Rev Author Line
1 747 jeremybenn
// errstr.go -- Error strings.
2
 
3
// Copyright 2009 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
//sysnb strerror_r(errnum int, buf []byte) (err error)
10
//strerror_r(errnum int, buf *byte, buflen Size_t) int
11
 
12
func Errstr(errnum int) string {
13
        for len := 128; ; len *= 2 {
14
                b := make([]byte, len)
15
                err := strerror_r(errnum, b)
16
                if err == nil {
17
                        i := 0
18
                        for b[i] != 0 {
19
                                i++
20
                        }
21
                        return string(b[:i])
22
                }
23
                if err != ERANGE {
24
                        return "Errstr failure"
25
                }
26
        }
27
}

powered by: WebSVN 2.1.0

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