github.com/aykevl/tinygo@v0.5.0/src/syscall/errno.go (about) 1 package syscall 2 3 // Most code here has been copied from the Go sources: 4 // https://github.com/golang/go/blob/go1.12/src/syscall/syscall_js.go 5 // It has the following copyright note: 6 // 7 // Copyright 2018 The Go Authors. All rights reserved. 8 // Use of this source code is governed by a BSD-style 9 // license that can be found in the LICENSE file. 10 11 // An Errno is an unsigned number describing an error condition. 12 // It implements the error interface. The zero Errno is by convention 13 // a non-error, so code to convert from Errno to error should use: 14 // err = nil 15 // if errno != 0 { 16 // err = errno 17 // } 18 type Errno uintptr 19 20 func (e Errno) Error() string { 21 return "errno " + itoa(int(e)) 22 } 23 24 func (e Errno) Temporary() bool { 25 return e == EINTR || e == EMFILE || e.Timeout() 26 } 27 28 func (e Errno) Timeout() bool { 29 return e == EAGAIN || e == EWOULDBLOCK || e == ETIMEDOUT 30 }