You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

27 lines
588 B

  1. // Copyright 2017 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. package socket
  5. import "syscall"
  6. var (
  7. errERROR_IO_PENDING error = syscall.ERROR_IO_PENDING
  8. errEINVAL error = syscall.EINVAL
  9. )
  10. // errnoErr returns common boxed Errno values, to prevent allocations
  11. // at runtime.
  12. func errnoErr(errno syscall.Errno) error {
  13. switch errno {
  14. case 0:
  15. return nil
  16. case syscall.ERROR_IO_PENDING:
  17. return errERROR_IO_PENDING
  18. case syscall.EINVAL:
  19. return errEINVAL
  20. }
  21. return errno
  22. }