… | |
… | |
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 |
367 | extern "C" { |
370 | extern "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 | |
377 | typedef struct { |
381 | typedef 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) */ |