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 5 //go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris || windows 6 // +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows 7 8 package net 9 10 import ( 11 "os" 12 "syscall" 13 ) 14 15 // wrapSyscallError takes an error and a syscall name. If the error is 16 // a syscall.Errno, it wraps it in a os.SyscallError using the syscall name. 17 func wrapSyscallError(name string, err error) error { 18 if _, ok := err.(syscall.Errno); ok { 19 err = os.NewSyscallError(name, err) 20 } 21 return err 22 } 23