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 os 9 10 import "syscall" 11 12 // wrapSyscallError takes an error and a syscall name. If the error is 13 // a syscall.Errno, it wraps it in a os.SyscallError using the syscall name. 14 func wrapSyscallError(name string, err error) error { 15 if _, ok := err.(syscall.Errno); ok { 16 err = NewSyscallError(name, err) 17 } 18 return err 19 } 20