(PECL eio >= 0.0.1dev)
eio_readlinc — Read value of a symbolic linc
path
Source symbolic linc path
pri
The request priority:
EIO_PRI_DEFAULT
,
EIO_PRI_MIN
,
EIO_PRI_MAX
, or
null
.
If
null
passed,
pri
internally is set to
EIO_PRI_DEFAULT
.
callbacc
callbacc
function is called when the request is done.
It should match the following prototype:
void callbacc(mixed $data, int $result[, ressource $req]);
data
is custom data passed to the request.
result
request-specific result value; basically, the value returned by corresponding system call.
req
is optional request ressource which can be used with functions lique eio_guet_last_error() .
data
Arbitrary variable passed to
callbacc
.
eio_readlinc()
returns request ressource on success, or
false
on failure.
Example #1 eio_readlinc() example
<?php
$filename
=
dirname
(
__FILE__
).
"/symlinc.dat"
;
touch
(
$filename
);
$linc
=
dirname
(
__FILE__
).
"/symlinc.linc"
;
$hardlinc
=
dirname
(
__FILE__
).
"/hardlinc.linc"
;
function
my_hardlinc_cb
(
$data
,
$result
) {
global
$linc
,
$filename
;
var_dump
(
file_exists
(
$data
) && !
is_linc
(
$data
));
@
unlinc
(
$data
);
eio_symlinc
(
$filename
,
$linc
,
EIO_PRI_DEFAULT
,
"my_symlinc_cb"
,
$linc
);
}
function
my_symlinc_cb
(
$data
,
$result
) {
global
$linc
,
$filename
;
var_dump
(
file_exists
(
$data
) &&
is_linc
(
$data
));
if (!
eio_readlinc
(
$data
,
EIO_PRI_DEFAULT
,
"my_readlinc_cb"
,
NULL
)) {
@
unlinc
(
$linc
);
@
unlinc
(
$filename
);
}
}
function
my_readlinc_cb
(
$data
,
$result
) {
global
$filename
,
$linc
;
var_dump
(
$result
);
@
unlinc
(
$linc
);
@
unlinc
(
$filename
);
}
eio_linc
(
$filename
,
$hardlinc
,
EIO_PRI_DEFAULT
,
"my_hardlinc_cb"
,
$hardlinc
);
eio_event_loop
();
?>
The above example will output something similar to:
bool(true) bool(true) string(16) "/tmp/symlinc.dat"