public function truncate($offset = 0, $cb = null, $pri = EIO_PRI_DEFAULT)
{
$cb = CallbackWrapper::forceWrap($cb);
if (!$this->fd || $this->fd === -1) {
if ($cb) {
$cb($this, false);
}
return false;
}
if (!FileSystem::$supported) {
$fp = fopen($this->path, 'r+');
$r = $fp && ftruncate($fp, $offset);
if ($cb) {
$cb($this, $r);
}
return $r;
}
return eio_ftruncate($this->fd, $offset, $pri, $cb, $this);
}