Debian Codegraph @

libgo/go/crypto/rand/eagain.go

raw
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 //go:build aix || darwin || dragonfly || freebsd || hurd || linux || netbsd || openbsd || solaris
6
7 package rand
8
9 import (
10 "io/fs"
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.(*fs.PathError); ok {
22 if errno, ok := pe.Err.(syscall.Errno); ok && errno == syscall.EAGAIN {
23 return true
24 }
25 }
26 return false
27 }