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

Comparing EV/schmorp.h (file contents):
Revision 1.8 by root, Wed Apr 14 00:17:22 2010 UTC vs.
Revision 1.9 by root, Thu Jul 8 00:45:03 2010 UTC

6 */ 6 */
7 7
8#include <signal.h> 8#include <signal.h>
9#include <errno.h> 9#include <errno.h>
10 10
11#ifndef _WIN32 11#if defined(WIN32 ) || defined(_MINIX)
12# define SCHMORP_H_PREFER_SELECT 1
13#endif
14
15#if !SCHMORP_H_PREFER_SELECT
12# include <poll.h> 16# include <poll.h>
13#endif 17#endif
14 18
15/* useful stuff, used by schmorp mostly */ 19/* useful stuff, used by schmorp mostly */
16 20
327} 331}
328 332
329#endif 333#endif
330 334
331#if __linux && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7)) 335#if __linux && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7))
336# define SCHMORP_H_HAVE_EVENTFD 1
332/* our minimum requirement is glibc 2.7 which has the stub, but not the header */ 337/* our minimum requirement is glibc 2.7 which has the stub, but not the header */
333# include <stdint.h> 338# include <stdint.h>
334# ifdef __cplusplus 339# ifdef __cplusplus
335extern "C" { 340extern "C" {
336# endif 341# endif
404 * incompetent windows programmers - is this redundant? 409 * incompetent windows programmers - is this redundant?
405 */ 410 */
406 DWORD dummy; 411 DWORD dummy;
407 WriteFile (S_TO_HANDLE (epp->fd [1]), (LPCVOID)&dummy, 1, &dummy, 0); 412 WriteFile (S_TO_HANDLE (epp->fd [1]), (LPCVOID)&dummy, 1, &dummy, 0);
408#else 413#else
414# if SCHMORP_H_HAVE_EVENTFD
409 static uint64_t counter = 1; 415 static uint64_t counter = 1;
416# else
417 static char counter [8];
418# endif
410 /* some modules accept fd's from outside, support eventfd here */ 419 /* some modules accept fd's from outside, support eventfd here */
411 if (write (epp->fd [1], &counter, epp->len) < 0 420 if (write (epp->fd [1], &counter, epp->len) < 0
412 && errno == EINVAL 421 && errno == EINVAL
413 && epp->len != 8) 422 && epp->len != 8)
414 write (epp->fd [1], &counter, (epp->len = 8)); 423 write (epp->fd [1], &counter, (epp->len = 8));
463 472
464static int 473static int
465s_epipe_wait (s_epipe *epp) 474s_epipe_wait (s_epipe *epp)
466{ 475{
467 dTHX; 476 dTHX;
468#ifdef _WIN32 477#if SCHMORP_H_PREFER_SELECT
469 fd_set rfd; 478 fd_set rfd;
470 int fd = s_epipe_fd (epp); 479 int fd = s_epipe_fd (epp);
471 480
472 FD_ZERO (&rfd); 481 FD_ZERO (&rfd);
473 FD_SET (fd, &rfd); 482 FD_SET (fd, &rfd);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines