Re: WIN32 errno patch

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: WIN32 errno patch
Дата
Msg-id 200107212135.f6LLZjI08295@candle.pha.pa.us
обсуждение исходный текст
Ответ на WIN32 errno patch  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: WIN32 errno patch  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
> Upon review, I don't think these patches are very good at all.
> #defining errno as WSAGetLastError() is a fairly blunt instrument,
> and it breaks all the places that do actually need to use errno,
> such as PQoidValue, lo_import, lo_export.  I'm also concerned that
> PQrequestCancel may need to save/restore both errno and
> WSAGetLastError() in order to be safe for use in a signal handler.
> 
> Is errno a plain variable on WIN32, or is it a macro?  If the former,
> we could hack around this problem by doing
> 
>     #if WIN32
>     #undef errno
>     #endif
> 
>     ...
> 
>     #if WIN32
>     #define errno WSAGetLastError()
>     #endif
> 
> around the routines that need to access the real errno.  While ugly,
> this probably beats the alternative of ifdef'ing all the places that
> do need to access the WSA error code.

At this point, I am just happy we have this WIN32 errno thing working. 
We can now have people improve upon the implementation.

I see the code in win32 you are complaining about:/* * assumes that errno is used for sockets only * */#undef
errno#undefEINTR#undef EAGAIN   /* doesn't apply on sockets */#define errno WSAGetLastError()
 

What we really need is for someone with Win32 access to figure out which
errno tests are WSAGetLastError() calls and which are real errno calls. 

My guess is that we should have two errno's.  One the normal errno that
is the same on Win32 and Unix and a sockerrno that is conditionally
defined:
#ifndef WIN32#define sockerrno errno#else#define sockerrno WSAGetLastError()

How does that work for folks?  Can someone do the legwork?

See a later message on patches that reports problems with multibyte and
Win32 in libpq.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: WIN32 errno patch
Следующее
От: Tom Lane
Дата:
Сообщение: Incomplete idea about views and INSERT...RETURNING