1 /*
2    +----------------------------------------------------------------------+
3    | PHP Version 7                                                        |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 1997-2021 The PHP Group                                |
6    +----------------------------------------------------------------------+
7    | This source file is subject to version 3.01 of the PHP license,      |
8    | that is bundled with this package in the file LICENSE, and is        |
9    | available through the world-wide-web at the following url:           |
10    | http://www.php.net/license/3_01.txt                                  |
11    | If you did not receive a copy of the PHP license and are unable to   |
12    | obtain it through the world-wide-web, please send a note to          |
13    | license@php.net so we can mail you a copy immediately.               |
14    +----------------------------------------------------------------------+
15    | Author: Ruslan Osmanov <osmanov@php.net>                             |
16    +----------------------------------------------------------------------+
17 */
18 
19 #include "php_ev.h"
20 #include "watcher.h"
21 
22 #define PHP_EV_PROP_REQUIRE(x)  do { \
23 	if (UNEXPECTED(!(x))) {          \
24 		return NULL;                 \
25 	}                                \
26 } while (0);
27 
28 #define PHP_EV_PROP_WRITE_REQUIRE(x) do { \
29 	if (UNEXPECTED(!(x))) return FAILURE; \
30 } while (0)
31 
php_ev_prop_write_zval(zval * pz,zval * value)32 static zend_always_inline void php_ev_prop_write_zval(zval *pz, zval *value)
33 {
34 #if 0
35 	ZVAL_ZVAL(pz, value, 1, 0);
36 #else
37 	zval_dtor(pz);
38 #if 0
39 	ZVAL_COPY(pz, value);
40 #endif
41 	ZVAL_ZVAL(pz, value, 1, 0);
42 #endif
43 }
44 
php_ev_prop_read_zval(zval * pz,zval * retval)45 static zend_always_inline void php_ev_prop_read_zval(zval *pz, zval *retval)
46 {
47 	if (Z_ISUNDEF_P(pz)) {
48 		ZVAL_NULL(retval);
49 	} else {
50 		ZVAL_COPY(retval, pz);
51 	}
52 }
53 
54 
55 /* {{{ EvLoop property handlers */
56 
57 /* {{{ ev_loop_prop_data_get_ptr_ptr */
ev_loop_prop_data_get_ptr_ptr(php_ev_object * obj)58 static zval * ev_loop_prop_data_get_ptr_ptr(php_ev_object *obj)
59 {
60 	php_ev_loop *loop = PHP_EV_LOOP_OBJECT_FETCH_FROM_OBJECT(obj);
61 	return (loop ? &(loop->data) : NULL);
62 }
63 /* }}} */
64 
65 /* {{{ ev_loop_prop_data_read  */
ev_loop_prop_data_read(php_ev_object * obj,zval * retval)66 static zval * ev_loop_prop_data_read(php_ev_object *obj, zval *retval)
67 {
68 	PHP_EV_PROP_REQUIRE(obj->ptr);
69 
70 	zval *data = &PHP_EV_LOOP_OBJECT_FETCH_FROM_OBJECT(obj)->data;
71 	php_ev_prop_read_zval(data, retval);
72 
73 	return retval;
74 }
75 /* }}} */
76 
77 /* {{{ ev_loop_prop_data_write  */
ev_loop_prop_data_write(php_ev_object * obj,zval * value)78 static int ev_loop_prop_data_write(php_ev_object *obj, zval *value)
79 {
80 	PHP_EV_PROP_WRITE_REQUIRE(obj->ptr);
81 
82 	php_ev_prop_write_zval(&(PHP_EV_LOOP_OBJECT_FETCH_FROM_OBJECT(obj))->data, value);
83 	return SUCCESS;
84 }
85 /* }}} */
86 
87 /* {{{ ev_loop_prop_backend_read */
ev_loop_prop_backend_read(php_ev_object * obj,zval * retval)88 static zval * ev_loop_prop_backend_read(php_ev_object *obj, zval *retval)
89 {
90 	PHP_EV_PROP_REQUIRE(obj->ptr);
91 	ZVAL_LONG(retval, ev_backend(PHP_EV_LOOP_FETCH_FROM_OBJECT(obj)));
92 	return retval;
93 }
94 /* }}} */
95 
96 /* {{{ ev_loop_prop_is_default_loop_read */
ev_loop_prop_is_default_loop_read(php_ev_object * obj,zval * retval)97 static zval * ev_loop_prop_is_default_loop_read(php_ev_object *obj, zval *retval)
98 {
99 	PHP_EV_PROP_REQUIRE(obj->ptr);
100 	ZVAL_BOOL(retval, ev_is_default_loop(PHP_EV_LOOP_FETCH_FROM_OBJECT(obj)));
101 	return retval;
102 }
103 /* }}} */
104 
105 /* {{{ ev_loop_prop_iteration_loop_read */
ev_loop_prop_iteration_loop_read(php_ev_object * obj,zval * retval)106 static zval * ev_loop_prop_iteration_loop_read(php_ev_object *obj, zval *retval)
107 {
108 	PHP_EV_PROP_REQUIRE(obj->ptr);
109 	ZVAL_LONG(retval, ev_iteration(PHP_EV_LOOP_FETCH_FROM_OBJECT(obj)));
110 	return retval;
111 }
112 /* }}} */
113 
114 /* {{{ ev_loop_prop_pending_loop_read */
ev_loop_prop_pending_loop_read(php_ev_object * obj,zval * retval)115 static zval * ev_loop_prop_pending_loop_read(php_ev_object *obj, zval *retval)
116 {
117 	PHP_EV_PROP_REQUIRE(obj->ptr);
118 	ZVAL_LONG(retval, ev_pending_count(PHP_EV_LOOP_FETCH_FROM_OBJECT(obj)));
119 	return retval;
120 }
121 /* }}} */
122 
123 /* {{{ ev_loop_prop_io_interval_read */
ev_loop_prop_io_interval_read(php_ev_object * obj,zval * retval)124 static zval * ev_loop_prop_io_interval_read(php_ev_object *obj, zval *retval)
125 {
126 	PHP_EV_PROP_REQUIRE(obj->ptr);
127 	php_ev_loop *loop_obj = PHP_EV_LOOP_OBJECT_FETCH_FROM_OBJECT(obj);
128 	ZVAL_DOUBLE(retval, loop_obj->io_collect_interval);
129 	return retval;
130 }
131 /* }}} */
132 
133 /* {{{ ev_loop_prop_io_interval_write */
ev_loop_prop_io_interval_write(php_ev_object * obj,zval * value)134 static int ev_loop_prop_io_interval_write(php_ev_object *obj, zval *value)
135 {
136 	php_ev_loop *loop_obj;
137 
138 	PHP_EV_PROP_WRITE_REQUIRE(obj->ptr);
139 	loop_obj = PHP_EV_LOOP_OBJECT_FETCH_FROM_OBJECT(obj);
140 	loop_obj->io_collect_interval = Z_DVAL_P(value);
141 
142 	return SUCCESS;
143 }
144 /* }}} */
145 
146 /* {{{ ev_loop_prop_timeout_interval_read */
ev_loop_prop_timeout_interval_read(php_ev_object * obj,zval * retval)147 static zval * ev_loop_prop_timeout_interval_read(php_ev_object *obj, zval *retval)
148 {
149 	PHP_EV_PROP_REQUIRE(obj->ptr);
150 
151 	php_ev_loop *loop_obj = PHP_EV_LOOP_OBJECT_FETCH_FROM_OBJECT(obj);
152 	if (loop_obj == NULL) {
153 		return NULL;
154 	}
155 
156 	ZVAL_DOUBLE(retval, loop_obj->timeout_collect_interval);
157 	return retval;
158 }
159 /* }}} */
160 
161 /* {{{ ev_loop_prop_timeout_interval_write */
ev_loop_prop_timeout_interval_write(php_ev_object * obj,zval * value)162 static int ev_loop_prop_timeout_interval_write(php_ev_object *obj, zval *value)
163 {
164 	php_ev_loop *loop_obj;
165 
166 	PHP_EV_PROP_WRITE_REQUIRE(obj->ptr);
167 
168 	loop_obj = PHP_EV_LOOP_OBJECT_FETCH_FROM_OBJECT(obj);
169 	if (loop_obj == NULL) {
170 		return FAILURE;
171 	}
172 
173 	loop_obj->timeout_collect_interval = Z_DVAL_P(value);
174 	return SUCCESS;
175 }
176 /* }}} */
177 
178 /* {{{ ev_loop_prop_depth_read */
ev_loop_prop_depth_read(php_ev_object * obj,zval * retval)179 static zval * ev_loop_prop_depth_read(php_ev_object *obj, zval *retval)
180 {
181 	PHP_EV_PROP_REQUIRE(obj->ptr);
182 	ZVAL_LONG(retval, (zend_long)ev_depth(PHP_EV_LOOP_FETCH_FROM_OBJECT(obj)));
183 	return retval;
184 }
185 /* }}} */
186 
187 /* }}} */
188 
189 /* {{{ EvWatcher property handlers */
190 
191 
192 /* {{{ ev_watcher_prop_is_active_read */
ev_watcher_prop_is_active_read(php_ev_object * obj,zval * retval)193 static zval * ev_watcher_prop_is_active_read(php_ev_object *obj, zval *retval)
194 {
195 	PHP_EV_PROP_REQUIRE(obj->ptr);
196 	ZVAL_BOOL(retval, ev_is_active(PHP_EV_WATCHER_FETCH_FROM_OBJECT(obj)));
197 	return retval;
198 }
199 /* }}} */
200 
201 /* {{{ ev_watcher_prop_data_get_ptr_ptr */
ev_watcher_prop_data_get_ptr_ptr(php_ev_object * obj)202 static zval *ev_watcher_prop_data_get_ptr_ptr(php_ev_object *obj)
203 {
204 	ev_watcher *w = PHP_EV_WATCHER_FETCH_FROM_OBJECT(obj);
205 	if (Z_ISUNDEF(php_ev_watcher_data(w))) {
206 		ZVAL_NULL(&php_ev_watcher_data(w));
207 	}
208 	return (w ? &php_ev_watcher_data(w) : NULL);
209 }
210 /* }}} */
211 
212 /* {{{ ev_watcher_prop_data_read  */
ev_watcher_prop_data_read(php_ev_object * obj,zval * retval)213 static zval * ev_watcher_prop_data_read(php_ev_object *obj, zval *retval)
214 {
215 	PHP_EV_PROP_REQUIRE(obj->ptr);
216 	zval *data = &PHP_EV_WATCHER_FETCH_FROM_OBJECT(obj)->data;
217 	php_ev_prop_read_zval(data, retval);
218 	return retval;
219 }
220 /* }}} */
221 
222 /* {{{ ev_watcher_prop_data_write */
ev_watcher_prop_data_write(php_ev_object * obj,zval * value)223 static int ev_watcher_prop_data_write(php_ev_object *obj, zval *value)
224 {
225 	ev_watcher *w = PHP_EV_WATCHER_FETCH_FROM_OBJECT(obj);
226 	PHP_EV_PROP_WRITE_REQUIRE(w);
227 
228 	php_ev_prop_write_zval(&php_ev_watcher_data(w), value);
229 	return SUCCESS;
230 }
231 /* }}} */
232 
233 /* {{{ ev_watcher_prop_is_pending_read */
ev_watcher_prop_is_pending_read(php_ev_object * obj,zval * retval)234 static zval * ev_watcher_prop_is_pending_read(php_ev_object *obj, zval *retval)
235 {
236 	PHP_EV_PROP_REQUIRE(obj->ptr);
237 	ZVAL_BOOL(retval, ev_is_pending(PHP_EV_WATCHER_FETCH_FROM_OBJECT(obj)));
238 	return retval;
239 }
240 /* }}} */
241 
242 /* {{{ ev_watcher_prop_priority_read */
ev_watcher_prop_priority_read(php_ev_object * obj,zval * retval)243 static zval * ev_watcher_prop_priority_read(php_ev_object *obj, zval *retval)
244 {
245 	PHP_EV_PROP_REQUIRE(obj->ptr);
246 	ZVAL_LONG(retval, ev_priority(PHP_EV_WATCHER_FETCH_FROM_OBJECT(obj)));
247 	return retval;
248 }
249 /* }}} */
250 
251 /* {{{ ev_watcher_prop_priority_write */
ev_watcher_prop_priority_write(php_ev_object * obj,zval * value)252 static int ev_watcher_prop_priority_write(php_ev_object *obj, zval *value)
253 {
254 	PHP_EV_PROP_WRITE_REQUIRE(obj->ptr);
255 
256 	zend_long priority;
257 	ev_watcher *watcher = PHP_EV_WATCHER_FETCH_FROM_OBJECT(obj);
258 
259 	int active = ev_is_active(watcher);
260 
261 	if (active) {
262 		php_error_docref(NULL, E_WARNING,
263 				"Modifying active watcher. Restarting the watcher internally.");
264 	}
265 
266 	priority = Z_LVAL_P(value);
267 	if (priority < INT_MIN) {
268 		php_error_docref(NULL, E_WARNING, "Priority value must be bigger than INT_MIN");
269 	    return FAILURE;
270 	} else if (priority > INT_MAX) {
271 		php_error_docref(NULL, E_WARNING, "Priority value must not exceed INT_MAX");
272 	    return FAILURE;
273 	}
274 
275 	if (active) {
276 		php_ev_stop_watcher(watcher);
277 	}
278 
279 	php_ev_set_watcher_priority(watcher, priority);
280 
281 	if (active) {
282 		php_ev_start_watcher(watcher);
283 	}
284 
285 	return SUCCESS;
286 }
287 /* }}} */
288 
289 /* }}} */
290 
291 /* {{{ EvIo property handlers */
292 
293 /* {{{ ev_io_prop_fd_read  */
ev_io_prop_fd_read(php_ev_object * obj,zval * retval)294 static zval * ev_io_prop_fd_read(php_ev_object *obj, zval *retval)
295 {
296 	ev_io *io_watcher = (ev_io *)PHP_EV_WATCHER_FETCH_FROM_OBJECT(obj);
297 
298 
299 	if (io_watcher->fd < 0 || !ZEND_VALID_SOCKET(io_watcher->fd)) {
300 		// Invalid fd
301 		ZVAL_NULL(retval);
302 		return retval;
303 	}
304 
305 	php_stream *stream = php_stream_fopen_from_fd(io_watcher->fd, "r", NULL);
306 
307 	if (stream) {
308 		php_stream_to_zval(stream, retval);
309 		/* Bug #18 */
310 #if 0
311 		Z_TRY_ADDREF_P(retval);
312 #else
313 		stream->flags |= PHP_STREAM_FLAG_NO_CLOSE;
314 #endif
315 	} else {
316 		ZVAL_NULL(retval);
317 	}
318 
319 	return retval;
320 }
321 /* }}} */
322 
323 /* {{{ ev_io_prop_events_read */
ev_io_prop_events_read(php_ev_object * obj,zval * retval)324 static zval * ev_io_prop_events_read(php_ev_object *obj, zval *retval)
325 {
326 	ev_io *io_watcher = (ev_io *)PHP_EV_WATCHER_FETCH_FROM_OBJECT(obj);
327 	ZVAL_LONG(retval, io_watcher->events);
328 	return retval;
329 }
330 /* }}} */
331 
332 /* }}} */
333 
334 /* {{{ EvTimer property handlers */
335 
336 /* {{{ ev_timer_prop_repeat_read */
ev_timer_prop_repeat_read(php_ev_object * obj,zval * retval)337 static zval * ev_timer_prop_repeat_read(php_ev_object *obj, zval *retval)
338 {
339 	PHP_EV_PROP_REQUIRE(obj->ptr);
340 	ev_timer *timer_watcher = (ev_timer *)PHP_EV_WATCHER_FETCH_FROM_OBJECT(obj);
341 	ZVAL_DOUBLE(retval, timer_watcher->repeat);
342 	return retval;
343 }
344 /* }}} */
345 
346 /* {{{ ev_timer_prop_repeat_write */
ev_timer_prop_repeat_write(php_ev_object * obj,zval * value)347 static int ev_timer_prop_repeat_write(php_ev_object *obj, zval *value)
348 {
349 	ev_timer *timer_watcher;
350 	double    repeat;
351 
352 	timer_watcher = (ev_timer *)PHP_EV_WATCHER_FETCH_FROM_OBJECT(obj);
353 	PHP_EV_PROP_WRITE_REQUIRE(obj->ptr);
354 
355 	repeat = Z_DVAL_P(value);
356 	PHP_EV_CHECK_REPEAT_RET(repeat, FAILURE);
357 	timer_watcher->repeat = (ev_tstamp) repeat;
358 	return SUCCESS;
359 }
360 /* }}} */
361 
362 /* {{{ ev_timer_prop_remaining_read */
ev_timer_prop_remaining_read(php_ev_object * obj,zval * retval)363 static zval * ev_timer_prop_remaining_read(php_ev_object *obj, zval *retval)
364 {
365 	PHP_EV_PROP_REQUIRE(obj->ptr);
366 
367 	ev_timer *timer_watcher = (ev_timer *)PHP_EV_WATCHER_FETCH_FROM_OBJECT(obj);
368 	ZVAL_DOUBLE(retval, ev_timer_remaining(
369 				php_ev_watcher_loop_ptr((ev_watcher *)timer_watcher), timer_watcher));
370 	return retval;
371 }
372 /* }}} */
373 
374 /* }}} */
375 
376 #if EV_PERIODIC_ENABLE
377 /* {{{ EvPeriodic property handlers */
378 
379 /* {{{ ev_periodic_prop_offset_read */
ev_periodic_prop_offset_read(php_ev_object * obj,zval * retval)380 static zval * ev_periodic_prop_offset_read(php_ev_object *obj, zval *retval)
381 {
382 	PHP_EV_PROP_REQUIRE(obj->ptr);
383 	ev_periodic *w = (ev_periodic *) PHP_EV_WATCHER_FETCH_FROM_OBJECT(obj);
384 	ZVAL_DOUBLE(retval, w->offset);
385 	return retval;
386 }
387 /* }}} */
388 
389 /* {{{ ev_periodic_prop_offset_write */
ev_periodic_prop_offset_write(php_ev_object * obj,zval * value)390 static int ev_periodic_prop_offset_write(php_ev_object *obj, zval *value)
391 {
392 	PHP_EV_PROP_WRITE_REQUIRE(obj->ptr);
393 	ev_periodic *w = (ev_periodic *)PHP_EV_WATCHER_FETCH_FROM_OBJECT(obj);
394 	w->offset = (ev_tstamp) Z_DVAL_P(value);
395 	return SUCCESS;
396 }
397 /* }}} */
398 
399 /* {{{ ev_periodic_prop_interval_read */
ev_periodic_prop_interval_read(php_ev_object * obj,zval * retval)400 static zval * ev_periodic_prop_interval_read(php_ev_object *obj, zval *retval)
401 {
402 	PHP_EV_PROP_REQUIRE(obj->ptr);
403 	ev_periodic *w = (ev_periodic *) PHP_EV_WATCHER_FETCH_FROM_OBJECT(obj);
404 	ZVAL_DOUBLE(retval, w->interval);
405 	return retval;
406 }
407 /* }}} */
408 
409 /* {{{ ev_periodic_prop_interval_write*/
ev_periodic_prop_interval_write(php_ev_object * obj,zval * value)410 static int ev_periodic_prop_interval_write(php_ev_object *obj, zval *value)
411 {
412 	double interval;
413 	PHP_EV_PROP_WRITE_REQUIRE(obj->ptr);
414 
415 	ev_periodic *w = (ev_periodic *) PHP_EV_WATCHER_FETCH_FROM_OBJECT(obj);
416 	interval       = (ev_tstamp) Z_DVAL_P(value);
417 
418 	PHP_EV_CHECK_REPEAT_RET(interval, FAILURE);
419 	w->interval = interval;
420 	return SUCCESS;
421 }
422 /* }}} */
423 
424 /* }}} */
425 #endif
426 
427 #if EV_SIGNAL_ENABLE
428 /* {{{ EvSignal property handlers */
429 
430 /* {{{ ev_signal_prop_signum_read */
ev_signal_prop_signum_read(php_ev_object * obj,zval * retval)431 static zval * ev_signal_prop_signum_read(php_ev_object *obj, zval *retval)
432 {
433 	PHP_EV_PROP_REQUIRE(obj->ptr);
434 	ev_signal *signal_watcher = (ev_signal *) PHP_EV_WATCHER_FETCH_FROM_OBJECT(obj);
435 	ZVAL_LONG(retval, signal_watcher->signum);
436 	return retval;
437 }
438 /* }}} */
439 
440 /* }}} */
441 #endif
442 
443 #if EV_CHILD_ENABLE
444 /* {{{ EvChild property handlers */
445 
446 /* {{{ ev_child_prop_pid_read */
ev_child_prop_pid_read(php_ev_object * obj,zval * retval)447 static zval * ev_child_prop_pid_read(php_ev_object *obj, zval *retval)
448 {
449 	PHP_EV_PROP_REQUIRE(obj->ptr);
450 
451 	ev_child *child_watcher = (ev_child *)PHP_EV_WATCHER_FETCH_FROM_OBJECT(obj);
452 	ZVAL_LONG(retval, child_watcher->pid);
453 	return retval;
454 }
455 /* }}} */
456 
457 /* {{{ ev_child_prop_rpid_read */
ev_child_prop_rpid_read(php_ev_object * obj,zval * retval)458 static zval * ev_child_prop_rpid_read(php_ev_object *obj, zval *retval)
459 {
460 	PHP_EV_PROP_REQUIRE(obj->ptr);
461 
462 	ev_child *child_watcher = (ev_child *) PHP_EV_WATCHER_FETCH_FROM_OBJECT(obj);
463 	ZVAL_LONG(retval, child_watcher->rpid);
464 	return retval;
465 }
466 /* }}} */
467 
468 /* {{{ ev_child_prop_rstatus_read */
ev_child_prop_rstatus_read(php_ev_object * obj,zval * retval)469 static zval * ev_child_prop_rstatus_read(php_ev_object *obj, zval *retval)
470 {
471 	PHP_EV_PROP_REQUIRE(obj->ptr);
472 
473 	ev_child *child_watcher = (ev_child *)PHP_EV_WATCHER_FETCH_FROM_OBJECT(obj);
474 	ZVAL_LONG(retval, child_watcher->rstatus);
475 	return retval;
476 }
477 /* }}} */
478 
479 /* }}} */
480 #endif
481 
482 #if EV_STAT_ENABLE
483 /* {{{ EvStat property handlers */
484 
485 /* {{{ ev_stat_prop_path_read */
ev_stat_prop_path_read(php_ev_object * obj,zval * retval)486 static zval * ev_stat_prop_path_read(php_ev_object *obj, zval *retval)
487 {
488 	PHP_EV_PROP_REQUIRE(obj->ptr);
489 
490 	php_ev_stat *stat_ptr = (php_ev_stat *) PHP_EV_WATCHER_FETCH_FROM_OBJECT(obj);
491 	ZVAL_STRING(retval, stat_ptr->path);
492 	return retval;
493 }
494 /* }}} */
495 
496 /* {{{ ev_stat_prop_interval_read */
ev_stat_prop_interval_read(php_ev_object * obj,zval * retval)497 static zval * ev_stat_prop_interval_read(php_ev_object *obj, zval *retval)
498 {
499 	PHP_EV_PROP_REQUIRE(obj->ptr);
500 
501 	ev_stat *stat_watcher = (ev_stat *) PHP_EV_WATCHER_FETCH_FROM_OBJECT(obj);
502 	ZVAL_DOUBLE(retval, (double)stat_watcher->interval);
503 	return retval;
504 }
505 /* }}} */
506 
507 /* }}} */
508 #endif
509 
510 #if EV_EMBED_ENABLE
511 /* {{{ EvEmbed property handlers */
512 
513 /* {{{ ev_embed_prop_other_read */
ev_embed_prop_other_read(php_ev_object * obj,zval * retval)514 static zval * ev_embed_prop_other_read(php_ev_object *obj, zval *retval)
515 {
516 	PHP_EV_PROP_REQUIRE(obj->ptr);
517 
518 	php_ev_embed *embed_ptr = (php_ev_embed *) PHP_EV_WATCHER_FETCH_FROM_OBJECT(obj);
519 	php_ev_prop_read_zval(&embed_ptr->other, retval);
520 
521 	return retval;
522 }
523 /* }}} */
524 
525 /* }}} */
526 #endif
527 
528 /* {{{ ev_loop_property_entries[] */
529 const php_ev_property_entry ev_loop_property_entries[] = {
530 	{"data",             sizeof("data")             - 1, ev_loop_prop_data_read,             ev_loop_prop_data_write,             ev_loop_prop_data_get_ptr_ptr},
531 	{"backend",          sizeof("backend")          - 1, ev_loop_prop_backend_read,          NULL,                                NULL},
532 	{"is_default_loop",  sizeof("is_default_loop")  - 1, ev_loop_prop_is_default_loop_read,  NULL,                                NULL},
533 	{"iteration",        sizeof("iteration")        - 1, ev_loop_prop_iteration_loop_read,   NULL,                                NULL},
534 	{"pending",          sizeof("pending")          - 1, ev_loop_prop_pending_loop_read,     NULL,                                NULL},
535 	{"io_interval",      sizeof("io_interval")      - 1, ev_loop_prop_io_interval_read,      ev_loop_prop_io_interval_write,      NULL},
536 	{"timeout_interval", sizeof("timeout_interval") - 1, ev_loop_prop_timeout_interval_read, ev_loop_prop_timeout_interval_write, NULL},
537 	{"depth",            sizeof("depth")            - 1, ev_loop_prop_depth_read,            NULL,                                NULL},
538     {NULL, 0, NULL, NULL, NULL}
539 };
540 /* }}} */
541 
542 /* {{{ ev_watcher_property_entries[] */
543 const php_ev_property_entry ev_watcher_property_entries[] = {
544 	{"is_active",  sizeof("is_active")  - 1, ev_watcher_prop_is_active_read,  NULL,                           NULL},
545 	{"data",       sizeof("data")       - 1, ev_watcher_prop_data_read,       ev_watcher_prop_data_write,     ev_watcher_prop_data_get_ptr_ptr},
546 	{"is_pending", sizeof("is_pending") - 1, ev_watcher_prop_is_pending_read, NULL,                           NULL},
547 	{"priority",   sizeof("priority")   - 1, ev_watcher_prop_priority_read,   ev_watcher_prop_priority_write, NULL},
548 	{NULL, 0, NULL, NULL, NULL}
549 };
550 /* }}} */
551 
552 /* {{{ ev_io_property_entries[] */
553 const php_ev_property_entry ev_io_property_entries[] = {
554 	{"fd",     sizeof("fd")     - 1, ev_io_prop_fd_read,     NULL, NULL},
555 	{"events", sizeof("events") - 1, ev_io_prop_events_read, NULL, NULL},
556     {NULL, 0, NULL, NULL, NULL}
557 };
558 /* }}} */
559 
560 
561 /* {{{ ev_timer_property_entries[] */
562 const php_ev_property_entry ev_timer_property_entries[] = {
563 	{"repeat",    sizeof("repeat")    - 1, ev_timer_prop_repeat_read,    ev_timer_prop_repeat_write, NULL},
564 	{"remaining", sizeof("remaining") - 1, ev_timer_prop_remaining_read, NULL, NULL},
565     {NULL, 0, NULL, NULL, NULL}
566 };
567 /* }}} */
568 
569 
570 #if EV_PERIODIC_ENABLE
571 /* {{{ ev_periodic_property_entries[] */
572 const php_ev_property_entry ev_periodic_property_entries[] = {
573 	{"offset",   sizeof("offset")   - 1, ev_periodic_prop_offset_read,   ev_periodic_prop_offset_write, NULL},
574 	{"interval", sizeof("interval") - 1, ev_periodic_prop_interval_read, ev_periodic_prop_interval_write, NULL},
575     {NULL, 0, NULL, NULL, NULL}
576 };
577 /* }}} */
578 
579 #endif
580 
581 #if EV_SIGNAL_ENABLE
582 /* {{{ ev_signal_property_entries[] */
583 const php_ev_property_entry ev_signal_property_entries[] = {
584 	{"signum", sizeof("signum") - 1, ev_signal_prop_signum_read, NULL, NULL},
585     {NULL, 0, NULL, NULL, NULL}
586 };
587 /* }}} */
588 
589 #endif
590 
591 #if EV_CHILD_ENABLE
592 /* {{{ ev_child_property_entries[] */
593 const php_ev_property_entry ev_child_property_entries[] = {
594 	{"pid",     sizeof("pid")     - 1, ev_child_prop_pid_read,     NULL, NULL},
595 	{"rpid",    sizeof("rpid")    - 1, ev_child_prop_rpid_read,    NULL, NULL},
596 	{"rstatus", sizeof("rstatus") - 1, ev_child_prop_rstatus_read, NULL, NULL},
597     {NULL, 0, NULL, NULL, NULL}
598 };
599 /* }}} */
600 
601 #endif
602 
603 #if EV_STAT_ENABLE
604 /* {{{ ev_stat_property_entries[] */
605 const php_ev_property_entry ev_stat_property_entries[] = {
606 	{"path",     sizeof("path")     - 1, ev_stat_prop_path_read,     NULL, NULL},
607 	{"interval", sizeof("interval") - 1, ev_stat_prop_interval_read, NULL, NULL},
608     {NULL, 0, NULL, NULL, NULL}
609 };
610 /* }}} */
611 
612 #endif
613 
614 #if EV_EMBED_ENABLE
615 /* {{{ ev_embed_property_entries[] */
616 const php_ev_property_entry ev_embed_property_entries[] = {
617 	{"other", sizeof("other") - 1, ev_embed_prop_other_read, NULL, NULL},
618     {NULL, 0, NULL, NULL, NULL}
619 };
620 /* }}} */
621 
622 #endif
623 
624 /*
625  * Local variables:
626  * tab-width: 4
627  * c-basic-offset: 4
628  * End:
629  * vim600: fdm=marker
630  * vim: noet sts=4 sw=4 ts=4
631  */
632