Procházet zdrojové kódy

* Ales Katona's errors patch

git-svn-id: trunk@2210 -
marco před 19 roky
rodič
revize
27c92161d6
5 změnil soubory, kde provedl 405 přidání a 140 odebrání
  1. 3 0
      .gitattributes
  2. 125 0
      rtl/darwin/errnostr.inc
  3. 122 0
      rtl/freebsd/errnostr.inc
  4. 149 0
      rtl/linux/errnostr.inc
  5. 6 140
      rtl/unix/errors.pp

+ 3 - 0
.gitattributes

@@ -3648,6 +3648,7 @@ rtl/darwin/Makefile svneol=native#text/plain
 rtl/darwin/Makefile.fpc svneol=native#text/plain
 rtl/darwin/console.pp svneol=native#text/plain
 rtl/darwin/errno.inc svneol=native#text/plain
+rtl/darwin/errnostr.inc -text
 rtl/darwin/pmutext.inc svneol=native#text/plain
 rtl/darwin/powerpc/sig_cpu.inc svneol=native#text/plain
 rtl/darwin/powerpc/sighnd.inc svneol=native#text/plain
@@ -3688,6 +3689,7 @@ rtl/freebsd/Makefile.fpc svneol=native#text/plain
 rtl/freebsd/bsdport.txt svneol=native#text/plain
 rtl/freebsd/console.pp svneol=native#text/plain
 rtl/freebsd/errno.inc svneol=native#text/plain
+rtl/freebsd/errnostr.inc -text
 rtl/freebsd/i386/bsyscall.inc svneol=native#text/plain
 rtl/freebsd/i386/cprt0.as -text
 rtl/freebsd/i386/gprt0.as -text
@@ -3871,6 +3873,7 @@ rtl/linux/arm/syscallh.inc svneol=native#text/plain
 rtl/linux/arm/sysnr.inc svneol=native#text/plain
 rtl/linux/bunxsysc.inc svneol=native#text/plain
 rtl/linux/errno.inc svneol=native#text/plain
+rtl/linux/errnostr.inc -text
 rtl/linux/fpcylix.pp svneol=native#text/plain
 rtl/linux/fpmake.inc svneol=native#text/plain
 rtl/linux/gpm.pp svneol=native#text/plain

+ 125 - 0
rtl/darwin/errnostr.inc

