1 // errstr.go -- Error strings when there is no strerror_r.
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.
14 //sysnb strerror(errnum int) (buf *byte)
15 //strerror(errnum _C_int) *byte
17 var errstr_lock sync.Mutex
19 func Errstr(errno int) string {
23 b := (*[1000]byte)(unsafe.Pointer(bp))
29 // Lowercase first letter: Bad -> bad, but STREAM -> STREAM.
31 if i > 1 && 'A' <= b[0] && b[0] <= 'Z' && 'a' <= b[1] && b[1] <= 'z' {
33 s = string(c) + string(b[1:i])