S/390: Fix vector all/any cc modes.
[official-gcc.git] / libgo / go / os / error_unix.go
blob3c78eb4dd2fd2f8e9f657f639e51e732c41786c1
1 // Copyright 2009 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.
5 // +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris
7 package os
9 import "syscall"
11 func isExist(err error) bool {
12 switch pe := err.(type) {
13 case nil:
14 return false
15 case *PathError:
16 err = pe.Err
17 case *LinkError:
18 err = pe.Err
19 case *SyscallError:
20 err = pe.Err
22 return err == syscall.EEXIST || err == syscall.ENOTEMPTY || err == ErrExist
25 func isNotExist(err error) bool {
26 switch pe := err.(type) {
27 case nil:
28 return false
29 case *PathError:
30 err = pe.Err
31 case *LinkError:
32 err = pe.Err
33 case *SyscallError:
34 err = pe.Err
36 return err == syscall.ENOENT || err == ErrNotExist
39 func isPermission(err error) bool {
40 switch pe := err.(type) {
41 case nil:
42 return false
43 case *PathError:
44 err = pe.Err
45 case *LinkError:
46 err = pe.Err
47 case *SyscallError:
48 err = pe.Err
50 return err == syscall.EACCES || err == syscall.EPERM || err == ErrPermission