[Lazarus] Unknown error codes.

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] Unknown error codes.

Free Pascal - Lazarus mailing list
Hi,

The other day I got this error in a program (on Linux):

cer@Telcontar:~/bin/lazarus/mios> ./crc32test ./crc32test
An unhandled exception occurred at $0000000000400951:
EInOutError: Unknown Run-Time error : 026
  $0000000000400951 line 26 of crc32test.lpr
  $0000000000400A5C line 42 of crc32test.lpr

crc32 = cer@Telcontar:~/bin/lazarus/mios>


Notice the "Unknown" there. And indeed, error 26 is not listed here:

<https://www.freepascal.org/docs-html/rtl/system/ioresult.html>


A friend pointed me to this file:

/usr/include/asm-generic/errno-base.h

and there it is indeed listed:

#define ETXTBSY         26      /* Text file busy */

The error number does match the situation: the IDE has hold of that file
for debugging. Interesting.


But the problem is, why is that error not listed, unknown?

Today a poster wrote about this other error (subject: [Lazarus] Runtime
error: INCLOCKED):

Runtime error 216 at $0000000000400BD5
  $0000000000400BD5  INCLOCKED
  $0000000000400216  DISPLAY,  line 23 of project1.lpr
  $0000000000400360  main,  line 32 of project1.lpr
  $000000000042BE00  SYSENTRY,  line 129 of system.pp
  $00000000004001D2


which is not listed. I do not know if he is running Linux or Windows, so
I have no idea either what the error is in his case.

Do we know of more places that list those error numbers? Can we compose
a full list?

By the way, C has a function: "strerror(26)" which returns the text
message for the error. I don't know if we have.



--
Cheers / Saludos,

                Carlos E. R.
                (from 42.3 x86_64 "Malachite" at Telcontar)


--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus

signature.asc (188 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Unknown error codes.

Free Pascal - Lazarus mailing list
On 04/29/2018 03:00 PM, Carlos E. R. via Lazarus wrote:
Hi,

The other day I got this error in a program (on Linux):

cer@Telcontar:~/bin/lazarus/mios> ./crc32test ./crc32test
An unhandled exception occurred at $0000000000400951:
EInOutError: Unknown Run-Time error : 026
  $0000000000400951 line 26 of crc32test.lpr
  $0000000000400A5C line 42 of crc32test.lpr

crc32 = cer@Telcontar:~/bin/lazarus/mios>


Notice the "Unknown" there. And indeed, error 26 is not listed here:

<https://www.freepascal.org/docs-html/rtl/system/ioresult.html>


A friend pointed me to this file:

/usr/include/asm-generic/errno-base.h

and there it is indeed listed:

#define ETXTBSY         26      /* Text file busy */

The error number does match the situation: the IDE has hold of that file
for debugging. Interesting.


But the problem is, why is that error not listed, unknown?

Today a poster wrote about this other error (subject: [Lazarus] Runtime
error: INCLOCKED):

Runtime error 216 at $0000000000400BD5
  $0000000000400BD5  INCLOCKED
  $0000000000400216  DISPLAY,  line 23 of project1.lpr
  $0000000000400360  main,  line 32 of project1.lpr
  $000000000042BE00  SYSENTRY,  line 129 of system.pp
  $00000000004001D2


which is not listed. I do not know if he is running Linux or Windows, so
I have no idea either what the error is in his case.

Do we know of more places that list those error numbers? Can we compose
a full list?

By the way, C has a function: "strerror(26)" which returns the text
message for the error. I don't know if we have.






216 is a General Protection Fault.

for other errors see:  https://freepascal.org/docs-html/user/userap4.html

Don Ziesig


--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Unknown error codes.

Free Pascal - Lazarus mailing list
On 2018-04-29 22:07, Donald Ziesig via Lazarus wrote:

> On 04/29/2018 03:00 PM, Carlos E. R. via Lazarus wrote:
>> Hi,
>>
>> The other day I got this error in a program (on Linux):
>>
>> cer@Telcontar:~/bin/lazarus/mios> ./crc32test ./crc32test
>> An unhandled exception occurred at $0000000000400951:
>> EInOutError: Unknown Run-Time error : 026
>>   $0000000000400951 line 26 of crc32test.lpr
>>   $0000000000400A5C line 42 of crc32test.lpr
>>
>> crc32 = cer@Telcontar:~/bin/lazarus/mios>
>>
>>
>> Notice the "Unknown" there. And indeed, error 26 is not listed here:
>>
>> <https://www.freepascal.org/docs-html/rtl/system/ioresult.html>
>>
>>
>> A friend pointed me to this file:
>>
>> /usr/include/asm-generic/errno-base.h
...

>> Runtime error 216 at $0000000000400BD5
>>   $0000000000400BD5  INCLOCKED
>>   $0000000000400216  DISPLAY,  line 23 of project1.lpr
>>   $0000000000400360  main,  line 32 of project1.lpr
>>   $000000000042BE00  SYSENTRY,  line 129 of system.pp
>>   $00000000004001D2

...

> 216 is a General Protection Fault.
>
> for other errors see:  https://freepascal.org/docs-html/user/userap4.html

It does not list the error 26 I got.

It is possible that there are different numbers on different operating
systems? That list seems to be related to Windows, but the link does not
say.

--
Cheers / Saludos,

                Carlos E. R.
                (from 42.3 x86_64 "Malachite" at Telcontar)


--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus

signature.asc (188 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Unknown error codes.

Free Pascal - Lazarus mailing list
On 29-04-2018 23:55, Carlos E. R. via Lazarus wrote:
It does not list the error 26 I got.
It is possible that there are different numbers on different operating
systems? That list seems to be related to Windows, but the link does not
say.

It's always possible to get the text of an OS error via SysErrorMessage().

Also note that the EInOutError codes in the range 0-99 represent OS error conditions, which are different for Windows and Linux. At least in Delphi they do.

On Linux Showmessage(SysErrorMessage(26)) gives us:
Text (code segment) file busy

On Windows it gives:
The specified disk or diskette cannot be accessed.

Of course a program can generate an runtime error itself via Error(Code) in which case the code didn't come from the OS and it might mean something different.

Small test-program will give you a list:
var
  I: Integer;
begin
  for I := 0 to 99 do
  begin
    Memo1.Lines.Add(Format('%d - %s', [I, SysErrorMessage(I)]));
  end;

On Windows it gives:
0 - The operation completed successfully.
1 - Incorrect function.
2 - The system cannot find the file specified.
3 - The system cannot find the path specified.
4 - The system cannot open the file.
5 - Access is denied.
6 - The handle is invalid.
7 - The storage control blocks were destroyed.
8 - Not enough storage is available to process this command.
9 - The storage control block address is invalid.
10 - The environment is incorrect.
11 - An attempt was made to load a program with an incorrect format.
12 - The access code is invalid.
13 - The data is invalid.
14 - Not enough storage is available to complete this operation.
15 - The system cannot find the drive specified.
16 - The directory cannot be removed.
17 - The system cannot move the file to a different disk drive.
18 - There are no more files.
19 - The media is write protected.
20 - The system cannot find the device specified.
21 - The device is not ready.
22 - The device does not recognize the command.
23 - Data error (cyclic redundancy check).
24 - The program issued a command but the command length is incorrect.
25 - The drive cannot locate a specific area or track on the disk.
26 - The specified disk or diskette cannot be accessed.
27 - The drive cannot find the sector requested.
28 - The printer is out of paper.
29 - The system cannot write to the specified device.
30 - The system cannot read from the specified device.
31 - A device attached to the system is not functioning.
32 - The process cannot access the file because it is being used by another process.
33 - The process cannot access the file because another process has locked a portion of the file.
34 -
35 -
36 - Too many files opened for sharing.
37 -
38 - Reached the end of the file.
39 - The disk is full.
40 -
41 -
42 -
43 -
44 -
45 -
46 -
47 -
48 -
49 -
50 - The request is not supported.
51 - Windows cannot find the network path. Verify that the network path is correct and the destination computer is not busy or turned off. If Windows still cannot find the network path, contact your network administrator.
52 - You were not connected because a duplicate name exists on the network. If joining a domain, go to System in Control Panel to change the computer name and try again. If joining a workgroup, choose another workgroup name.
53 - The network path was not found.
54 - The network is busy.
55 - The specified network resource or device is no longer available.
56 - The network BIOS command limit has been reached.
57 - A network adapter hardware error occurred.
58 - The specified server cannot perform the requested operation.
59 - An unexpected network error occurred.
60 - The remote adapter is not compatible.
61 - The printer queue is full.
62 - Space to store the file waiting to be printed is not available on the server.
63 - Your file waiting to be printed was deleted.
64 - The specified network name is no longer available.
65 - Network access is denied.
66 - The network resource type is not correct.
67 - The network name cannot be found.
68 - The name limit for the local computer network adapter card was exceeded.
69 - The network BIOS session limit was exceeded.
70 - The remote server has been paused or is in the process of being started.
71 - No more connections can be made to this remote computer at this time because there are already as many connections as the computer can accept.
72 - The specified printer or disk device has been paused.
73 -
74 -
75 -
76 -
77 -
78 -
79 -
80 - The file exists.
81 -
82 - The directory or file cannot be created.
83 - Fail on INT 24.
84 - Storage to process this request is not available.
85 - The local device name is already in use.
86 - The specified network password is not correct.
87 - The parameter is incorrect.
88 - A write fault occurred on the network.
89 - The system cannot start another process at this time.
90 -
91 -
92 -
93 -
94 -
95 -
96 -
97 -
98 -
99 -

On Linux it gives:
0 - Success
1 - Operation not permitted
2 - No such file or directory
3 - No such process
4 - Interrupted system call
5 - I/O error
6 - No such device or address
7 - Arg list too long
8 - Exec format error
9 - Bad file number
10 - No child processes
11 - Try again
12 - Out of memory
13 - Permission denied
14 - Bad address
15 - Block device required
16 - Device or resource busy
17 - File exists
18 - Cross-device link
19 - No such device
20 - Not a directory
21 - Is a directory
22 - Invalid argument
23 - File table overflow
24 - Too many open files
25 - Not a typewriter
26 - Text (code segment) file busy
27 - File too large
28 - No space left on device
29 - Illegal seek
30 - Read-only file system
31 - Too many links
32 - Broken pipe
33 - Math argument out of domain of func
34 - Math result not representable
35 - Resource deadlock would occur
36 - File name too long
37 - No record locks available
38 - Function not implemented
39 - Directory not empty
40 - Too many symbolic links encountered
41 - Operation would block
42 - No message of desired type
43 - Identifier removed
44 - Channel number out of range
45 - Level 2 not synchronized
46 - Level 3 halted
47 - Level 3 reset
48 - Link number out of range
49 - Protocol driver not attached
50 - No CSI structure available
51 - Level 2 halted
52 - Invalid exchange
53 - Invalid request descriptor
54 - Exchange full
55 - No anode
56 - Invalid request code
57 - Invalid slot
58 - File locking deadlock error
59 - Bad font file format
60 - Device not a stream
61 - No data available
62 - Timer expired
63 - Out of streams resources
64 - Machine is not on the network
65 - Package not installed
66 - Object is remote
67 - Link has been severed
68 - Advertise error
69 - Srmount error
70 - Communication error on send
71 - Protocol error
72 - Multihop attempted
73 - RFS specific error
74 - Not a data message
75 - Value too large for defined data type
76 - Name not unique on network
77 - File descriptor in bad state
78 - Remote address changed
79 - Can not access a needed shared library
80 - Accessing a corrupted shared library
81 - .lib section in a.out corrupted
82 - Attempting to link in too many shared libraries
83 - Cannot exec a shared library directly
84 - Illegal byte sequence
85 - Interrupted system call should be restarted
86 - Streams pipe error
87 - Too many users
88 - Socket operation on non-socket
89 - Destination address required
90 - Message too long
91 - Protocol wrong type for socket
92 - Protocol not available
93 - Protocol not supported
94 - Socket type not supported
95 - Operation not supported on transport endpoint
96 - Protocol family not supported
97 - Address family not supported by protocol
98 - Address already in use
99 - Cannot assign requested address

So, because of the differences in Windows and Linux it might be best to always show the SysErrorMessage(code) too (if it is indeed an OS error). It will generate a much clearer message.

Rik


--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Unknown error codes.

Free Pascal - Lazarus mailing list
On 2018-05-01 10:48, Rik van Kekem via Lazarus wrote:
> On 29-04-2018 23:55, Carlos E. R. via Lazarus wrote:
>> It does not list the error 26 I got.
>> It is possible that there are different numbers on different operating
>> systems? That list seems to be related to Windows, but the link does not
>> say.
>>
> It's always possible to get the text of an OS error via SysErrorMessage().

Ah!  I have been looking for such a function for hours. Yesterday I created my own functions to output text, getting the help from several help sources. Ok, Scrap those!


>
> Also note that the EInOutError codes in the range 0-99 represent OS
> error conditions, which are different for Windows and Linux. At least in
> Delphi they do.

Ok.

>
> On Linux Showmessage(SysErrorMessage(26)) gives us:
> Text (code segment) file busy

Yes, it matches.


> On Windows it gives:
> The specified disk or diskette cannot be accessed.
>
> Of course a program can generate an runtime error itself via Error(Code)
> in which case the code didn't come from the OS and it might mean
> something different.

Ah.

It maybe these: https://freepascal.org/docs-html/user/userap4.html

Yesterday I wrote my own Function RunTimeErrorString(I: Word): string; from that list.

begin
   case I of
       1: RunTimeErrorString:= 'Invalid function number';         //An invalid operating system call was attempted.
       2: RunTimeErrorString:= ' File not found';                 //Reported when trying to erase, rename or open a non-existent file.
       3: RunTimeErrorString:= ' Path not found';                 //Reported by the directory handling routines when a path does not exist or is invalid. Also reported when trying to access a non-existent file.
       4: RunTimeErrorString:= ' Too many open files';            //The maximum number of files currently opened by your process has been reached. Certain operating systems limit the number of files which can be opened concurrently, and this error can occur when this limit has been reached.
       5: RunTimeErrorString:= ' File access denied';             //Permission to access the file is denied. This error might be caused by one of several reasons:
...

(I can post it complete if it is of interest)


> Small test-program will give you a list:
> var
>   I: Integer;
> begin
>   for I := 0 to 99 do
>   begin
>     Memo1.Lines.Add(Format('%d - %s', [I, SysErrorMessage(I)]));
>   end;

:-)


> On Windows it gives:
> 0 - The operation completed successfully.
> 1 - Incorrect function.> 2 - The system cannot find the file specified.
> 3 - The system cannot find the path specified.
> 4 - The system cannot open the file.
> 5 - Access is denied.
...
> 99 -
>
> On Linux it gives:
> 0 - Success
> 1 - Operation not permitted
> 2 - No such file or directory
> 3 - No such process
> 4 - Interrupted system call
> 5 - I/O error
...
> 99 - Cannot assign requested address
>
> So, because of the differences in Windows and Linux it might be best to
> always show the SysErrorMessage(code) too (if it is indeed an OS error).
> It will generate a much clearer message.

Yes, indeed.

Thank you!


--
Cheers / Saludos,

                Carlos E. R.
                (from 42.3 x86_64 "Malachite" at Telcontar)


--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus

signature.asc (188 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Unknown error codes.

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On 2018-05-01 10:48, Rik van Kekem via Lazarus wrote:
>
> Small test-program will give you a list:
> var
>   I: Integer;
> begin
>   for I := 0 to 99 do
>   begin
>     Memo1.Lines.Add(Format('%d - %s', [I, SysErrorMessage(I)]));
>   end;

In fact, it also prints errors beyond 100:

program errormessages;
uses
   sysutils;

var
    I: Integer;
begin
   for I := 0 to 200 do
   begin
      Writeln(I, ': ', SysErrorMessage(I));
   end;
end.

...
99: Cannot assign requested address
100: Network is down
101: Network is unreachable
102: Network dropped connection because of reset
103: Software caused connection abort
104: Connection reset by peer
105: No buffer space available
106: Transport endpoint is already connected
107: Transport endpoint is not connected
108: Cannot send after transport endpoint shutdown
109: Too many references: cannot splice
110: Connection timed out
111: Connection refused
112: Host is down
113: No route to host
114: Operation already in progress
115: Operation now in progress
116: Stale NFS file handle
117: Structure needs cleaning
118: Not a XENIX named type file
119: No XENIX semaphores available
120: Is a named type file
121: Remote I/O error
122: Quota exceeded
123: No medium found
124: Wrong medium type
125: Unknown Error (125)
126: Unknown Error (126)


So I do not have to check for error range validity myself. Next step
would be produce a crash and check the runtime error validity, just in
case it matches. :-)


Pity the help pages I found (like the one for ioresult) do not mention
SysErrorMessage.

--
Cheers / Saludos,

                Carlos E. R.
                (from 42.3 x86_64 "Malachite" at Telcontar)


--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus

signature.asc (188 bytes) Download Attachment