@@ -0,0 +1,125 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2005 by Ales Katona
+
+    Contains BSD specific errors for error.pp in rtl/unix
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+const
+  sys_errn=94;
+  sys_errlist:array[0..sys_errn-1] of pchar = (
+        'Success',                              { 0 }
+        'Operation not permitted',              { EPERM }
+        'No such file or directory',            { ENOENT }
+        'No such process',                      { ESRCH }
+        'Interrupted system call',              { EINTR }
+        'I/O error',                            { EIO }
+        'No such device or address',            { ENXIO }
+        'Arg list too long',                    { E2BIG }
+        'Exec format error',                    { ENOEXEC }
+        'Bad file number',                      { EBADF }
+        'No child processes',                   { ECHILD }
+        'Resource deadlock avoided',   { EDEADLK was EAGAIN }
+        'Out of memory',                        { ENOMEM }
+        'Permission denied',                    { EACCES }
+        'Bad address',                          { EFAULT }
+        'Block device required',                { ENOTBLK }
+        'Device or resource busy',              { EBUSY }
+        'File exists',                          { EEXIST }
+        'Cross-device link',                    { EXDEV }
+        'No such device',                       { ENODEV }
+        'Not a directory',                      { ENOTDIR }
+        'Is a directory',                       { EISDIR }
+        'Invalid argument',                     { EINVAL }
+        'File table overflow',                  { ENFILE }
+        'Too many open files',                  { EMFILE }
+        'Not a typewriter',                     { ENOTTY }
+        'Text (code segment) file busy',        { ETXTBSY  Text file busy.  The new process was
+                                                    a pure procedure (shared text) file which was
+                                                    open for writing by another process, or file
+                                                    which was open for writing by another process,
+                                                    or while the pure procedure file was being
+                                                    executed an open(2) call requested write access
+                                                    requested write access.}
+        'File too large',                       { EFBIG }
+        'No space left on device',              { ENOSPC }
+        'Illegal seek',                         { ESPIPE }
+        'Read-only file system',                { EROFS }
+        'Too many links',                       { EMLINK }
+        'Broken pipe',                          { EPIPE }
+        'Math argument out of domain of func',  { EDOM }
+        'Math result not representable',        { ERANGE }
+        'Resource temporarily unavailable',        { EAGAIN }
+        'Operation now in progress',      { EINPROGRESS }
+        'Operation already in progress', { EALREADY	}
+// ipc/network software -- argument errors
+        'Socket operation on non-socket',    { ENOTSOCK }
+        'Destination address required',     { EDESTADDRREQ }
+        'Message too long',                     { EMSGSIZE }
+        'Protocol wrong type for socket', { EPROTOTYPE }
+        'Protocol not available',               { ENOPROTOOPT }
+        'Protocol not supported',              { EPROTONOSUPPORT }
+        'Socket type not supported',         { ESOCKTNOSUPPORT }
+        'Operation not supported',             { EOPNOTSUPP }
+        'Protocol family not supported',      { EPFNOSUPPORT }
+        'Address family not supported by protocol family',  { EAFNOSUPPORT }
+        'Address already in use',                { EADDRINUSE }
+        'Can''t assign requested address',  { EADDRNOTAVAIL }
+// ipc/network software -- operational errors
+        'Network is down',                            { ENETDOWN }
+        'Network is unreachable',                 { ENETUNREACH }
+        'Network dropped connection on reset', { ENETRESET }
+        'Software caused connection abort',   { ECONNABORTED }
+        'Connection reset by peer',                 { ECONNRESET }
+        'No buffer space available',                { ENOBUFS }
+        'Socket is already connected',            { EISCONN }
+        'Socket is not connected',                    { ENOTCONN }
+        'Can''t send after socket shutdown',    { ESHUTDOWN }
+        'Too many references: can''t splice',   { ETOOMANYREFS }
+        'Operation timed out',                           { ETIMEDOUT }
+        'Connection refused',                           { ECONNREFUSED }
+        'Too many levels of symbolic links',     { ELOOP }
+        'File name too long',                              { ENAMETOOLONG }
+        'Host is down',                                       { EHOSTDOWN }
+        'No route to host',                                  { EHOSTUNREACH }
+        'Directory not empty',                            { ENOTEMPTY }
+        'Too many processes',                           { EPROCLIM }
+        'Too many users',                                   { EUSERS }
+        'Disc quota exceeded',                           { EDQUOT }
+// Network File System
+        'Stale NFS file handle',                              { ESTALE }
+        'Too many levels of remote in path',        { EREMOTE }
+        'RPC struct is bad',                                    { EBADRPC }
+        'RPC version wrong',                                { ERPCMISMATCH }
+        'RPC prog. not avail',                                { EPROGUNAVAIL }
+        'Program version wrong',                          { EPROGMISMATCH }
+        'Bad procedure for program',                    { EPROCUNAVAIL }
+        'No locks available',                                   { ENOLCK }
+        'Function not implemented',                       { ENOSYS }
+        'Inappropriate file type or format',              { EFTYPE }
+        'Authentication error',                                 { EAUTH }
+        'Need authenticator',                                   { ENEEDAUTH }
+        // Intelligent device errors
+        'Device power is off',                                   { EPWROFF }
+        'Device error, e.g. paper out',                      { EDEVERR }
+        'Value too large to be stored in data type'   { EOVERFLOW }
+// Program loading errors
+        'Bad executable',                                         { EBADEXEC }
+        'Bad CPU type in executable',                      { EBADARCH }
+        'Shared library version mismatch',               { ESHLIBVERS }
+        'Malformed Macho file',                                 { EBADMACHO }
+        'Operation canceled',                                   { ECANCELED }
+        'Identifier removed',                                      { EIDRM }
+        'No message of desired type',                      { ENOMSG }
+        'llegal byte sequence',                                  { EILSEQ }
+        'Attribute not found'                                      { ENOATTR }
+);
+ 

+ 122 - 0
rtl/freebsd/errnostr.inc

@@ -0,0 +1,122 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2005 by Ales Katona
+
+    Contains BSD specific errors for error.pp in rtl/unix
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+const
+  sys_errn=93;
+  sys_errlist:array[0..sys_errn-1] of pchar = (
+        'Success',                              { 0 }
+        'Operation not permitted',              { EPERM }
+        'No such file or directory',            { ENOENT }
+        'No such process',                      { ESRCH }
+        'Interrupted system call',              { EINTR }
+        'I/O error',                            { EIO }
+        'No such device or address',            { ENXIO }
+        'Arg list too long',                    { E2BIG }
+        'Exec format error',                    { ENOEXEC }
+        'Bad file number',                      { EBADF }
+        'No child processes',                   { ECHILD }
+        'Resource deadlock avoided',   { EDEADLK was EAGAIN }
+        'Out of memory',                        { ENOMEM }
+        'Permission denied',                    { EACCES }
+        'Bad address',                          { EFAULT }
+        'Block device required',                { ENOTBLK }
+        'Device or resource busy',              { EBUSY }
+        'File exists',                          { EEXIST }
+        'Cross-device link',                    { EXDEV }
+        'No such device',                       { ENODEV }
+        'Not a directory',                      { ENOTDIR }
+        'Is a directory',                       { EISDIR }
+        'Invalid argument',                     { EINVAL }
+        'File table overflow',                  { ENFILE }
+        'Too many open files',                  { EMFILE }
+        'Not a typewriter',                     { ENOTTY }
+        'Text (code segment) file busy',        { ETXTBSY  Text file busy.  The new process was
+                                                    a pure procedure (shared text) file which was
+                                                    open for writing by another process, or file
+                                                    which was open for writing by another process,
+                                                    or while the pure procedure file was being
+                                                    executed an open(2) call requested write access
+                                                    requested write access.}
+        'File too large',                       { EFBIG }
+        'No space left on device',              { ENOSPC }
+        'Illegal seek',                         { ESPIPE }
+        'Read-only file system',                { EROFS }
+        'Too many links',                       { EMLINK }
+        'Broken pipe',                          { EPIPE }
+        'Math argument out of domain of func',  { EDOM }
+        'Math result not representable',        { ERANGE }
+        'Resource temporarily unavailable',        { EAGAIN }
+        'Operation now in progress',      { EINPROGRESS }
+        'Operation already in progress', { EALREADY	}
+// ipc/network software -- argument errors
+        'Socket operation on non-socket',    { ENOTSOCK }
+        'Destination address required',     { EDESTADDRREQ }
+        'Message too long',                     { EMSGSIZE }
+        'Protocol wrong type for socket', { EPROTOTYPE }
+        'Protocol not available',               { ENOPROTOOPT }
+        'Protocol not supported',              { EPROTONOSUPPORT }
+        'Socket type not supported',         { ESOCKTNOSUPPORT }
+        'Operation not supported',             { EOPNOTSUPP }
+        'Protocol family not supported',      { EPFNOSUPPORT }
+        'Address family not supported by protocol family',  { EAFNOSUPPORT }
+        'Address already in use',                { EADDRINUSE }
+        'Can''t assign requested address',  { EADDRNOTAVAIL }
+// ipc/network software -- operational errors
+        'Network is down',                            { ENETDOWN }
+        'Network is unreachable',                 { ENETUNREACH }
+        'Network dropped connection on reset', { ENETRESET }
+        'Software caused connection abort',   { ECONNABORTED }
+        'Connection reset by peer',                 { ECONNRESET }
+        'No buffer space available',                { ENOBUFS }
+        'Socket is already connected',            { EISCONN }
+        'Socket is not connected',                    { ENOTCONN }
+        'Can''t send after socket shutdown',    { ESHUTDOWN }
+        'Too many references: can''t splice',   { ETOOMANYREFS }
+        'Operation timed out',                           { ETIMEDOUT }
+        'Connection refused',                           { ECONNREFUSED }
+        'Too many levels of symbolic links',     { ELOOP }
+        'File name too long',                              { ENAMETOOLONG }
+        'Host is down',                                       { EHOSTDOWN }
+        'No route to host',                                  { EHOSTUNREACH }
+        'Directory not empty',                            { ENOTEMPTY }
+        'Too many processes',                           { EPROCLIM }
+        'Too many users',                                   { EUSERS }
+        'Disc quota exceeded',                           { EDQUOT }
+// Network File System
+        'Stale NFS file handle',                              { ESTALE }
+        'Too many levels of remote in path',        { EREMOTE }
+        'RPC struct is bad',                                    { EBADRPC }
+        'RPC version wrong',                                { ERPCMISMATCH }
+        'RPC prog. not avail',                                { EPROGUNAVAIL }
+        'Program version wrong',                          { EPROGMISMATCH }
+        'Bad procedure for program',                    { EPROCUNAVAIL }
+        'No locks available',                                   { ENOLCK }
+        'Function not implemented',                       { ENOSYS }
+        'Inappropriate file type or format',              { EFTYPE }
+        'Authentication error',                                 { EAUTH }
+        'Need authenticator',                                   { ENEEDAUTH }
+        'Identifier removed',                                   { EIDRM }
+        'No message of desired type',                   { ENOMSG }
+        'Value too large to be stored in data type', { EOVERFLOW }
+        'Operation canceled',                                  { ECANCELED }
+        'Illegal byte sequence',                                { EILSEQ }
+        'Attribute not found',                                    { ENOATTR }
+        'Programming error',                                    { EDOOFUS }
+        'Bad message',                                            { EBADMSG }
+        'Multihop attempted',                                   { EMULTIHOP }
+        'Link has been severed',                              { ENOLINK }
+        'Protocol error'                                             { EPROTO }
+);
+ 

+ 149 - 0
rtl/linux/errnostr.inc

@@ -0,0 +1,149 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2005 by Ales Katona
+
+    Contains Linux specific errors for error.pp in rtl/unix
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+const
+  sys_errn=125;
+  sys_errlist:array[0..sys_errn-1] of pchar = (
+        'Success',                              { 0 }
+        'Operation not permitted',              { EPERM }
+        'No such file or directory',            { ENOENT }
+        'No such process',                      { ESRCH }
+        'Interrupted system call',              { EINTR }
+        'I/O error',                            { EIO }
+        'No such device or address',            { ENXIO }
+        'Arg list too long',                    { E2BIG }
+        'Exec format error',                    { ENOEXEC }
+        'Bad file number',                      { EBADF }
+        'No child processes',                   { ECHILD }
+        'Try again',                            { EAGAIN }
+        'Out of memory',                        { ENOMEM }
+        'Permission denied',                    { EACCES }
+        'Bad address',                          { EFAULT }
+        'Block device required',                { ENOTBLK }
+        'Device or resource busy',              { EBUSY }
+        'File exists',                          { EEXIST }
+        'Cross-device link',                    { EXDEV }
+        'No such device',                       { ENODEV }
+        'Not a directory',                      { ENOTDIR }
+        'Is a directory',                       { EISDIR }
+        'Invalid argument',                     { EINVAL }
+        'File table overflow',                  { ENFILE }
+        'Too many open files',                  { EMFILE }
+        'Not a typewriter',                     { ENOTTY }
+        'Text (code segment) file busy',        { ETXTBSY  Text file busy.  The new process was
+                                                    a pure procedure (shared text) file which was
+                                                    open for writing by another process, or file
+                                                    which was open for writing by another process,
+                                                    or while the pure procedure file was being
+                                                    executed an open(2) call requested write access
+                                                    requested write access.}
+        'File too large',                       { EFBIG }
+        'No space left on device',              { ENOSPC }
+        'Illegal seek',                         { ESPIPE }
+        'Read-only file system',                { EROFS }
+        'Too many links',                       { EMLINK }
+        'Broken pipe',                          { EPIPE }
+        'Math argument out of domain of func',  { EDOM }
+        'Math result not representable',        { ERANGE }
+        'Resource deadlock would occur',        { EDEADLK }
+        'File name too long',                   { ENAMETOOLONG }
+        'No record locks available',            { ENOLCK }
+        'Function not implemented',             { ENOSYS }
+        'Directory not empty',                  { ENOTEMPTY }
+        'Too many symbolic links encountered',  { ELOOP }
+        'Operation would block',                { EWOULDBLOCK }
+        'No message of desired type',           { ENOMSG }
+        'Identifier removed',                   { EIDRM }
+        'Channel number out of range',          { ECHRNG }
+        'Level 2 not synchronized',             { EL2NSYNC }
+        'Level 3 halted',                       { EL3HLT }
+        'Level 3 reset',                        { EL3RST }
+        'Link number out of range',             { ELNRNG }
+        'Protocol driver not attached',         { EUNATCH }
+        'No CSI structure available',           { ENOCSI }
+        'Level 2 halted',                       { EL2HLT }
+        'Invalid exchange',                     { EBADE }
+        'Invalid request descriptor',           { EBADR }
+        'Exchange full',                        { EXFULL }
+        'No anode',                             { ENOANO }
+        'Invalid request code',                 { EBADRQC }
+        'Invalid slot',                         { EBADSLT }
+        'File locking deadlock error',          { EDEADLOCK }
+        'Bad font file format',                 { EBFONT }
+        'Device not a stream',                  { ENOSTR }
+        'No data available',                    { ENODATA }
+        'Timer expired',                        { ETIME }
+        'Out of streams resources',             { ENOSR }
+        'Machine is not on the network',        { ENONET }
+        'Package not installed',                { ENOPKG }
+        'Object is remote',                     { EREMOTE }
+        'Link has been severed',                { ENOLINK }
+        'Advertise error',                      { EADV }
+        'Srmount error',                        { ESRMNT }
+        'Communication error on send',          { ECOMM }
+        'Protocol error',                       { EPROTO }
+        'Multihop attempted',                   { EMULTIHOP }
+        'RFS specific error',                   { EDOTDOT }
+        'Not a data message',                   { EBADMSG }
+        'Value too large for defined data type',        { EOVERFLOW }
+        'Name not unique on network',           { ENOTUNIQ }
+        'File descriptor in bad state',         { EBADFD }
+        'Remote address changed',               { EREMCHG }
+        'Can not access a needed shared library',       { ELIBACC }
+        'Accessing a corrupted shared library',         { ELIBBAD }
+        '.lib section in a.out corrupted',      { ELIBSCN }
+        'Attempting to link in too many shared libraries',      { ELIBMAX }
+        'Cannot exec a shared library directly',        { ELIBEXEC }
+        'Illegal byte sequence',                { EILSEQ }
+        'Interrupted system call should be restarted',  { ERESTART }
+        'Streams pipe error',                   { ESTRPIPE }
+        'Too many users',                       { EUSERS }
+        'Socket operation on non-socket',       { ENOTSOCK }
+        'Destination address required',         { EDESTADDRREQ }
+        'Message too long',                     { EMSGSIZE }
+        'Protocol wrong type for socket',       { EPROTOTYPE }
+        'Protocol not available',               { ENOPROTOOPT }
+        'Protocol not supported',               { EPROTONOSUPPORT }
+        'Socket type not supported',            { ESOCKTNOSUPPORT }
+        'Operation not supported on transport endpoint',        { EOPNOTSUPP }
+        'Protocol family not supported',        { EPFNOSUPPORT }
+        'Address family not supported by protocol',     { EAFNOSUPPORT }
+        'Address already in use',               { EADDRINUSE }
+        'Cannot assign requested address',      { EADDRNOTAVAIL }
+        'Network is down',                      { ENETDOWN }
+        'Network is unreachable',               { ENETUNREACH }
+        'Network dropped connection because of reset',  { ENETRESET }
+        'Software caused connection abort',     { ECONNABORTED }
+        'Connection reset by peer',             { ECONNRESET }
+        'No buffer space available',            { ENOBUFS }
+        'Transport endpoint is already connected',      { EISCONN }
+        'Transport endpoint is not connected',  { ENOTCONN }
+        'Cannot send after transport endpoint shutdown',        { ESHUTDOWN }
+        'Too many references: cannot splice',   { ETOOMANYREFS }
+        'Connection timed out',                 { ETIMEDOUT }
+        'Connection refused',                   { ECONNREFUSED }
+        'Host is down',                         { EHOSTDOWN }
+        'No route to host',                     { EHOSTUNREACH }
+        'Operation already in progress',        { EALREADY }
+        'Operation now in progress',            { EINPROGRESS }
+        'Stale NFS file handle',                { ESTALE }
+        'Structure needs cleaning',             { EUCLEAN }
+        'Not a XENIX named type file',          { ENOTNAM }
+        'No XENIX semaphores available',        { ENAVAIL }
+        'Is a named type file',                 { EISNAM }
+        'Remote I/O error',                     { EREMOTEIO }
+        'Quota exceeded',                       { EDQUOT }
+        'No medium found',                      { ENOMEDIUM }
+        'Wrong medium type');                   { EMEDIUMTYPE }

