github.com/llvm-mirror/llgo@v0.0.0-20190322182713-bf6f0a60fce1/third_party/gofrontend/libgo/go/syscall/syscall_errno.go (about)

     1  // Copyright 2009 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package syscall
     6  
     7  // An Errno is an unsigned number describing an error condition.
     8  // It implements the error interface.  The zero Errno is by convention
     9  // a non-error, so code to convert from Errno to error should use:
    10  //	err = nil
    11  //	if errno != 0 {
    12  //		err = errno
    13  //	}
    14  type Errno uintptr
    15  
    16  func (e Errno) Error() string {
    17  	return Errstr(int(e))
    18  }
    19  
    20  func (e Errno) Temporary() bool {
    21  	return e == EINTR || e == EMFILE || e == ECONNRESET || e == ECONNABORTED || e.Timeout()
    22  }
    23  
    24  func (e Errno) Timeout() bool {
    25  	return e == EAGAIN || e == EWOULDBLOCK || e == ETIMEDOUT
    26  }