eina_error: allow errno.h codes.
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Thu, 18 Aug 2016 16:36:05 +0000 (13:36 -0300)
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Thu, 18 Aug 2016 16:36:05 +0000 (13:36 -0300)
commite56811ed4db61ac2ac14d28a7a8fac83f41c43b8
tree6e012e00ea5460aec644bb31e6fc16a2c5c9973e
parent8a74f3807127391fb4c6517a69eae17414aca396
eina_error: allow errno.h codes.

we have some duplication of errors between Eina_Error and errno.h,
however we should use Eina_Error to extend the traditional errno.h
system.

then change eina_error_msg_register() and
eina_error_msg_static_register() to return a magic bit to state the
number was registered, and on other functions test this bit in order
to operate on registered values, otherwise fallback to errno.h, such
as strerror().

It also deprecates 2 clear duplicated errors:

- EINA_ERROR_OUT_OF_MEMORY -> ENOMEM

- EINA_ERROR_TIMEOUT -> ETIMEDOUT

There are two details when using strerror():

 - old behavior did not return strings for non-error, such as
   "Success" or "Unknown error ${N}"

 - thread-safety issues: since we must be thread safe, then use
   strerror_r() and eina_stringshare_add() that value, keeping a hash
   of cached values
src/lib/eina/eina_error.c
src/lib/eina/eina_error.h
src/lib/eina/eina_inline_lock_posix.x
src/lib/eina/eina_lock.h
src/tests/ecore/ecore_test_promise.c
src/tests/eina/eina_test_error.c
src/tests/eina/eina_test_lock.c