blob: 6a6379a8b0790abd172d9cff1b0520820abf3df7 [file] [log] [blame]
David K. Bainbridge215e0242017-09-05 23:18:24 -07001// 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
5package socket
6
7import "syscall"
8
9var (
10 errERROR_IO_PENDING error = syscall.ERROR_IO_PENDING
11 errEINVAL error = syscall.EINVAL
12)
13
14// errnoErr returns common boxed Errno values, to prevent allocations
15// at runtime.
16func errnoErr(errno syscall.Errno) error {
17 switch errno {
18 case 0:
19 return nil
20 case syscall.ERROR_IO_PENDING:
21 return errERROR_IO_PENDING
22 case syscall.EINVAL:
23 return errEINVAL
24 }
25 return errno
26}