PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 6.3.0
Defender Security – Malware Scanner, Login Security & Firewall v6.3.0
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / lib / packages / Safe / generated / eio.php

eio.php in Defender Security – Malware Scanner, Login Security & Firewall 6.3.0, at lib/packages/Safe/generated/eio.php

2,102 lines 55.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WP_DEFENDER_VENDOR\Safe;
4
5 use WP_DEFENDER_VENDOR\Safe\Exceptions\EioException;
6
7 /**
8 * eio_busy artificially increases load taking
9 * delay seconds to execute. May be used for debugging,
10 * or benchmarking.
11 *
12 * @param int $delay Delay in seconds
13 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
14 * If NULL passed, pri internally is set to
15 * EIO_PRI_DEFAULT.
16 * @param callable|null $callback This callback is called when all the group requests are done.
17 * @param mixed|null $data Arbitrary variable passed to callback.
18 *
19 * @return resource eio_busy returns request resource on success.
20 * @throws EioException
21 *
22 */
23 function eio_busy(int $delay, int $pri = EIO_PRI_DEFAULT, ?callable $callback = null, mixed $data = null)
24 {
25 error_clear_last();
26 $result = \eio_busy($delay, $pri, $callback, $data);
27 if ($result === false) {
28 throw EioException::createFromPhpError();
29 }
30 return $result;
31 }
32
33
34 /**
35 * eio_chmod changes file, or directory permissions. The
36 * new permissions are specified by mode.
37 *
38 * @param string $path Path to the target file or directory
39 * Avoid relative
40 * paths
41 * @param int $mode The new permissions. E.g. 0644.
42 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
43 * If NULL passed, pri internally is set to
44 * EIO_PRI_DEFAULT.
45 * @param callable|null $callback
46 * callback function is called when the request is done.
47 * It should match the following prototype:
48 *
49 *
50 * data
51 * is custom data passed to the request.
52 *
53 *
54 * result
55 * request-specific result value; basically, the value returned by corresponding
56 * system call.
57 *
58 *
59 * req
60 * is optional request resource which can be used with functions like eio_get_last_error
61 *
62 *
63 *
64 * is custom data passed to the request.
65 *
66 * request-specific result value; basically, the value returned by corresponding
67 * system call.
68 *
69 * is optional request resource which can be used with functions like eio_get_last_error
70 * @param mixed $data is custom data passed to the request.
71 *
72 * @return resource eio_chmod returns request resource on success.
73 * @throws EioException
74 *
75 */
76 function eio_chmod(string $path, int $mode, int $pri = EIO_PRI_DEFAULT, ?callable $callback = null, $data = null)
77 {
78 error_clear_last();
79 $result = \eio_chmod($path, $mode, $pri, $callback, $data);
80 if ($result === false) {
81 throw EioException::createFromPhpError();
82 }
83 return $result;
84 }
85
86
87 /**
88 * Changes file, or directory permissions.
89 *
90 * @param string $path Path to file or directory.
91 * Avoid relative
92 * paths
93 * @param int $uid User ID. Is ignored when equal to -1.
94 * @param int $gid Group ID. Is ignored when equal to -1.
95 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
96 * If NULL passed, pri internally is set to
97 * EIO_PRI_DEFAULT.
98 * @param callable|null $callback
99 * callback function is called when the request is done.
100 * It should match the following prototype:
101 *
102 *
103 * data
104 * is custom data passed to the request.
105 *
106 *
107 * result
108 * request-specific result value; basically, the value returned by corresponding
109 * system call.
110 *
111 *
112 * req
113 * is optional request resource which can be used with functions like eio_get_last_error
114 *
115 *
116 *
117 * is custom data passed to the request.
118 *
119 * request-specific result value; basically, the value returned by corresponding
120 * system call.
121 *
122 * is optional request resource which can be used with functions like eio_get_last_error
123 * @param mixed $data is custom data passed to the request.
124 *
125 * @return resource eio_chown returns request resource on success.
126 * @throws EioException
127 *
128 */
129 function eio_chown(string $path, int $uid, int $gid = -1, int $pri = EIO_PRI_DEFAULT, ?callable $callback = null, $data = null)
130 {
131 error_clear_last();
132 $result = \eio_chown($path, $uid, $gid, $pri, $callback, $data);
133 if ($result === false) {
134 throw EioException::createFromPhpError();
135 }
136 return $result;
137 }
138
139
140 /**
141 * eio_close closes file specified by
142 * fd.
143 *
144 * @param mixed $fd Stream, Socket resource, or numeric file descriptor
145 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
146 * If NULL passed, pri internally is set to
147 * EIO_PRI_DEFAULT.
148 * @param callable|null $callback
149 * callback function is called when the request is done.
150 * It should match the following prototype:
151 *
152 *
153 * data
154 * is custom data passed to the request.
155 *
156 *
157 * result
158 * request-specific result value; basically, the value returned by corresponding
159 * system call.
160 *
161 *
162 * req
163 * is optional request resource which can be used with functions like eio_get_last_error
164 *
165 *
166 *
167 * is custom data passed to the request.
168 *
169 * request-specific result value; basically, the value returned by corresponding
170 * system call.
171 *
172 * is optional request resource which can be used with functions like eio_get_last_error
173 * @param mixed $data is custom data passed to the request.
174 *
175 * @return resource eio_close returns request resource on success.
176 * @throws EioException
177 *
178 */
179 function eio_close($fd, int $pri = EIO_PRI_DEFAULT, ?callable $callback = null, $data = null)
180 {
181 error_clear_last();
182 $result = \eio_close($fd, $pri, $callback, $data);
183 if ($result === false) {
184 throw EioException::createFromPhpError();
185 }
186 return $result;
187 }
188
189
190 /**
191 * eio_custom executes custom function specified by
192 * execute processing it just like any other eio_* call.
193 *
194 * @param callable $execute Specifies the request function that should match the following prototype:
195 *
196 *
197 * callback is event completion callback that should match the following
198 * prototype:
199 *
200 *
201 * data is the data passed to
202 * execute via data argument
203 * without modifications
204 * result value returned by execute
205 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
206 * If NULL passed, pri internally is set to
207 * EIO_PRI_DEFAULT.
208 * @param callable $callback
209 * callback function is called when the request is done.
210 * It should match the following prototype:
211 *
212 *
213 * data
214 * is custom data passed to the request.
215 *
216 *
217 * result
218 * request-specific result value; basically, the value returned by corresponding
219 * system call.
220 *
221 *
222 * req
223 * is optional request resource which can be used with functions like eio_get_last_error
224 *
225 *
226 *
227 * is custom data passed to the request.
228 *
229 * request-specific result value; basically, the value returned by corresponding
230 * system call.
231 *
232 * is optional request resource which can be used with functions like eio_get_last_error
233 * @param mixed $data is custom data passed to the request.
234 * @return resource eio_custom returns request resource on success.
235 * @throws EioException
236 *
237 */
238 function eio_custom(callable $execute, int $pri, callable $callback, $data = null)
239 {
240 error_clear_last();
241 $result = \eio_custom($execute, $pri, $callback, $data);
242 if ($result === false) {
243 throw EioException::createFromPhpError();
244 }
245 return $result;
246 }
247
248
249 /**
250 * eio_dup2 duplicates file descriptor.
251 *
252 * @param mixed $fd Source stream, Socket resource, or numeric file descriptor
253 * @param mixed $fd2 Target stream, Socket resource, or numeric file descriptor
254 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
255 * If NULL passed, pri internally is set to
256 * EIO_PRI_DEFAULT.
257 * @param callable|null $callback
258 * callback function is called when the request is done.
259 * It should match the following prototype:
260 *
261 *
262 * data
263 * is custom data passed to the request.
264 *
265 *
266 * result
267 * request-specific result value; basically, the value returned by corresponding
268 * system call.
269 *
270 *
271 * req
272 * is optional request resource which can be used with functions like eio_get_last_error
273 *
274 *
275 *
276 * is custom data passed to the request.
277 *
278 * request-specific result value; basically, the value returned by corresponding
279 * system call.
280 *
281 * is optional request resource which can be used with functions like eio_get_last_error
282 * @param mixed $data is custom data passed to the request.
283 *
284 * @return resource eio_dup2 returns request resource on success.
285 * @throws EioException
286 *
287 */
288 function eio_dup2($fd, $fd2, int $pri = EIO_PRI_DEFAULT, ?callable $callback = null, $data = null)
289 {
290 error_clear_last();
291 $result = \eio_dup2($fd, $fd2, $pri, $callback, $data);
292 if ($result === false) {
293 throw EioException::createFromPhpError();
294 }
295 return $result;
296 }
297
298
299 /**
300 * eio_event_loop polls libeio until all requests proceeded.
301 *
302 * @throws EioException
303 *
304 */
305 function eio_event_loop(): void
306 {
307 error_clear_last();
308 $result = \eio_event_loop();
309 if ($result === false) {
310 throw EioException::createFromPhpError();
311 }
312 }
313
314
315 /**
316 * eio_fallocate allows the caller to directly manipulate the allocated disk space for the
317 * file specified by fd file descriptor for the byte
318 * range starting at offset and continuing for
319 * length bytes.
320 *
321 * @param mixed $fd Stream, Socket resource, or numeric file descriptor, e.g. returned by eio_open.
322 * @param int $mode Currently only one flag is supported for mode:
323 * EIO_FALLOC_FL_KEEP_SIZE (the same as POSIX constant
324 * FALLOC_FL_KEEP_SIZE).
325 * @param int $offset Specifies start of the byte range.
326 * @param int $length Specifies length the byte range.
327 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
328 * If NULL passed, pri internally is set to
329 * EIO_PRI_DEFAULT.
330 * @param callable|null $callback
331 * callback function is called when the request is done.
332 * It should match the following prototype:
333 *
334 *
335 * data
336 * is custom data passed to the request.
337 *
338 *
339 * result
340 * request-specific result value; basically, the value returned by corresponding
341 * system call.
342 *
343 *
344 * req
345 * is optional request resource which can be used with functions like eio_get_last_error
346 *
347 *
348 *
349 * is custom data passed to the request.
350 *
351 * request-specific result value; basically, the value returned by corresponding
352 * system call.
353 *
354 * is optional request resource which can be used with functions like eio_get_last_error
355 * @param mixed $data is custom data passed to the request.
356 *
357 * @return resource eio_fallocate returns request resource on success.
358 * @throws EioException
359 *
360 */
361 function eio_fallocate($fd, int $mode, int $offset, int $length, int $pri = EIO_PRI_DEFAULT, ?callable $callback = null, $data = null)
362 {
363 error_clear_last();
364 $result = \eio_fallocate($fd, $mode, $offset, $length, $pri, $callback, $data);
365 if ($result === false) {
366 throw EioException::createFromPhpError();
367 }
368 return $result;
369 }
370
371
372 /**
373 * eio_fchmod changes permissions for the file specified
374 * by fd file descriptor.
375 *
376 * @param mixed $fd Stream, Socket resource, or numeric file descriptor, e.g. returned by eio_open.
377 * @param int $mode The new permissions. E.g. 0644.
378 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
379 * If NULL passed, pri internally is set to
380 * EIO_PRI_DEFAULT.
381 * @param callable|null $callback
382 * callback function is called when the request is done.
383 * It should match the following prototype:
384 *
385 *
386 * data
387 * is custom data passed to the request.
388 *
389 *
390 * result
391 * request-specific result value; basically, the value returned by corresponding
392 * system call.
393 *
394 *
395 * req
396 * is optional request resource which can be used with functions like eio_get_last_error
397 *
398 *
399 *
400 * is custom data passed to the request.
401 *
402 * request-specific result value; basically, the value returned by corresponding
403 * system call.
404 *
405 * is optional request resource which can be used with functions like eio_get_last_error
406 * @param mixed $data is custom data passed to the request.
407 *
408 * @return resource eio_fchmod returns request resource on success.
409 * @throws EioException
410 *
411 */
412 function eio_fchmod($fd, int $mode, int $pri = EIO_PRI_DEFAULT, ?callable $callback = null, $data = null)
413 {
414 error_clear_last();
415 $result = \eio_fchmod($fd, $mode, $pri, $callback, $data);
416 if ($result === false) {
417 throw EioException::createFromPhpError();
418 }
419 return $result;
420 }
421
422
423 /**
424 * eio_fdatasync synchronizes a file's in-core state with storage device.
425 *
426 * @param mixed $fd Stream, Socket resource, or numeric file descriptor, e.g. returned by eio_open.
427 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
428 * If NULL passed, pri internally is set to
429 * EIO_PRI_DEFAULT.
430 * @param callable|null $callback
431 * callback function is called when the request is done.
432 * It should match the following prototype:
433 *
434 *
435 * data
436 * is custom data passed to the request.
437 *
438 *
439 * result
440 * request-specific result value; basically, the value returned by corresponding
441 * system call.
442 *
443 *
444 * req
445 * is optional request resource which can be used with functions like eio_get_last_error
446 *
447 *
448 *
449 * is custom data passed to the request.
450 *
451 * request-specific result value; basically, the value returned by corresponding
452 * system call.
453 *
454 * is optional request resource which can be used with functions like eio_get_last_error
455 * @param mixed $data is custom data passed to the request.
456 *
457 * @return resource eio_fdatasync returns request resource on success.
458 * @throws EioException
459 *
460 */
461 function eio_fdatasync($fd, int $pri = EIO_PRI_DEFAULT, ?callable $callback = null, $data = null)
462 {
463 error_clear_last();
464 $result = \eio_fdatasync($fd, $pri, $callback, $data);
465 if ($result === false) {
466 throw EioException::createFromPhpError();
467 }
468 return $result;
469 }
470
471
472 /**
473 * eio_fstat returns file status information in
474 * result argument of callback
475 *
476 * @param mixed $fd Stream, Socket resource, or numeric file descriptor.
477 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
478 * If NULL passed, pri internally is set to
479 * EIO_PRI_DEFAULT.
480 * @param callable $callback
481 * callback function is called when the request is done.
482 * It should match the following prototype:
483 *
484 *
485 * data
486 * is custom data passed to the request.
487 *
488 *
489 * result
490 * request-specific result value; basically, the value returned by corresponding
491 * system call.
492 *
493 *
494 * req
495 * is optional request resource which can be used with functions like eio_get_last_error
496 *
497 *
498 *
499 * is custom data passed to the request.
500 *
501 * request-specific result value; basically, the value returned by corresponding
502 * system call.
503 *
504 * is optional request resource which can be used with functions like eio_get_last_error
505 * @param mixed $data is custom data passed to the request.
506 * @return resource eio_busy returns request resource on success.
507 * @throws EioException
508 *
509 */
510 function eio_fstat($fd, int $pri, callable $callback, $data = null)
511 {
512 error_clear_last();
513 if ($data !== null) {
514 $result = \eio_fstat($fd, $pri, $callback, $data);
515 } else {
516 $result = \eio_fstat($fd, $pri, $callback);
517 }
518 if ($result === false) {
519 throw EioException::createFromPhpError();
520 }
521 return $result;
522 }
523
524
525 /**
526 * eio_fstatvfs returns file system statistics in
527 * result of callback.
528 *
529 * @param mixed $fd A file descriptor of a file within the mounted file system.
530 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
531 * If NULL passed, pri internally is set to
532 * EIO_PRI_DEFAULT.
533 * @param callable $callback
534 * callback function is called when the request is done.
535 * It should match the following prototype:
536 *
537 *
538 * data
539 * is custom data passed to the request.
540 *
541 *
542 * result
543 * request-specific result value; basically, the value returned by corresponding
544 * system call.
545 *
546 *
547 * req
548 * is optional request resource which can be used with functions like eio_get_last_error
549 *
550 *
551 *
552 * is custom data passed to the request.
553 *
554 * request-specific result value; basically, the value returned by corresponding
555 * system call.
556 *
557 * is optional request resource which can be used with functions like eio_get_last_error
558 * @param mixed $data is custom data passed to the request.
559 * @return resource eio_fstatvfs returns request resource on success.
560 * @throws EioException
561 *
562 */
563 function eio_fstatvfs($fd, int $pri, callable $callback, $data = null)
564 {
565 error_clear_last();
566 if ($data !== null) {
567 $result = \eio_fstatvfs($fd, $pri, $callback, $data);
568 } else {
569 $result = \eio_fstatvfs($fd, $pri, $callback);
570 }
571 if ($result === false) {
572 throw EioException::createFromPhpError();
573 }
574 return $result;
575 }
576
577
578 /**
579 * Synchronize a file's in-core state with storage device
580 *
581 * @param mixed $fd Stream, Socket resource, or numeric file descriptor.
582 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
583 * If NULL passed, pri internally is set to
584 * EIO_PRI_DEFAULT.
585 * @param callable|null $callback
586 * callback function is called when the request is done.
587 * It should match the following prototype:
588 *
589 *
590 * data
591 * is custom data passed to the request.
592 *
593 *
594 * result
595 * request-specific result value; basically, the value returned by corresponding
596 * system call.
597 *
598 *
599 * req
600 * is optional request resource which can be used with functions like eio_get_last_error
601 *
602 *
603 *
604 * is custom data passed to the request.
605 *
606 * request-specific result value; basically, the value returned by corresponding
607 * system call.
608 *
609 * is optional request resource which can be used with functions like eio_get_last_error
610 * @param mixed $data is custom data passed to the request.
611 *
612 * @return resource eio_fsync returns request resource on success.
613 * @throws EioException
614 *
615 */
616 function eio_fsync($fd, int $pri = EIO_PRI_DEFAULT, ?callable $callback = null, $data = null)
617 {
618 error_clear_last();
619 $result = \eio_fsync($fd, $pri, $callback, $data);
620 if ($result === false) {
621 throw EioException::createFromPhpError();
622 }
623 return $result;
624 }
625
626
627 /**
628 * eio_ftruncate causes a regular file referenced by
629 * fd file descriptor to be truncated to precisely
630 * length bytes.
631 *
632 * @param mixed $fd Stream, Socket resource, or numeric file descriptor.
633 * @param int $offset Offset from beginning of the file
634 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
635 * If NULL passed, pri internally is set to
636 * EIO_PRI_DEFAULT.
637 * @param callable|null $callback
638 * callback function is called when the request is done.
639 * It should match the following prototype:
640 *
641 *
642 * data
643 * is custom data passed to the request.
644 *
645 *
646 * result
647 * request-specific result value; basically, the value returned by corresponding
648 * system call.
649 *
650 *
651 * req
652 * is optional request resource which can be used with functions like eio_get_last_error
653 *
654 *
655 *
656 * is custom data passed to the request.
657 *
658 * request-specific result value; basically, the value returned by corresponding
659 * system call.
660 *
661 * is optional request resource which can be used with functions like eio_get_last_error
662 * @param mixed $data is custom data passed to the request.
663 *
664 * @return resource eio_ftruncate returns request resource on success.
665 * @throws EioException
666 *
667 */
668 function eio_ftruncate($fd, int $offset = 0, int $pri = EIO_PRI_DEFAULT, ?callable $callback = null, $data = null)
669 {
670 error_clear_last();
671 $result = \eio_ftruncate($fd, $offset, $pri, $callback, $data);
672 if ($result === false) {
673 throw EioException::createFromPhpError();
674 }
675 return $result;
676 }
677
678
679 /**
680 * eio_futime changes file last access and modification
681 * times.
682 *
683 * @param mixed $fd Stream, Socket resource, or numeric file descriptor, e.g. returned by eio_open
684 * @param float $atime Access time
685 * @param float $mtime Modification time
686 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
687 * If NULL passed, pri internally is set to
688 * EIO_PRI_DEFAULT.
689 * @param callable|null $callback
690 * callback function is called when the request is done.
691 * It should match the following prototype:
692 *
693 *
694 * data
695 * is custom data passed to the request.
696 *
697 *
698 * result
699 * request-specific result value; basically, the value returned by corresponding
700 * system call.
701 *
702 *
703 * req
704 * is optional request resource which can be used with functions like eio_get_last_error
705 *
706 *
707 *
708 * is custom data passed to the request.
709 *
710 * request-specific result value; basically, the value returned by corresponding
711 * system call.
712 *
713 * is optional request resource which can be used with functions like eio_get_last_error
714 * @param mixed $data is custom data passed to the request.
715 *
716 * @return resource eio_futime returns request resource on success.
717 * @throws EioException
718 *
719 */
720 function eio_futime($fd, float $atime, float $mtime, int $pri = EIO_PRI_DEFAULT, ?callable $callback = null, $data = null)
721 {
722 error_clear_last();
723 $result = \eio_futime($fd, $atime, $mtime, $pri, $callback, $data);
724 if ($result === false) {
725 throw EioException::createFromPhpError();
726 }
727 return $result;
728 }
729
730
731 /**
732 * eio_grp creates a request group.
733 *
734 * @param callable $callback
735 * callback function is called when the request is done.
736 * It should match the following prototype:
737 *
738 *
739 * data
740 * is custom data passed to the request.
741 *
742 *
743 * result
744 * request-specific result value; basically, the value returned by corresponding
745 * system call.
746 *
747 *
748 * req
749 * is optional request resource which can be used with functions like eio_get_last_error
750 *
751 *
752 *
753 * is custom data passed to the request.
754 *
755 * request-specific result value; basically, the value returned by corresponding
756 * system call.
757 *
758 * is optional request resource which can be used with functions like eio_get_last_error
759 * @param string|null $data is custom data passed to the request.
760 *
761 * @return resource eio_grp returns request group resource on success.
762 * @throws EioException
763 *
764 */
765 function eio_grp(callable $callback, ?string $data = null)
766 {
767 error_clear_last();
768 $result = \eio_grp($callback, $data);
769 if ($result === false) {
770 throw EioException::createFromPhpError();
771 }
772 return $result;
773 }
774
775
776 /**
777 * eio_lstat returns file status information in
778 * result argument of callback
779 *
780 * @param string $path The file path
781 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
782 * If NULL passed, pri internally is set to
783 * EIO_PRI_DEFAULT.
784 * @param callable $callback
785 * callback function is called when the request is done.
786 * It should match the following prototype:
787 *
788 *
789 * data
790 * is custom data passed to the request.
791 *
792 *
793 * result
794 * request-specific result value; basically, the value returned by corresponding
795 * system call.
796 *
797 *
798 * req
799 * is optional request resource which can be used with functions like eio_get_last_error
800 *
801 *
802 *
803 * is custom data passed to the request.
804 *
805 * request-specific result value; basically, the value returned by corresponding
806 * system call.
807 *
808 * is optional request resource which can be used with functions like eio_get_last_error
809 * @param mixed $data is custom data passed to the request.
810 * @return resource eio_lstat returns request resource on success.
811 * @throws EioException
812 *
813 */
814 function eio_lstat(string $path, int $pri, callable $callback, $data = null)
815 {
816 error_clear_last();
817 $result = \eio_lstat($path, $pri, $callback, $data);
818 if ($result === false) {
819 throw EioException::createFromPhpError();
820 }
821 return $result;
822 }
823
824
825 /**
826 * eio_mkdir creates directory with specified access
827 * mode.
828 *
829 * @param string $path Path for the new directory.
830 * @param int $mode Access mode, e.g. 0755
831 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
832 * If NULL passed, pri internally is set to
833 * EIO_PRI_DEFAULT.
834 * @param callable|null $callback
835 * callback function is called when the request is done.
836 * It should match the following prototype:
837 *
838 *
839 * data
840 * is custom data passed to the request.
841 *
842 *
843 * result
844 * request-specific result value; basically, the value returned by corresponding
845 * system call.
846 *
847 *
848 * req
849 * is optional request resource which can be used with functions like eio_get_last_error
850 *
851 *
852 *
853 * is custom data passed to the request.
854 *
855 * request-specific result value; basically, the value returned by corresponding
856 * system call.
857 *
858 * is optional request resource which can be used with functions like eio_get_last_error
859 * @param mixed $data is custom data passed to the request.
860 *
861 * @return resource eio_mkdir returns request resource on success.
862 * @throws EioException
863 *
864 */
865 function eio_mkdir(string $path, int $mode, int $pri = EIO_PRI_DEFAULT, ?callable $callback = null, $data = null)
866 {
867 error_clear_last();
868 $result = \eio_mkdir($path, $mode, $pri, $callback, $data);
869 if ($result === false) {
870 throw EioException::createFromPhpError();
871 }
872 return $result;
873 }
874
875
876 /**
877 * eio_mknod creates ordinary or special(often) file.
878 *
879 * @param string $path Path for the new node(file).
880 * @param int $mode Specifies both the permissions to use and the type of node to be
881 * created. It should be a combination (using bitwise OR) of one of the
882 * file types listed below and the permissions for the new node(e.g. 0640).
883 *
884 * Possible file types are: EIO_S_IFREG(regular file),
885 * EIO_S_IFCHR(character file),
886 * EIO_S_IFBLK(block special file),
887 * EIO_S_IFIFO(FIFO - named pipe) and
888 * EIO_S_IFSOCK(UNIX domain socket).
889 *
890 * To specify permissions EIO_S_I* constants could be
891 * used.
892 * @param int $dev If the file type is EIO_S_IFCHR or
893 * EIO_S_IFBLK then dev specifies the major and minor
894 * numbers of the newly created device special file. Otherwise
895 * dev ignored. See mknod(2) man page for
896 * details.
897 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
898 * If NULL passed, pri internally is set to
899 * EIO_PRI_DEFAULT.
900 * @param callable|null $callback
901 * callback function is called when the request is done.
902 * It should match the following prototype:
903 *
904 *
905 * data
906 * is custom data passed to the request.
907 *
908 *
909 * result
910 * request-specific result value; basically, the value returned by corresponding
911 * system call.
912 *
913 *
914 * req
915 * is optional request resource which can be used with functions like eio_get_last_error
916 *
917 *
918 *
919 * is custom data passed to the request.
920 *
921 * request-specific result value; basically, the value returned by corresponding
922 * system call.
923 *
924 * is optional request resource which can be used with functions like eio_get_last_error
925 * @param mixed $data is custom data passed to the request.
926 *
927 * @return resource eio_mknod returns request resource on success.
928 * @throws EioException
929 *
930 */
931 function eio_mknod(string $path, int $mode, int $dev, int $pri = EIO_PRI_DEFAULT, ?callable $callback = null, $data = null)
932 {
933 error_clear_last();
934 $result = \eio_mknod($path, $mode, $dev, $pri, $callback, $data);
935 if ($result === false) {
936 throw EioException::createFromPhpError();
937 }
938 return $result;
939 }
940
941
942 /**
943 * eio_nop does nothing, except go through the whole
944 * request cycle. Could be useful in debugging.
945 *
946 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
947 * If NULL passed, pri internally is set to
948 * EIO_PRI_DEFAULT.
949 * @param callable|null $callback
950 * callback function is called when the request is done.
951 * It should match the following prototype:
952 *
953 *
954 * data
955 * is custom data passed to the request.
956 *
957 *
958 * result
959 * request-specific result value; basically, the value returned by corresponding
960 * system call.
961 *
962 *
963 * req
964 * is optional request resource which can be used with functions like eio_get_last_error
965 *
966 *
967 *
968 * is custom data passed to the request.
969 *
970 * request-specific result value; basically, the value returned by corresponding
971 * system call.
972 *
973 * is optional request resource which can be used with functions like eio_get_last_error
974 * @param mixed $data is custom data passed to the request.
975 *
976 * @return resource eio_nop returns request resource on success.
977 * @throws EioException
978 *
979 */
980 function eio_nop(int $pri = EIO_PRI_DEFAULT, ?callable $callback = null, $data = null)
981 {
982 error_clear_last();
983 $result = \eio_nop($pri, $callback, $data);
984 if ($result === false) {
985 throw EioException::createFromPhpError();
986 }
987 return $result;
988 }
989
990
991 /**
992 * eio_readahead populates the page cache with data from a file so that subsequent reads from
993 * that file will not block on disk I/O. See READAHEAD(2) man page for details.
994 *
995 * @param mixed $fd Stream, Socket resource, or numeric file descriptor
996 * @param int $offset Starting point from which data is to be read.
997 * @param int $length Number of bytes to be read.
998 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
999 * If NULL passed, pri internally is set to
1000 * EIO_PRI_DEFAULT.
1001 * @param callable|null $callback
1002 * callback function is called when the request is done.
1003 * It should match the following prototype:
1004 *
1005 *
1006 * data
1007 * is custom data passed to the request.
1008 *
1009 *
1010 * result
1011 * request-specific result value; basically, the value returned by corresponding
1012 * system call.
1013 *
1014 *
1015 * req
1016 * is optional request resource which can be used with functions like eio_get_last_error
1017 *
1018 *
1019 *
1020 * is custom data passed to the request.
1021 *
1022 * request-specific result value; basically, the value returned by corresponding
1023 * system call.
1024 *
1025 * is optional request resource which can be used with functions like eio_get_last_error
1026 * @param mixed $data is custom data passed to the request.
1027 *
1028 * @return resource eio_readahead returns request resource on success.
1029 * @throws EioException
1030 *
1031 */
1032 function eio_readahead($fd, int $offset, int $length, int $pri = EIO_PRI_DEFAULT, ?callable $callback = null, $data = null)
1033 {
1034 error_clear_last();
1035 $result = \eio_readahead($fd, $offset, $length, $pri, $callback, $data);
1036 if ($result === false) {
1037 throw EioException::createFromPhpError();
1038 }
1039 return $result;
1040 }
1041
1042
1043 /**
1044 * Reads through a whole directory(via the opendir, readdir and
1045 * closedir system calls) and returns either the names or an array in
1046 * result argument of callback
1047 * function, depending on the flags argument.
1048 *
1049 * @param string $path Directory path.
1050 * @param int $flags Combination of EIO_READDIR_* constants.
1051 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
1052 * If NULL passed, pri internally is set to
1053 * EIO_PRI_DEFAULT.
1054 * @param callable $callback
1055 * callback function is called when the request is done.
1056 * It should match the following prototype:
1057 *
1058 *
1059 * data
1060 * is custom data passed to the request.
1061 *
1062 *
1063 * result
1064 * request-specific result value; basically, the value returned by corresponding
1065 * system call.
1066 *
1067 *
1068 * req
1069 * is optional request resource which can be used with functions like eio_get_last_error
1070 *
1071 *
1072 *
1073 * is custom data passed to the request.
1074 *
1075 * request-specific result value; basically, the value returned by corresponding
1076 * system call.
1077 *
1078 * is optional request resource which can be used with functions like eio_get_last_error
1079 * @param string|null $data is custom data passed to the request.
1080 *
1081 * @return resource eio_readdir returns request resource on success. Sets result argument of
1082 * callback function according to
1083 * flags:
1084 *
1085 *
1086 *
1087 *
1088 *
1089 *
1090 * EIO_READDIR_DENTS
1091 * (integer)
1092 *
1093 *
1094 *
1095 * eio_readdir flag. If specified, the result argument of the callback
1096 * becomes an array with the following keys:
1097 * 'names' - array of directory names
1098 * 'dents' - array of struct
1099 * eio_dirent-like arrays having the following keys each:
1100 * 'name' - the directory name;
1101 * 'type' - one of EIO_DT_*
1102 * constants;
1103 * 'inode' - the inode number, if available, otherwise
1104 * unspecified;
1105 *
1106 *
1107 *
1108 *
1109 *
1110 * EIO_READDIR_DIRS_FIRST
1111 * (integer)
1112 *
1113 *
1114 *
1115 * When this flag is specified, the names will be returned in an order
1116 * where likely directories come first, in optimal stat order.
1117 *
1118 *
1119 *
1120 *
1121 *
1122 * EIO_READDIR_STAT_ORDER
1123 * (integer)
1124 *
1125 *
1126 *
1127 * When this flag is specified, then the names will be returned in an order
1128 * suitable for stat'ing each one. When planning to
1129 * stat all files in the given directory, the
1130 * returned order will likely be
1131 * fastest.
1132 *
1133 *
1134 *
1135 *
1136 *
1137 * EIO_READDIR_FOUND_UNKNOWN
1138 * (integer)
1139 *
1140 *
1141 *
1142 *
1143 *
1144 *
1145 *
1146 *
1147 *
1148 *
1149 *
1150 * Node types:
1151 *
1152 *
1153 *
1154 *
1155 *
1156 * EIO_DT_UNKNOWN
1157 * (integer)
1158 *
1159 *
1160 *
1161 * Unknown node type(very common). Further stat needed.
1162 *
1163 *
1164 *
1165 *
1166 *
1167 * EIO_DT_FIFO
1168 * (integer)
1169 *
1170 *
1171 *
1172 * FIFO node type
1173 *
1174 *
1175 *
1176 *
1177 *
1178 * EIO_DT_CHR
1179 * (integer)
1180 *
1181 *
1182 *
1183 * Node type
1184 *
1185 *
1186 *
1187 *
1188 *
1189 * EIO_DT_MPC
1190 * (integer)
1191 *
1192 *
1193 *
1194 * Multiplexed char device (v7+coherent) node type
1195 *
1196 *
1197 *
1198 *
1199 *
1200 * EIO_DT_DIR
1201 * (integer)
1202 *
1203 *
1204 *
1205 * Directory node type
1206 *
1207 *
1208 *
1209 *
1210 *
1211 * EIO_DT_NAM
1212 * (integer)
1213 *
1214 *
1215 *
1216 * Xenix special named file node type
1217 *
1218 *
1219 *
1220 *
1221 *
1222 * EIO_DT_BLK
1223 * (integer)
1224 *
1225 *
1226 *
1227 * Node type
1228 *
1229 *
1230 *
1231 *
1232 *
1233 * EIO_DT_MPB
1234 * (integer)
1235 *
1236 *
1237 *
1238 * Multiplexed block device (v7+coherent)
1239 *
1240 *
1241 *
1242 *
1243 *
1244 * EIO_DT_REG
1245 * (integer)
1246 *
1247 *
1248 *
1249 * Node type
1250 *
1251 *
1252 *
1253 *
1254 *
1255 * EIO_DT_NWK
1256 * (integer)
1257 *
1258 *
1259 *
1260 *
1261 *
1262 *
1263 *
1264 *
1265 * EIO_DT_CMP
1266 * (integer)
1267 *
1268 *
1269 *
1270 * HP-UX network special node type
1271 *
1272 *
1273 *
1274 *
1275 *
1276 * EIO_DT_LNK
1277 * (integer)
1278 *
1279 *
1280 *
1281 * Link node type
1282 *
1283 *
1284 *
1285 *
1286 *
1287 * EIO_DT_SOCK
1288 * (integer)
1289 *
1290 *
1291 *
1292 * Socket node type
1293 *
1294 *
1295 *
1296 *
1297 *
1298 * EIO_DT_DOOR
1299 * (integer)
1300 *
1301 *
1302 *
1303 * Solaris door node type
1304 *
1305 *
1306 *
1307 *
1308 *
1309 * EIO_DT_WHT
1310 * (integer)
1311 *
1312 *
1313 *
1314 * Node type
1315 *
1316 *
1317 *
1318 *
1319 *
1320 * EIO_DT_MAX
1321 * (integer)
1322 *
1323 *
1324 *
1325 * Highest node type value
1326 *
1327 *
1328 *
1329 *
1330 *
1331 *
1332 *
1333 * @throws EioException
1334 *
1335 */
1336 function eio_readdir(string $path, int $flags, int $pri, callable $callback, ?string $data = null)
1337 {
1338 error_clear_last();
1339 $result = \eio_readdir($path, $flags, $pri, $callback, $data);
1340 if ($result === false) {
1341 throw EioException::createFromPhpError();
1342 }
1343 return $result;
1344 }
1345
1346
1347 /**
1348 *
1349 *
1350 * @param string $path Source symbolic link path
1351 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
1352 * If NULL passed, pri internally is set to
1353 * EIO_PRI_DEFAULT.
1354 * @param callable $callback
1355 * callback function is called when the request is done.
1356 * It should match the following prototype:
1357 *
1358 *
1359 * data
1360 * is custom data passed to the request.
1361 *
1362 *
1363 * result
1364 * request-specific result value; basically, the value returned by corresponding
1365 * system call.
1366 *
1367 *
1368 * req
1369 * is optional request resource which can be used with functions like eio_get_last_error
1370 *
1371 *
1372 *
1373 * is custom data passed to the request.
1374 *
1375 * request-specific result value; basically, the value returned by corresponding
1376 * system call.
1377 *
1378 * is optional request resource which can be used with functions like eio_get_last_error
1379 * @param string|null $data is custom data passed to the request.
1380 *
1381 * @return resource eio_readlink returns request resource on success.
1382 * @throws EioException
1383 *
1384 */
1385 function eio_readlink(string $path, int $pri, callable $callback, ?string $data = null)
1386 {
1387 error_clear_last();
1388 $result = \eio_readlink($path, $pri, $callback, $data);
1389 if ($result === false) {
1390 throw EioException::createFromPhpError();
1391 }
1392 return $result;
1393 }
1394
1395
1396 /**
1397 * eio_rename renames or moves a file to new location.
1398 *
1399 * @param string $path Source path
1400 * @param string $new_path Target path
1401 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
1402 * If NULL passed, pri internally is set to
1403 * EIO_PRI_DEFAULT.
1404 * @param callable|null $callback
1405 * callback function is called when the request is done.
1406 * It should match the following prototype:
1407 *
1408 *
1409 * data
1410 * is custom data passed to the request.
1411 *
1412 *
1413 * result
1414 * request-specific result value; basically, the value returned by corresponding
1415 * system call.
1416 *
1417 *
1418 * req
1419 * is optional request resource which can be used with functions like eio_get_last_error
1420 *
1421 *
1422 *
1423 * is custom data passed to the request.
1424 *
1425 * request-specific result value; basically, the value returned by corresponding
1426 * system call.
1427 *
1428 * is optional request resource which can be used with functions like eio_get_last_error
1429 * @param mixed $data is custom data passed to the request.
1430 *
1431 * @return resource eio_rename returns request resource on success.
1432 * @throws EioException
1433 *
1434 */
1435 function eio_rename(string $path, string $new_path, int $pri = EIO_PRI_DEFAULT, ?callable $callback = null, $data = null)
1436 {
1437 error_clear_last();
1438 $result = \eio_rename($path, $new_path, $pri, $callback, $data);
1439 if ($result === false) {
1440 throw EioException::createFromPhpError();
1441 }
1442 return $result;
1443 }
1444
1445
1446 /**
1447 * eio_rmdir removes a directory.
1448 *
1449 * @param string $path Directory path
1450 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
1451 * If NULL passed, pri internally is set to
1452 * EIO_PRI_DEFAULT.
1453 * @param callable|null $callback
1454 * callback function is called when the request is done.
1455 * It should match the following prototype:
1456 *
1457 *
1458 * data
1459 * is custom data passed to the request.
1460 *
1461 *
1462 * result
1463 * request-specific result value; basically, the value returned by corresponding
1464 * system call.
1465 *
1466 *
1467 * req
1468 * is optional request resource which can be used with functions like eio_get_last_error
1469 *
1470 *
1471 *
1472 * is custom data passed to the request.
1473 *
1474 * request-specific result value; basically, the value returned by corresponding
1475 * system call.
1476 *
1477 * is optional request resource which can be used with functions like eio_get_last_error
1478 * @param mixed $data is custom data passed to the request.
1479 *
1480 * @return resource eio_rmdir returns request resource on success.
1481 * @throws EioException
1482 *
1483 */
1484 function eio_rmdir(string $path, int $pri = EIO_PRI_DEFAULT, ?callable $callback = null, $data = null)
1485 {
1486 error_clear_last();
1487 $result = \eio_rmdir($path, $pri, $callback, $data);
1488 if ($result === false) {
1489 throw EioException::createFromPhpError();
1490 }
1491 return $result;
1492 }
1493
1494
1495 /**
1496 * eio_seek repositions the offset of the open file associated with
1497 * stream, Socket resource, or file descriptor specified by fd to the argument offset according to the directive whence as follows:
1498 *
1499 * EIO_SEEK_SET - Set position equal to offset bytes.
1500 * EIO_SEEK_CUR - Set position to current location plus offset.
1501 * EIO_SEEK_END - Set position to end-of-file plus offset.
1502 *
1503 *
1504 * @param mixed $fd Stream, Socket resource, or numeric file descriptor
1505 * @param int $offset Starting point from which data is to be read.
1506 * @param int $whence Number of bytes to be read.
1507 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
1508 * If NULL passed, pri internally is set to
1509 * EIO_PRI_DEFAULT.
1510 * @param callable|null $callback
1511 * callback function is called when the request is done.
1512 * It should match the following prototype:
1513 *
1514 *
1515 * data
1516 * is custom data passed to the request.
1517 *
1518 *
1519 * result
1520 * request-specific result value; basically, the value returned by corresponding
1521 * system call.
1522 *
1523 *
1524 * req
1525 * is optional request resource which can be used with functions like eio_get_last_error
1526 *
1527 *
1528 *
1529 * is custom data passed to the request.
1530 *
1531 * request-specific result value; basically, the value returned by corresponding
1532 * system call.
1533 *
1534 * is optional request resource which can be used with functions like eio_get_last_error
1535 * @param mixed $data is custom data passed to the request.
1536 *
1537 * @return resource eio_seek returns request resource on success.
1538 * @throws EioException
1539 *
1540 */
1541 function eio_seek($fd, int $offset, int $whence, int $pri = EIO_PRI_DEFAULT, ?callable $callback = null, $data = null)
1542 {
1543 error_clear_last();
1544 $result = \eio_seek($fd, $offset, $whence, $pri, $callback, $data);
1545 if ($result === false) {
1546 throw EioException::createFromPhpError();
1547 }
1548 return $result;
1549 }
1550
1551
1552 /**
1553 * eio_sendfile copies data between one file descriptor
1554 * and another. See SENDFILE(2) man page for details.
1555 *
1556 * @param mixed $out_fd Output stream, Socket resource, or file descriptor. Should be opened for writing.
1557 * @param mixed $in_fd Input stream, Socket resource, or file descriptor. Should be opened for reading.
1558 * @param int $offset Offset within the source file.
1559 * @param int $length Number of bytes to copy.
1560 * @param int|null $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
1561 * If NULL passed, pri internally is set to
1562 * EIO_PRI_DEFAULT.
1563 * @param callable|null $callback
1564 * callback function is called when the request is done.
1565 * It should match the following prototype:
1566 *
1567 *
1568 * data
1569 * is custom data passed to the request.
1570 *
1571 *
1572 * result
1573 * request-specific result value; basically, the value returned by corresponding
1574 * system call.
1575 *
1576 *
1577 * req
1578 * is optional request resource which can be used with functions like eio_get_last_error
1579 *
1580 *
1581 *
1582 * is custom data passed to the request.
1583 *
1584 * request-specific result value; basically, the value returned by corresponding
1585 * system call.
1586 *
1587 * is optional request resource which can be used with functions like eio_get_last_error
1588 * @param string|null $data is custom data passed to the request.
1589 *
1590 * @return resource eio_sendfile returns request resource on success.
1591 * @throws EioException
1592 *
1593 */
1594 function eio_sendfile($out_fd, $in_fd, int $offset, int $length, ?int $pri = null, ?callable $callback = null, ?string $data = null)
1595 {
1596 error_clear_last();
1597 if ($data !== null) {
1598 $result = \eio_sendfile($out_fd, $in_fd, $offset, $length, $pri, $callback, $data);
1599 } elseif ($callback !== null) {
1600 $result = \eio_sendfile($out_fd, $in_fd, $offset, $length, $pri, $callback);
1601 } elseif ($pri !== null) {
1602 $result = \eio_sendfile($out_fd, $in_fd, $offset, $length, $pri);
1603 } else {
1604 $result = \eio_sendfile($out_fd, $in_fd, $offset, $length);
1605 }
1606 if ($result === false) {
1607 throw EioException::createFromPhpError();
1608 }
1609 return $result;
1610 }
1611
1612
1613 /**
1614 * eio_stat returns file status information in
1615 * result argument of callback
1616 *
1617 * @param string $path The file path
1618 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
1619 * If NULL passed, pri internally is set to
1620 * EIO_PRI_DEFAULT.
1621 * @param callable $callback
1622 * callback function is called when the request is done.
1623 * It should match the following prototype:
1624 *
1625 *
1626 * data
1627 * is custom data passed to the request.
1628 *
1629 *
1630 * result
1631 * request-specific result value; basically, the value returned by corresponding
1632 * system call.
1633 *
1634 *
1635 * req
1636 * is optional request resource which can be used with functions like eio_get_last_error
1637 *
1638 *
1639 *
1640 * is custom data passed to the request.
1641 *
1642 * request-specific result value; basically, the value returned by corresponding
1643 * system call.
1644 *
1645 * is optional request resource which can be used with functions like eio_get_last_error
1646 * @param mixed $data is custom data passed to the request.
1647 * @return resource eio_stat returns request resource on success. On success assigns result argument of
1648 * callback to an array.
1649 * @throws EioException
1650 *
1651 */
1652 function eio_stat(string $path, int $pri, callable $callback, $data = null)
1653 {
1654 error_clear_last();
1655 $result = \eio_stat($path, $pri, $callback, $data);
1656 if ($result === false) {
1657 throw EioException::createFromPhpError();
1658 }
1659 return $result;
1660 }
1661
1662
1663 /**
1664 * eio_statvfs returns file system statistics information in
1665 * result argument of callback
1666 *
1667 * @param string $path Pathname of any file within the mounted file system
1668 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
1669 * If NULL passed, pri internally is set to
1670 * EIO_PRI_DEFAULT.
1671 * @param callable $callback
1672 * callback function is called when the request is done.
1673 * It should match the following prototype:
1674 *
1675 *
1676 * data
1677 * is custom data passed to the request.
1678 *
1679 *
1680 * result
1681 * request-specific result value; basically, the value returned by corresponding
1682 * system call.
1683 *
1684 *
1685 * req
1686 * is optional request resource which can be used with functions like eio_get_last_error
1687 *
1688 *
1689 *
1690 * is custom data passed to the request.
1691 *
1692 * request-specific result value; basically, the value returned by corresponding
1693 * system call.
1694 *
1695 * is optional request resource which can be used with functions like eio_get_last_error
1696 * @param mixed $data is custom data passed to the request.
1697 * @return resource eio_statvfs returns request resource on success. On success assigns result argument of
1698 * callback to an array.
1699 * @throws EioException
1700 *
1701 */
1702 function eio_statvfs(string $path, int $pri, callable $callback, $data = null)
1703 {
1704 error_clear_last();
1705 if ($data !== null) {
1706 $result = \eio_statvfs($path, $pri, $callback, $data);
1707 } else {
1708 $result = \eio_statvfs($path, $pri, $callback);
1709 }
1710 if ($result === false) {
1711 throw EioException::createFromPhpError();
1712 }
1713 return $result;
1714 }
1715
1716
1717 /**
1718 * eio_symlink creates a symbolic link
1719 * new_path to path.
1720 *
1721 * @param string $path Source path
1722 * @param string $new_path Target path
1723 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
1724 * If NULL passed, pri internally is set to
1725 * EIO_PRI_DEFAULT.
1726 * @param callable|null $callback
1727 * callback function is called when the request is done.
1728 * It should match the following prototype:
1729 *
1730 *
1731 * data
1732 * is custom data passed to the request.
1733 *
1734 *
1735 * result
1736 * request-specific result value; basically, the value returned by corresponding
1737 * system call.
1738 *
1739 *
1740 * req
1741 * is optional request resource which can be used with functions like eio_get_last_error
1742 *
1743 *
1744 *
1745 * is custom data passed to the request.
1746 *
1747 * request-specific result value; basically, the value returned by corresponding
1748 * system call.
1749 *
1750 * is optional request resource which can be used with functions like eio_get_last_error
1751 * @param mixed $data is custom data passed to the request.
1752 *
1753 * @return resource eio_symlink returns request resource on success.
1754 * @throws EioException
1755 *
1756 */
1757 function eio_symlink(string $path, string $new_path, int $pri = EIO_PRI_DEFAULT, ?callable $callback = null, $data = null)
1758 {
1759 error_clear_last();
1760 $result = \eio_symlink($path, $new_path, $pri, $callback, $data);
1761 if ($result === false) {
1762 throw EioException::createFromPhpError();
1763 }
1764 return $result;
1765 }
1766
1767
1768 /**
1769 * eio_sync_file_range permits fine control when synchronizing the open file referred to by the file
1770 * descriptor fd with disk.
1771 *
1772 * @param mixed $fd File descriptor
1773 * @param int $offset The starting byte of the file range to be synchronized
1774 * @param int $nbytes Specifies the length of the range to be synchronized, in bytes. If
1775 * nbytes is zero, then all bytes from offset through
1776 * to the end of file are synchronized.
1777 * @param int $flags A bit-mask. Can include any of the following values:
1778 * EIO_SYNC_FILE_RANGE_WAIT_BEFORE,
1779 * EIO_SYNC_FILE_RANGE_WRITE,
1780 * EIO_SYNC_FILE_RANGE_WAIT_AFTER. These flags have
1781 * the same meaning as their SYNC_FILE_RANGE_*
1782 * counterparts(see SYNC_FILE_RANGE(2) man page).
1783 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
1784 * If NULL passed, pri internally is set to
1785 * EIO_PRI_DEFAULT.
1786 * @param callable|null $callback
1787 * callback function is called when the request is done.
1788 * It should match the following prototype:
1789 *
1790 *
1791 * data
1792 * is custom data passed to the request.
1793 *
1794 *
1795 * result
1796 * request-specific result value; basically, the value returned by corresponding
1797 * system call.
1798 *
1799 *
1800 * req
1801 * is optional request resource which can be used with functions like eio_get_last_error
1802 *
1803 *
1804 *
1805 * is custom data passed to the request.
1806 *
1807 * request-specific result value; basically, the value returned by corresponding
1808 * system call.
1809 *
1810 * is optional request resource which can be used with functions like eio_get_last_error
1811 * @param mixed $data is custom data passed to the request.
1812 *
1813 * @return resource eio_sync_file_range returns request resource on success.
1814 * @throws EioException
1815 *
1816 */
1817 function eio_sync_file_range($fd, int $offset, int $nbytes, int $flags, int $pri = EIO_PRI_DEFAULT, ?callable $callback = null, $data = null)
1818 {
1819 error_clear_last();
1820 $result = \eio_sync_file_range($fd, $offset, $nbytes, $flags, $pri, $callback, $data);
1821 if ($result === false) {
1822 throw EioException::createFromPhpError();
1823 }
1824 return $result;
1825 }
1826
1827
1828 /**
1829 *
1830 *
1831 * @param int $pri
1832 * @param callable|null $callback
1833 * @param mixed $data
1834 *
1835 * @return resource eio_sync returns request resource on success.
1836 * @throws EioException
1837 *
1838 */
1839 function eio_sync(int $pri = EIO_PRI_DEFAULT, ?callable $callback = null, $data = null)
1840 {
1841 error_clear_last();
1842 $result = \eio_sync($pri, $callback, $data);
1843 if ($result === false) {
1844 throw EioException::createFromPhpError();
1845 }
1846 return $result;
1847 }
1848
1849
1850 /**
1851 *
1852 *
1853 * @param mixed $fd File descriptor
1854 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
1855 * If NULL passed, pri internally is set to
1856 * EIO_PRI_DEFAULT.
1857 * @param callable|null $callback
1858 * callback function is called when the request is done.
1859 * It should match the following prototype:
1860 *
1861 *
1862 * data
1863 * is custom data passed to the request.
1864 *
1865 *
1866 * result
1867 * request-specific result value; basically, the value returned by corresponding
1868 * system call.
1869 *
1870 *
1871 * req
1872 * is optional request resource which can be used with functions like eio_get_last_error
1873 *
1874 *
1875 *
1876 * is custom data passed to the request.
1877 *
1878 * request-specific result value; basically, the value returned by corresponding
1879 * system call.
1880 *
1881 * is optional request resource which can be used with functions like eio_get_last_error
1882 * @param mixed $data is custom data passed to the request.
1883 *
1884 * @return resource eio_syncfs returns request resource on success.
1885 * @throws EioException
1886 *
1887 */
1888 function eio_syncfs($fd, int $pri = EIO_PRI_DEFAULT, ?callable $callback = null, $data = null)
1889 {
1890 error_clear_last();
1891 $result = \eio_syncfs($fd, $pri, $callback, $data);
1892 if ($result === false) {
1893 throw EioException::createFromPhpError();
1894 }
1895 return $result;
1896 }
1897
1898
1899 /**
1900 * eio_truncate causes the regular file named by path to be truncated to
1901 * a size of precisely length bytes
1902 *
1903 * @param string $path File path
1904 * @param int $offset Offset from beginning of the file.
1905 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
1906 * If NULL passed, pri internally is set to
1907 * EIO_PRI_DEFAULT.
1908 * @param callable|null $callback
1909 * callback function is called when the request is done.
1910 * It should match the following prototype:
1911 *
1912 *
1913 * data
1914 * is custom data passed to the request.
1915 *
1916 *
1917 * result
1918 * request-specific result value; basically, the value returned by corresponding
1919 * system call.
1920 *
1921 *
1922 * req
1923 * is optional request resource which can be used with functions like eio_get_last_error
1924 *
1925 *
1926 *
1927 * is custom data passed to the request.
1928 *
1929 * request-specific result value; basically, the value returned by corresponding
1930 * system call.
1931 *
1932 * is optional request resource which can be used with functions like eio_get_last_error
1933 * @param mixed $data is custom data passed to the request.
1934 *
1935 * @return resource eio_busy returns request resource on success.
1936 * @throws EioException
1937 *
1938 */
1939 function eio_truncate(string $path, int $offset = 0, int $pri = EIO_PRI_DEFAULT, ?callable $callback = null, $data = null)
1940 {
1941 error_clear_last();
1942 $result = \eio_truncate($path, $offset, $pri, $callback, $data);
1943 if ($result === false) {
1944 throw EioException::createFromPhpError();
1945 }
1946 return $result;
1947 }
1948
1949
1950 /**
1951 * eio_unlink deletes a name from the file system.
1952 *
1953 * @param string $path Path to file
1954 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
1955 * If NULL passed, pri internally is set to
1956 * EIO_PRI_DEFAULT.
1957 * @param callable|null $callback
1958 * callback function is called when the request is done.
1959 * It should match the following prototype:
1960 *
1961 *
1962 * data
1963 * is custom data passed to the request.
1964 *
1965 *
1966 * result
1967 * request-specific result value; basically, the value returned by corresponding
1968 * system call.
1969 *
1970 *
1971 * req
1972 * is optional request resource which can be used with functions like eio_get_last_error
1973 *
1974 *
1975 *
1976 * is custom data passed to the request.
1977 *
1978 * request-specific result value; basically, the value returned by corresponding
1979 * system call.
1980 *
1981 * is optional request resource which can be used with functions like eio_get_last_error
1982 * @param mixed $data is custom data passed to the request.
1983 *
1984 * @return resource eio_unlink returns request resource on success.
1985 * @throws EioException
1986 *
1987 */
1988 function eio_unlink(string $path, int $pri = EIO_PRI_DEFAULT, ?callable $callback = null, $data = null)
1989 {
1990 error_clear_last();
1991 $result = \eio_unlink($path, $pri, $callback, $data);
1992 if ($result === false) {
1993 throw EioException::createFromPhpError();
1994 }
1995 return $result;
1996 }
1997
1998
1999 /**
2000 *
2001 *
2002 * @param string $path Path to the file.
2003 * @param float $atime Access time
2004 * @param float $mtime Modification time
2005 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
2006 * If NULL passed, pri internally is set to
2007 * EIO_PRI_DEFAULT.
2008 * @param callable|null $callback
2009 * callback function is called when the request is done.
2010 * It should match the following prototype:
2011 *
2012 *
2013 * data
2014 * is custom data passed to the request.
2015 *
2016 *
2017 * result
2018 * request-specific result value; basically, the value returned by corresponding
2019 * system call.
2020 *
2021 *
2022 * req
2023 * is optional request resource which can be used with functions like eio_get_last_error
2024 *
2025 *
2026 *
2027 * is custom data passed to the request.
2028 *
2029 * request-specific result value; basically, the value returned by corresponding
2030 * system call.
2031 *
2032 * is optional request resource which can be used with functions like eio_get_last_error
2033 * @param mixed $data is custom data passed to the request.
2034 *
2035 * @return resource eio_utime returns request resource on success.
2036 * @throws EioException
2037 *
2038 */
2039 function eio_utime(string $path, float $atime, float $mtime, int $pri = EIO_PRI_DEFAULT, ?callable $callback = null, $data = null)
2040 {
2041 error_clear_last();
2042 $result = \eio_utime($path, $atime, $mtime, $pri, $callback, $data);
2043 if ($result === false) {
2044 throw EioException::createFromPhpError();
2045 }
2046 return $result;
2047 }
2048
2049
2050 /**
2051 * eio_write writes up to length
2052 * bytes from str at offset
2053 * offset from the beginning of the file.
2054 *
2055 * @param mixed $fd Stream, Socket resource, or numeric file descriptor, e.g. returned by eio_open
2056 * @param string $str Source string
2057 * @param int $length Maximum number of bytes to write.
2058 * @param int $offset Offset from the beginning of file.
2059 * @param int $pri The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL.
2060 * If NULL passed, pri internally is set to
2061 * EIO_PRI_DEFAULT.
2062 * @param callable|null $callback
2063 * callback function is called when the request is done.
2064 * It should match the following prototype:
2065 *
2066 *
2067 * data
2068 * is custom data passed to the request.
2069 *
2070 *
2071 * result
2072 * request-specific result value; basically, the value returned by corresponding
2073 * system call.
2074 *
2075 *
2076 * req
2077 * is optional request resource which can be used with functions like eio_get_last_error
2078 *
2079 *
2080 *
2081 * is custom data passed to the request.
2082 *
2083 * request-specific result value; basically, the value returned by corresponding
2084 * system call.
2085 *
2086 * is optional request resource which can be used with functions like eio_get_last_error
2087 * @param mixed $data is custom data passed to the request.
2088 *
2089 * @return resource eio_write returns request resource on success.
2090 * @throws EioException
2091 *
2092 */
2093 function eio_write($fd, string $str, int $length = 0, int $offset = 0, int $pri = EIO_PRI_DEFAULT, ?callable $callback = null, $data = null)
2094 {
2095 error_clear_last();
2096 $result = \eio_write($fd, $str, $length, $offset, $pri, $callback, $data);
2097 if ($result === false) {
2098 throw EioException::createFromPhpError();
2099 }
2100 return $result;
2101 }
2102