OSDN Git Service

libgo http/cgi: Pass down environment variables for irix and solaris.
[pf3gnuchains/gcc-fork.git] / libgo / syscalls / 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 func libc_strerror(int) *byte __asm__ ("strerror")
15
16 var errstr_lock sync.Mutex
17
18 func Errstr(errno int) string {
19         errstr_lock.Lock()
20
21         bp := libc_strerror(errno)
22         b := (*[1000]byte)(unsafe.Pointer(bp))
23         i := 0
24         for b[i] != 0 {
25                 i++
26         }
27         s := string(b[:i])
28
29         errstr_lock.Unlock()
30
31         return s
32 }