ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/BDB/schmorp.h
(Generate patch)

Comparing BDB/schmorp.h (file contents):
Revision 1.2 by root, Wed Jul 15 14:40:00 2009 UTC vs.
Revision 1.3 by root, Wed Jul 15 14:53:52 2009 UTC

197 197
198/*****************************************************************************/ 198/*****************************************************************************/
199/* portable pipe/socketpair */ 199/* portable pipe/socketpair */
200 200
201#ifdef USE_SOCKETS_AS_HANDLES 201#ifdef USE_SOCKETS_AS_HANDLES
202# define S_TO_HANDLE(x) (win32_get_osfhandle (x)) 202# define S_TO_HANDLE(x) ((HANDLE)win32_get_osfhandle (x))
203#else 203#else
204# define S_TO_HANDLE(x) (x) 204# define S_TO_HANDLE(x) ((HANDLE)x)
205#endif 205#endif
206 206
207#ifdef _WIN32 207#ifdef _WIN32
208/* taken almost verbatim from libev's ev_win32.c */ 208/* taken almost verbatim from libev's ev_win32.c */
209/* oh, the humanity! */ 209/* oh, the humanity! */
292#define s_socketpair(domain,type,protocol,filedes) s_pipe (filedes) 292#define s_socketpair(domain,type,protocol,filedes) s_pipe (filedes)
293 293
294static int 294static int
295s_fd_blocking (int fd, int blocking) 295s_fd_blocking (int fd, int blocking)
296{ 296{
297 blocking = !blocking; 297 u_long nonblocking = !blocking;
298 298
299 return ioctlsocket (S_TO_HANDLE (fd), FIONBIO, &blocking); 299 return ioctlsocket ((SOCKET)S_TO_HANDLE (fd), FIONBIO, &nonblocking);
300} 300}
301 301
302#define s_fd_prepare(fd) s_fd_blocking (fd, 0) 302#define s_fd_prepare(fd) s_fd_blocking (fd, 0)
303 303
304#else 304#else
397 /* perl overrides send with a function that crashes in other threads. 397 /* perl overrides send with a function that crashes in other threads.
398 * unfortunately, it overrides it with an argument-less macro, so 398 * unfortunately, it overrides it with an argument-less macro, so
399 * there is no way to force usage of the real send function. 399 * there is no way to force usage of the real send function.
400 * incompetent windows programmers - is this redundant? 400 * incompetent windows programmers - is this redundant?
401 */ 401 */
402 LPDWORD dummy; 402 DWORD dummy;
403 WriteFile (S_TO_HANDLE (epp->fd [1]), (LPCVOID)&dummy, 1, &dummy, 0); 403 WriteFile (S_TO_HANDLE (epp->fd [1]), (LPCVOID)&dummy, 1, &dummy, 0);
404#else 404#else
405 static uint64_t counter = 1; 405 static uint64_t counter = 1;
406 write (epp->fd [1], &counter, epp->len); 406 write (epp->fd [1], &counter, epp->len);
407#endif 407#endif
434 if (s_epipe_new (&epn)) 434 if (s_epipe_new (&epn))
435 return -1; 435 return -1;
436 436
437 if (epp->len) 437 if (epp->len)
438 { 438 {
439 if (dup2 (S_TO_HANDLE (epn.fd [0]), S_TO_HANDLE (epp->fd [0])) < 0) 439 if (dup2 (epn.fd [0], epp->fd [0]) < 0)
440 croak ("unable to dup over old event pipe"); /* should not croak */ 440 croak ("unable to dup over old event pipe"); /* should not croak */
441 441
442 if (epp->fd [1] != epp->fd [0]) 442 if (epp->fd [1] != epp->fd [0])
443 close (epn.fd [0]); 443 close (epn.fd [0]);
444 444

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines