Home | History | Annotate | Download | only in rand
      1 // Copyright 2014 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 darwin dragonfly freebsd linux nacl netbsd openbsd solaris
      6 
      7 package rand
      8 
      9 import (
     10 	"os"
     11 	"syscall"
     12 )
     13 
     14 func init() {
     15 	isEAGAIN = unixIsEAGAIN
     16 }
     17 
     18 // unixIsEAGAIN reports whether err is a syscall.EAGAIN wrapped in a PathError.
     19 // See golang.org/issue/9205
     20 func unixIsEAGAIN(err error) bool {
     21 	if pe, ok := err.(*os.PathError); ok {
     22 		if errno, ok := pe.Err.(syscall.Errno); ok && errno == syscall.EAGAIN {
     23 			return true
     24 		}
     25 	}
     26 	return false
     27 }
     28