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