Re: Un-sucking EINVAL
- Reply: Warner Losh : "Re: Un-sucking EINVAL"
- In reply to: Lexi Winter : "Re: Un-sucking EINVAL (was: ip# on bridge members)"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 21 May 2025 16:23:04 UTC
On 21/05/2025 10:28, Lexi Winter wrote: > you are completely right. since we (for some reason, that i don't > really understand) can't add new error codes to errno, we should stop > using errno to indicate errors except where POSIX requires this. I once had this idea, probably not original, that if we usually use 32-bit variables to pass around error / status codes, then why not split up those bits for some special uses. E.g., lowest 10 or 12 bits could be actual error codes. But highest, say, 8 or 10 bits could encode a domain of interpretation (to use a term borrowed from IPsec). Domain number zero would be a POSIX or legacy domain and error codes in it would be the standard errno codes. Then we could have a different domain (or several) for FreeBSD-specific error codes. Some middle bits could be used to further subdivide a domain into modules or subsystems with their own error codes. There could be some private (application specific) domains. But, of course, a larger repertoire of error codes is still not as flexible and powerful as an ability to pass a specific error string along with an error code. -- Andriy Gapon