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

Comparing EV/schmorp.h (file contents):
Revision 1.14 by root, Fri Apr 11 04:27:20 2014 UTC vs.
Revision 1.15 by root, Tue Apr 17 17:52:31 2018 UTC

304 || addr.sin_port != adr2.sin_port) 304 || addr.sin_port != adr2.sin_port)
305 goto fail; 305 goto fail;
306 306
307 closesocket (listener); 307 closesocket (listener);
308 308
309#ifdef USE_SOCKETS_AS_HANDLES 309#if defined(USE_SOCKETS_AS_HANDLES) || PERL_VERSION_ATLEAST(5,18,0)
310 /* when select isn't winsocket, we also expect socket, connect, accept etc. 310 /* when select isn't winsocket, we also expect socket, connect, accept etc.
311 * to work on fds */ 311 * to work on fds */
312 filedes [0] = sock [0]; 312 filedes [0] = sock [0];
313 filedes [1] = sock [1]; 313 filedes [1] = sock [1];
314#else 314#else
357 || fcntl (fd, F_SETFD, FD_CLOEXEC); 357 || fcntl (fd, F_SETFD, FD_CLOEXEC);
358} 358}
359 359
360#endif 360#endif
361 361
362#if HAVE_EVENTFD
363# include <sys/eventfd.h>
364#else
362#if __linux && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7)) 365# if __linux && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7))
363# define SCHMORP_H_HAVE_EVENTFD 1 366# define SCHMORP_H_HAVE_EVENTFD 1
364/* our minimum requirement is glibc 2.7 which has the stub, but not the header */ 367/* our minimum requirement is glibc 2.7 which has the stub, but not the header */
365# include <stdint.h> 368# include <stdint.h>
366# ifdef __cplusplus 369# ifdef __cplusplus
367extern "C" { 370extern "C" {
368# endif 371# endif
369 int eventfd (unsigned int initval, int flags); 372 int eventfd (unsigned int initval, int flags);
370# ifdef __cplusplus 373# ifdef __cplusplus
371} 374}
372# endif 375# endif
373#else 376# else
374# define eventfd(initval,flags) -1 377# define eventfd(initval,flags) -1
378# endif
375#endif 379#endif
376 380
377typedef struct { 381typedef struct {
378 int fd[2]; /* read, write fd, might be equal */ 382 int fd[2]; /* read, write fd, might be equal */
379 int len; /* write length (1 pipe/socket, 8 eventfd) */ 383 int len; /* write length (1 pipe/socket, 8 eventfd) */
436 * incompetent windows programmers - is this redundant? 440 * incompetent windows programmers - is this redundant?
437 */ 441 */
438 DWORD dummy; 442 DWORD dummy;
439 WriteFile (S_TO_HANDLE (epp->fd [1]), (LPCVOID)&dummy, 1, &dummy, 0); 443 WriteFile (S_TO_HANDLE (epp->fd [1]), (LPCVOID)&dummy, 1, &dummy, 0);
440#else 444#else
441# if SCHMORP_H_HAVE_EVENTFD
442 static uint64_t counter = 1; 445 static uint64_t counter = 1;
443# else
444 static char counter [8];
445# endif
446 /* some modules accept fd's from outside, support eventfd here */ 446 /* some modules accept fd's from outside, support eventfd here */
447 if (write (epp->fd [1], &counter, epp->len) < 0 447 if (write (epp->fd [1], &counter, epp->len) < 0
448 && errno == EINVAL 448 && errno == EINVAL
449 && epp->len != 8) 449 && epp->len != 8)
450 write (epp->fd [1], &counter, (epp->len = 8)); 450 write (epp->fd [1], &counter, (epp->len = 8));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines