Site icon EfmSoft

What does errno 22 (EINVAL) mean?

 
Could be also:
ConstantTypeOS
ERROR_BAD_COMMANDWin32 errorWindows
KERN_INVALID_HOSTKern returnMac
ippStsNoIppFunctionFoundIntel Ipp StatusAny
CID_HANDLE_CREATIONBugCheck CodeWindows
Previous Next
EISDIR ENFILE

EINVAL

A contract error whose meaning comes from the call site

EINVAL has no single universal cause. It says that the invoked interface rejected one or more arguments or their combination. With mmap(), examples include an invalid address, length, offset, or mapping-flag combination. With strtol(), an unsupported numeric base can produce this result. The useful explanation is therefore the documented precondition of the exact function, not a generic “bad parameter” message.

Not every interface reports this value through errno. POSIX posix_memalign() returns this result directly when its alignment is not a power of two or is not a multiple of sizeof(void *); its manual specifically says that it does not set errno. Error handling must match the API’s return convention.

Useful evidence for diagnosis

InterfaceExample condition
mmap()Invalid address, length, offset, or missing required mapping mode.
posix_memalign()Alignment is not a power of two or not a multiple of sizeof(void *).
strtol()The selected base is unsupported by the implementation.

References


Looking for a different code? Search another status or error code.

Exit mobile version