… | |
… | |
3 | #include <errno.h> |
3 | #include <errno.h> |
4 | |
4 | |
5 | #include "EXTERN.h" |
5 | #include "EXTERN.h" |
6 | #include "perl.h" |
6 | #include "perl.h" |
7 | #include "XSUB.h" |
7 | #include "XSUB.h" |
8 | |
|
|
9 | #include "schmorp.h" |
|
|
10 | |
8 | |
11 | #include <stddef.h> |
9 | #include <stddef.h> |
12 | #include <stdlib.h> |
10 | #include <stdlib.h> |
13 | #include <errno.h> |
11 | #include <errno.h> |
14 | #include <sys/types.h> |
12 | #include <sys/types.h> |
… | |
… | |
106 | |
104 | |
107 | /*****************************************************************************/ |
105 | /*****************************************************************************/ |
108 | |
106 | |
109 | #include "libeio/config.h" |
107 | #include "libeio/config.h" |
110 | |
108 | |
|
|
109 | #include "schmorp.h" |
|
|
110 | |
111 | #if HAVE_EVENTFD |
111 | #if HAVE_EVENTFD |
112 | # include <sys/eventfd.h> |
112 | # include <sys/eventfd.h> |
113 | #endif |
113 | #endif |
114 | |
114 | |
115 | #if HAVE_TIMERFD |
115 | #if HAVE_TIMERFD |
… | |
… | |
2230 | void |
2230 | void |
2231 | timerfd_settime (SV *fh, int flags, NV interval, NV value) |
2231 | timerfd_settime (SV *fh, int flags, NV interval, NV value) |
2232 | PPCODE: |
2232 | PPCODE: |
2233 | { |
2233 | { |
2234 | int fd = s_fileno_croak (fh, 0); |
2234 | int fd = s_fileno_croak (fh, 0); |
|
|
2235 | #if HAVE_TIMERFD |
2235 | int res; |
2236 | int res; |
2236 | struct itimerspec its, ots; |
2237 | struct itimerspec its, ots; |
2237 | |
2238 | |
2238 | ts_set (&its.it_interval, interval); |
2239 | ts_set (&its.it_interval, interval); |
2239 | ts_set (&its.it_value , value); |
2240 | ts_set (&its.it_value , value); |
2240 | #if HAVE_TIMERFD |
|
|
2241 | res = timerfd_settime (fd, flags, &its, &ots); |
2241 | res = timerfd_settime (fd, flags, &its, &ots); |
2242 | #else |
|
|
2243 | res = (errno = ENOSYS, -1); |
|
|
2244 | #endif |
|
|
2245 | |
2242 | |
2246 | if (!res) |
2243 | if (!res) |
2247 | { |
2244 | { |
2248 | EXTEND (SP, 2); |
2245 | EXTEND (SP, 2); |
2249 | PUSHs (newSVnv (ts_get (&ots.it_interval))); |
2246 | PUSHs (newSVnv (ts_get (&ots.it_interval))); |
2250 | PUSHs (newSVnv (ts_get (&ots.it_value))); |
2247 | PUSHs (newSVnv (ts_get (&ots.it_value))); |
2251 | } |
2248 | } |
|
|
2249 | #else |
|
|
2250 | errno = ENOSYS; |
|
|
2251 | #endif |
2252 | } |
2252 | } |
2253 | |
2253 | |
2254 | void |
2254 | void |
2255 | timerfd_gettime (SV *fh) |
2255 | timerfd_gettime (SV *fh) |
2256 | PPCODE: |
2256 | PPCODE: |
2257 | { |
2257 | { |
2258 | int fd = s_fileno_croak (fh, 0); |
2258 | int fd = s_fileno_croak (fh, 0); |
|
|
2259 | #if HAVE_TIMERFD |
2259 | int res; |
2260 | int res; |
2260 | struct itimerspec ots; |
2261 | struct itimerspec ots; |
2261 | #if HAVE_TIMERFD |
|
|
2262 | res = timerfd_gettime (fd, &ots); |
2262 | res = timerfd_gettime (fd, &ots); |
2263 | #else |
|
|
2264 | res = (errno = ENOSYS, -1); |
|
|
2265 | #endif |
|
|
2266 | |
2263 | |
2267 | if (!res) |
2264 | if (!res) |
2268 | { |
2265 | { |
2269 | EXTEND (SP, 2); |
2266 | EXTEND (SP, 2); |
2270 | PUSHs (newSVnv (ts_get (&ots.it_interval))); |
2267 | PUSHs (newSVnv (ts_get (&ots.it_interval))); |
2271 | PUSHs (newSVnv (ts_get (&ots.it_value))); |
2268 | PUSHs (newSVnv (ts_get (&ots.it_value))); |
2272 | } |
2269 | } |
|
|
2270 | #else |
|
|
2271 | errno = ENOSYS; |
|
|
2272 | #endif |
2273 | } |
2273 | } |
2274 | |
2274 | |
2275 | UV |
2275 | UV |
2276 | get_fdlimit () |
2276 | get_fdlimit () |
2277 | CODE: |
2277 | CODE: |