2009-06-01 22:14:57 -07:00
|
|
|
// Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
|
|
package syscall
|
|
|
|
|
|
|
|
|
|
|
2009-12-15 15:40:16 -08:00
|
|
|
func str(val int) string { // do it here rather than with fmt to avoid dependency
|
2009-06-01 22:14:57 -07:00
|
|
|
if val < 0 {
|
2009-11-09 21:23:52 -08:00
|
|
|
return "-" + str(-val)
|
2009-06-01 22:14:57 -07:00
|
|
|
}
|
2009-12-15 15:40:16 -08:00
|
|
|
var buf [32]byte // big enough for int64
|
|
|
|
|
i := len(buf) - 1
|
2009-06-01 22:14:57 -07:00
|
|
|
for val >= 10 {
|
2009-12-15 15:40:16 -08:00
|
|
|
buf[i] = byte(val%10 + '0')
|
|
|
|
|
i--
|
|
|
|
|
val /= 10
|
2009-06-01 22:14:57 -07:00
|
|
|
}
|
2009-12-15 15:40:16 -08:00
|
|
|
buf[i] = byte(val + '0')
|
|
|
|
|
return string(buf[i:])
|
2009-06-01 22:14:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func Errstr(errno int) string {
|
|
|
|
|
if errno < 0 || errno >= int(len(errors)) {
|
2009-11-09 21:23:52 -08:00
|
|
|
return "error " + str(errno)
|
2009-06-01 22:14:57 -07:00
|
|
|
}
|
2009-12-15 15:40:16 -08:00
|
|
|
return errors[errno]
|
2009-06-01 22:14:57 -07:00
|
|
|
}
|