Displaying 2 results from an estimated 2 matches for "translate_to_errno".
2020 Aug 17
3
[nbdkit] Windows errno handling
...und functions such as nbdkit_error(), which
is (1) + (2) but might be a distinct operation eg. using cleanups.
(4) It prints them with perror and %m.
(5) It handles plugins which claim errno_is_preserved.
My first thought was we could define a macro which does:
#ifdef WIN32
#define errno (translate_to_errno (WSAGetLastError ()))
#endif
which reads the last error and translates WSA* to E* codes. This
would solve (1) and is not very invasive for existing code.
We'd have to then need to wrap all assignments to errno
in a macro like:
#ifndef WIN32
#define set_errno(v) (errno = (v))
#else
#def...
2020 Aug 17
0
Re: [nbdkit] Windows errno handling
...is (1) + (2) but might be a distinct operation eg. using cleanups.
>
> (4) It prints them with perror and %m.
>
> (5) It handles plugins which claim errno_is_preserved.
>
> My first thought was we could define a macro which does:
>
> #ifdef WIN32
> #define errno (translate_to_errno (WSAGetLastError ()))
> #endif
>
> which reads the last error and translates WSA* to E* codes. This
> would solve (1) and is not very invasive for existing code.
>
> We'd have to then need to wrap all assignments to errno
> in a macro like:
>
> #ifndef WIN32
>...