Home | History | Annotate | Download | only in net
      1 // Copyright 2015 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 // +build !plan9,!windows
      6 
      7 package net
      8 
      9 import (
     10 	"os"
     11 	"syscall"
     12 )
     13 
     14 var (
     15 	errTimedout       = syscall.ETIMEDOUT
     16 	errOpNotSupported = syscall.EOPNOTSUPP
     17 
     18 	abortedConnRequestErrors = []error{syscall.ECONNABORTED} // see accept in fd_unix.go
     19 )
     20 
     21 func isPlatformError(err error) bool {
     22 	_, ok := err.(syscall.Errno)
     23 	return ok
     24 }
     25 
     26 func samePlatformError(err, want error) bool {
     27 	if op, ok := err.(*OpError); ok {
     28 		err = op.Err
     29 	}
     30 	if sys, ok := err.(*os.SyscallError); ok {
     31 		err = sys.Err
     32 	}
     33 	return err == want
     34 }
     35