* fhandler_socket.cc (fhandler_socket::recvfrom): Eliminate flags
not understood by WinSock. (fhandler_socket::sendto): Ditto. If WinSock sendto() returns WSAESHUTDOWN, change errno to EPIPE and raise SIGPIPE if MSG_NOSIGNAL isn't set in flags. * include/cygwin/socket.h: Define MSG_WINMASK and MSG_NOSIGNAL. * include/cygwin/version.h: Bump API minor number.
This commit is contained in:
parent
667599f478
commit
281d8a3232
@ -1,3 +1,13 @@
|
|||||||
|
2002-08-28 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* fhandler_socket.cc (fhandler_socket::recvfrom): Eliminate flags
|
||||||
|
not understood by WinSock.
|
||||||
|
(fhandler_socket::sendto): Ditto. If WinSock sendto() returns
|
||||||
|
WSAESHUTDOWN, change errno to EPIPE and raise SIGPIPE if MSG_NOSIGNAL
|
||||||
|
isn't set in flags.
|
||||||
|
* include/cygwin/socket.h: Define MSG_WINMASK and MSG_NOSIGNAL.
|
||||||
|
* include/cygwin/version.h: Bump API minor number.
|
||||||
|
|
||||||
2002-08-28 Corinna Vinschen <corinna@vinschen.de>
|
2002-08-28 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* poll.cc (poll): Eliminate erroneous POLLERR conditional.
|
* poll.cc (poll): Eliminate erroneous POLLERR conditional.
|
||||||
|
@ -674,6 +674,7 @@ fhandler_socket::recvfrom (void *ptr, size_t len, int flags,
|
|||||||
wsock_event wsock_evt;
|
wsock_event wsock_evt;
|
||||||
LPWSAOVERLAPPED ovr;
|
LPWSAOVERLAPPED ovr;
|
||||||
|
|
||||||
|
flags &= MSG_WINMASK;
|
||||||
if (is_nonblocking () || !(ovr = wsock_evt.prepare ()))
|
if (is_nonblocking () || !(ovr = wsock_evt.prepare ()))
|
||||||
{
|
{
|
||||||
debug_printf ("Fallback to winsock 1 recvfrom call");
|
debug_printf ("Fallback to winsock 1 recvfrom call");
|
||||||
@ -765,7 +766,8 @@ fhandler_socket::sendto (const void *ptr, size_t len, int flags,
|
|||||||
if (is_nonblocking () || !(ovr = wsock_evt.prepare ()))
|
if (is_nonblocking () || !(ovr = wsock_evt.prepare ()))
|
||||||
{
|
{
|
||||||
debug_printf ("Fallback to winsock 1 sendto call");
|
debug_printf ("Fallback to winsock 1 sendto call");
|
||||||
if ((res = ::sendto (get_socket (), (const char *) ptr, len, flags,
|
if ((res = ::sendto (get_socket (), (const char *) ptr, len,
|
||||||
|
flags & MSG_WINMASK,
|
||||||
(to ? (sockaddr *) &sin : NULL),
|
(to ? (sockaddr *) &sin : NULL),
|
||||||
tolen)) == SOCKET_ERROR)
|
tolen)) == SOCKET_ERROR)
|
||||||
{
|
{
|
||||||
@ -777,7 +779,8 @@ fhandler_socket::sendto (const void *ptr, size_t len, int flags,
|
|||||||
{
|
{
|
||||||
WSABUF wsabuf = { len, (char *) ptr };
|
WSABUF wsabuf = { len, (char *) ptr };
|
||||||
DWORD ret = 0;
|
DWORD ret = 0;
|
||||||
if (WSASendTo (get_socket (), &wsabuf, 1, &ret, (DWORD)flags,
|
if (WSASendTo (get_socket (), &wsabuf, 1, &ret,
|
||||||
|
(DWORD)(flags & MSG_WINMASK),
|
||||||
(to ? (sockaddr *) &sin : NULL),
|
(to ? (sockaddr *) &sin : NULL),
|
||||||
tolen,
|
tolen,
|
||||||
ovr, NULL) != SOCKET_ERROR)
|
ovr, NULL) != SOCKET_ERROR)
|
||||||
@ -791,6 +794,13 @@ fhandler_socket::sendto (const void *ptr, size_t len, int flags,
|
|||||||
set_winsock_errno ();
|
set_winsock_errno ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Special handling for SIGPIPE */
|
||||||
|
if (get_errno () == ESHUTDOWN)
|
||||||
|
{
|
||||||
|
set_errno (EPIPE);
|
||||||
|
if (! (flags & MSG_NOSIGNAL))
|
||||||
|
_raise (SIGPIPE);
|
||||||
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,6 +112,8 @@ struct msghdr
|
|||||||
#define MSG_OOB 0x1 /* process out-of-band data */
|
#define MSG_OOB 0x1 /* process out-of-band data */
|
||||||
#define MSG_PEEK 0x2 /* peek at incoming message */
|
#define MSG_PEEK 0x2 /* peek at incoming message */
|
||||||
#define MSG_DONTROUTE 0x4 /* send without using routing tables */
|
#define MSG_DONTROUTE 0x4 /* send without using routing tables */
|
||||||
|
#define MSG_WINMASK 0x7 /* flags understood by WinSock calls */
|
||||||
|
#define MSG_NOSIGNAL 0x20 /* Don't raise SIGPIPE */
|
||||||
|
|
||||||
/* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */
|
/* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */
|
||||||
#define SOL_IP 0
|
#define SOL_IP 0
|
||||||
|
@ -158,12 +158,13 @@ details. */
|
|||||||
58: Export memalign, valloc, malloc_trim, malloc_usable_size, mallopt,
|
58: Export memalign, valloc, malloc_trim, malloc_usable_size, mallopt,
|
||||||
malloc_stats
|
malloc_stats
|
||||||
59: getsid
|
59: getsid
|
||||||
|
60: MSG_NOSIGNAL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
|
/* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
|
||||||
|
|
||||||
#define CYGWIN_VERSION_API_MAJOR 0
|
#define CYGWIN_VERSION_API_MAJOR 0
|
||||||
#define CYGWIN_VERSION_API_MINOR 59
|
#define CYGWIN_VERSION_API_MINOR 60
|
||||||
|
|
||||||
/* There is also a compatibity version number associated with the
|
/* There is also a compatibity version number associated with the
|
||||||
shared memory regions. It is incremented when incompatible
|
shared memory regions. It is incremented when incompatible
|
||||||
|
Loading…
x
Reference in New Issue
Block a user