OSDN Git Service

* config/i386/sse.md (sseintprefix): Rename from gthrfirstp.
[pf3gnuchains/gcc-fork.git] / libgo / go / syscall / errstr_nor.go
1 // 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) *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 := libc_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 }