+ 6 - 140
rtl/unix/errors.pp

@@ -11,154 +11,20 @@
 
  **********************************************************************}
 
-
 Unit errors;
 
 Interface
 
-uses strings;
+uses strings,unixtype;
 
-const
-  sys_errn=125;
-  sys_errlist:array[0..sys_errn-1] of pchar = (
-        'Success',                              { 0 }
-        'Operation not permitted',              { EPERM }
-        'No such file or directory',            { ENOENT }
-        'No such process',                      { ESRCH }
-        'Interrupted system call',              { EINTR }
-        'I/O error',                            { EIO }
-        'No such device or address',            { ENXIO }
-        'Arg list too long',                    { E2BIG }
-        'Exec format error',                    { ENOEXEC }
-        'Bad file number',                      { EBADF }
-        'No child processes',                   { ECHILD }
-        'Try again',                            { EAGAIN }
-        'Out of memory',                        { ENOMEM }
-        'Permission denied',                    { EACCES }
-        'Bad address',                          { EFAULT }
-        'Block device required',                { ENOTBLK }
-        'Device or resource busy',              { EBUSY }
-        'File exists',                          { EEXIST }
-        'Cross-device link',                    { EXDEV }
-        'No such device',                       { ENODEV }
-        'Not a directory',                      { ENOTDIR }
-        'Is a directory',                       { EISDIR }
-        'Invalid argument',                     { EINVAL }
-        'File table overflow',                  { ENFILE }
-        'Too many open files',                  { EMFILE }
-        'Not a typewriter',                     { ENOTTY }
-        'Text (code segment) file busy',        { ETXTBSY  Text file busy.  The new process was
-                                                    a pure procedure (shared text) file which was
-                                                    open for writing by another process, or file
-                                                    which was open for writing by another process,
-                                                    or while the pure procedure file was being
-                                                    executed an open(2) call requested write access
-                                                    requested write access.}
-        'File too large',                       { EFBIG }
-        'No space left on device',              { ENOSPC }
-        'Illegal seek',                         { ESPIPE }
-        'Read-only file system',                { EROFS }
-        'Too many links',                       { EMLINK }
-        'Broken pipe',                          { EPIPE }
-        'Math argument out of domain of func',  { EDOM }
-        'Math result not representable',        { ERANGE }
-        'Resource deadlock would occur',        { EDEADLK }
-        'File name too long',                   { ENAMETOOLONG }
-        'No record locks available',            { ENOLCK }
-        'Function not implemented',             { ENOSYS }
-        'Directory not empty',                  { ENOTEMPTY }
-        'Too many symbolic links encountered',  { ELOOP }
-        'Operation would block',                { EWOULDBLOCK }
-        'No message of desired type',           { ENOMSG }
-        'Identifier removed',                   { EIDRM }
-        'Channel number out of range',          { ECHRNG }
-        'Level 2 not synchronized',             { EL2NSYNC }
-        'Level 3 halted',                       { EL3HLT }
-        'Level 3 reset',                        { EL3RST }
-        'Link number out of range',             { ELNRNG }
-        'Protocol driver not attached',         { EUNATCH }
-        'No CSI structure available',           { ENOCSI }
-        'Level 2 halted',                       { EL2HLT }
-        'Invalid exchange',                     { EBADE }
-        'Invalid request descriptor',           { EBADR }
-        'Exchange full',                        { EXFULL }
-        'No anode',                             { ENOANO }
-        'Invalid request code',                 { EBADRQC }
-        'Invalid slot',                         { EBADSLT }
-        'File locking deadlock error',          { EDEADLOCK }
-        'Bad font file format',                 { EBFONT }
-        'Device not a stream',                  { ENOSTR }
-        'No data available',                    { ENODATA }
-        'Timer expired',                        { ETIME }
-        'Out of streams resources',             { ENOSR }
-        'Machine is not on the network',        { ENONET }
-        'Package not installed',                { ENOPKG }
-        'Object is remote',                     { EREMOTE }
-        'Link has been severed',                { ENOLINK }
-        'Advertise error',                      { EADV }
-        'Srmount error',                        { ESRMNT }
-        'Communication error on send',          { ECOMM }
-        'Protocol error',                       { EPROTO }
-        'Multihop attempted',                   { EMULTIHOP }
-        'RFS specific error',                   { EDOTDOT }
-        'Not a data message',                   { EBADMSG }
-        'Value too large for defined data type',        { EOVERFLOW }
-        'Name not unique on network',           { ENOTUNIQ }
-        'File descriptor in bad state',         { EBADFD }
-        'Remote address changed',               { EREMCHG }
-        'Can not access a needed shared library',       { ELIBACC }
-        'Accessing a corrupted shared library',         { ELIBBAD }
-        '.lib section in a.out corrupted',      { ELIBSCN }
-        'Attempting to link in too many shared libraries',      { ELIBMAX }
-        'Cannot exec a shared library directly',        { ELIBEXEC }
-        'Illegal byte sequence',                { EILSEQ }
-        'Interrupted system call should be restarted',  { ERESTART }
-        'Streams pipe error',                   { ESTRPIPE }
-        'Too many users',                       { EUSERS }
-        'Socket operation on non-socket',       { ENOTSOCK }
-        'Destination address required',         { EDESTADDRREQ }
-        'Message too long',                     { EMSGSIZE }
-        'Protocol wrong type for socket',       { EPROTOTYPE }
-        'Protocol not available',               { ENOPROTOOPT }
-        'Protocol not supported',               { EPROTONOSUPPORT }
-        'Socket type not supported',            { ESOCKTNOSUPPORT }
-        'Operation not supported on transport endpoint',        { EOPNOTSUPP }
-        'Protocol family not supported',        { EPFNOSUPPORT }
-        'Address family not supported by protocol',     { EAFNOSUPPORT }
-        'Address already in use',               { EADDRINUSE }
-        'Cannot assign requested address',      { EADDRNOTAVAIL }
-        'Network is down',                      { ENETDOWN }
-        'Network is unreachable',               { ENETUNREACH }
-        'Network dropped connection because of reset',  { ENETRESET }
-        'Software caused connection abort',     { ECONNABORTED }
-        'Connection reset by peer',             { ECONNRESET }
-        'No buffer space available',            { ENOBUFS }
-        'Transport endpoint is already connected',      { EISCONN }
-        'Transport endpoint is not connected',  { ENOTCONN }
-        'Cannot send after transport endpoint shutdown',        { ESHUTDOWN }
-        'Too many references: cannot splice',   { ETOOMANYREFS }
-        'Connection timed out',                 { ETIMEDOUT }
-        'Connection refused',                   { ECONNREFUSED }
-        'Host is down',                         { EHOSTDOWN }
-        'No route to host',                     { EHOSTUNREACH }
-        'Operation already in progress',        { EALREADY }
-        'Operation now in progress',            { EINPROGRESS }
-        'Stale NFS file handle',                { ESTALE }
-        'Structure needs cleaning',             { EUCLEAN }
-        'Not a XENIX named type file',          { ENOTNAM }
-        'No XENIX semaphores available',        { ENAVAIL }
-        'Is a named type file',                 { EISNAM }
-        'Remote I/O error',                     { EREMOTEIO }
-        'Quota exceeded',                       { EDQUOT }
-        'No medium found',                      { ENOMEDIUM }
-        'Wrong medium type');                   { EMEDIUMTYPE }
+{$i errnostr.inc} // BSD or Linux ones
 
-Function  StrError(err:longint):string;
-Procedure PError(const s:string; Errno : longint);
+Function  StrError(err:cint):string;
+Procedure PError(const s:string; Errno : cint);
 
 Implementation
 
-Function StrError(err:longint):string;
+Function StrError(err:cint):string;
 var s : string[12];
 begin
   if (err<0) or (err>=sys_errn) then
@@ -171,7 +37,7 @@ begin
 end;
 
 
-procedure PError(const s:string; Errno : longint);
+procedure PError(const s:string; Errno : cint);
 begin
   WriteLn(stderr,s,': ',StrError(ErrNo));
 end;