github.com/metacubex/gvisor@v0.0.0-20240320004321-933faba989ec/pkg/abi/linux/errno/errno.go (about)

     1  // Copyright 2018 The gVisor Authors.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  // Package errno holds errno codes for abi/linux.
    16  package errno
    17  
    18  // Errno represents a Linux errno value.
    19  type Errno uint32
    20  
    21  // Errno values from include/uapi/asm-generic/errno-base.h.
    22  const (
    23  	NOERRNO = iota
    24  	EPERM
    25  	ENOENT
    26  	ESRCH
    27  	EINTR
    28  	EIO
    29  	ENXIO
    30  	E2BIG
    31  	ENOEXEC
    32  	EBADF
    33  	ECHILD // 10
    34  	EAGAIN
    35  	ENOMEM
    36  	EACCES
    37  	EFAULT
    38  	ENOTBLK
    39  	EBUSY
    40  	EEXIST
    41  	EXDEV
    42  	ENODEV
    43  	ENOTDIR // 20
    44  	EISDIR
    45  	EINVAL
    46  	ENFILE
    47  	EMFILE
    48  	ENOTTY
    49  	ETXTBSY
    50  	EFBIG
    51  	ENOSPC
    52  	ESPIPE
    53  	EROFS // 30
    54  	EMLINK
    55  	EPIPE
    56  	EDOM
    57  	ERANGE
    58  	// Errno values from include/uapi/asm-generic/errno.h.
    59  	EDEADLK
    60  	ENAMETOOLONG
    61  	ENOLCK
    62  	ENOSYS
    63  	ENOTEMPTY
    64  	ELOOP  // 40
    65  	_      // Skip for EWOULDBLOCK = EAGAIN.
    66  	ENOMSG //42
    67  	EIDRM
    68  	ECHRNG
    69  	EL2NSYNC
    70  	EL3HLT
    71  	EL3RST
    72  	ELNRNG
    73  	EUNATCH
    74  	ENOCSI
    75  	EL2HLT // 50
    76  	EBADE
    77  	EBADR
    78  	EXFULL
    79  	ENOANO
    80  	EBADRQC
    81  	EBADSLT
    82  	_ // Skip for EDEADLOCK = EDEADLK.
    83  	EBFONT
    84  	ENOSTR // 60
    85  	ENODATA
    86  	ETIME
    87  	ENOSR
    88  	ENONET
    89  	ENOPKG
    90  	EREMOTE
    91  	ENOLINK
    92  	EADV
    93  	ESRMNT
    94  	ECOMM // 70
    95  	EPROTO
    96  	EMULTIHOP
    97  	EDOTDOT
    98  	EBADMSG
    99  	EOVERFLOW
   100  	ENOTUNIQ
   101  	EBADFD
   102  	EREMCHG
   103  	ELIBACC
   104  	ELIBBAD // 80
   105  	ELIBSCN
   106  	ELIBMAX
   107  	ELIBEXEC
   108  	EILSEQ
   109  	ERESTART
   110  	ESTRPIPE
   111  	EUSERS
   112  	ENOTSOCK
   113  	EDESTADDRREQ
   114  	EMSGSIZE // 90
   115  	EPROTOTYPE
   116  	ENOPROTOOPT
   117  	EPROTONOSUPPORT
   118  	ESOCKTNOSUPPORT
   119  	EOPNOTSUPP
   120  	EPFNOSUPPORT
   121  	EAFNOSUPPORT
   122  	EADDRINUSE
   123  	EADDRNOTAVAIL
   124  	ENETDOWN // 100
   125  	ENETUNREACH
   126  	ENETRESET
   127  	ECONNABORTED
   128  	ECONNRESET
   129  	ENOBUFS
   130  	EISCONN
   131  	ENOTCONN
   132  	ESHUTDOWN
   133  	ETOOMANYREFS
   134  	ETIMEDOUT // 110
   135  	ECONNREFUSED
   136  	EHOSTDOWN
   137  	EHOSTUNREACH
   138  	EALREADY
   139  	EINPROGRESS
   140  	ESTALE
   141  	EUCLEAN
   142  	ENOTNAM
   143  	ENAVAIL
   144  	EISNAM // 120
   145  	EREMOTEIO
   146  	EDQUOT
   147  	ENOMEDIUM
   148  	EMEDIUMTYPE
   149  	ECANCELED
   150  	ENOKEY
   151  	EKEYEXPIRED
   152  	EKEYREVOKED
   153  	EKEYREJECTED
   154  	EOWNERDEAD // 130
   155  	ENOTRECOVERABLE
   156  	ERFKILL
   157  	EHWPOISON
   158  )
   159  
   160  // errnos derived from other errnos.
   161  const (
   162  	EWOULDBLOCK = EAGAIN
   163  	EDEADLOCK   = EDEADLK
   164  )
   165  
   166  // errnos for internal errors.
   167  const (
   168  	// ERESTARTSYS is returned by an interrupted syscall to indicate that it
   169  	// should be converted to EINTR if interrupted by a signal delivered to a
   170  	// user handler without SA_RESTART set, and restarted otherwise.
   171  	ERESTARTSYS = 512
   172  
   173  	// ERESTARTNOINTR is returned by an interrupted syscall to indicate that it
   174  	// should always be restarted.
   175  	ERESTARTNOINTR = 513
   176  
   177  	// ERESTARTNOHAND is returned by an interrupted syscall to indicate that it
   178  	// should be converted to EINTR if interrupted by a signal delivered to a
   179  	// user handler, and restarted otherwise.
   180  	ERESTARTNOHAND = 514
   181  
   182  	// ERESTART_RESTARTBLOCK is returned by an interrupted syscall to indicate
   183  	// that it should be restarted using a custom function. The interrupted
   184  	// syscall must register a custom restart function by calling
   185  	// Task.SetRestartSyscallFn.
   186  	ERESTART_RESTARTBLOCK = 516
   187  )