[fpc-pascal] Translating from error numbers to symbolic name

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Sat Aug 4 01:22:01 CEST 2012

Marco van de Voort wrote:
> In our previous episode, Mark Morgan Lloyd said:
>> When using a function like fpAccept on a non-blocking socket, in some 
>> cases -1 is returned with a documented (Linux kernel) error code of 
>> EAGAIN. Should I be looking for this in errno or SocketError?
> Socketerror is more portable, but on *nix errno will work too.

Thanks, found that in the source.

>> When I've retrieved a numeric code from errno or SocketError, is there a 
>> way of converting it to a concise literal such as 'EAGAIN'?
> See errors unit.

But if I'm reading that properly, it translates (some OS-specific 
number) to 'Try again', not to 'EAGAIN' which is what the kernel docs 
refer to and which can reasonably be logged without requiring i18n.

>> I want the 
>> log to report that accept() has failed with EAGAIN, rather than having 
>> explanatory text that doesn't match the kernel documentation.

Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

More information about the fpc-pascal mailing list