| @@ 130-147 (lines=18) @@ | ||
| 127 | * @param integer $pri Priority |
|
| 128 | * @return resource|boolean |
|
| 129 | */ |
|
| 130 | public function truncate($offset = 0, $cb = null, $pri = EIO_PRI_DEFAULT) { |
|
| 131 | $cb = CallbackWrapper::forceWrap($cb); |
|
| 132 | if (!$this->fd || $this->fd === -1) { |
|
| 133 | if ($cb) { |
|
| 134 | $cb($this, false); |
|
| 135 | } |
|
| 136 | return false; |
|
| 137 | } |
|
| 138 | if (!FileSystem::$supported) { |
|
| 139 | $fp = fopen($this->path, 'r+'); |
|
| 140 | $r = $fp && ftruncate($fp, $offset); |
|
| 141 | if ($cb) { |
|
| 142 | $cb($this, $r); |
|
| 143 | } |
|
| 144 | return $r; |
|
| 145 | } |
|
| 146 | return eio_ftruncate($this->fd, $offset, $pri, $cb, $this); |
|
| 147 | } |
|
| 148 | ||
| 149 | /** |
|
| 150 | * Stat() |
|
| @@ 331-350 (lines=20) @@ | ||
| 328 | * @param integer $pri Priority |
|
| 329 | * @return resource|false |
|
| 330 | */ |
|
| 331 | public function chown($uid, $gid = -1, $cb, $pri = EIO_PRI_DEFAULT) { |
|
| 332 | $cb = CallbackWrapper::forceWrap($cb); |
|
| 333 | if (!$this->fd) { |
|
| 334 | if ($cb) { |
|
| 335 | $cb($this, false); |
|
| 336 | } |
|
| 337 | return false; |
|
| 338 | } |
|
| 339 | if (!FileSystem::$supported) { |
|
| 340 | $r = chown($this->path, $uid); |
|
| 341 | if ($gid !== -1) { |
|
| 342 | $r = $r && chgrp($this->path, $gid); |
|
| 343 | } |
|
| 344 | if ($cb) { |
|
| 345 | $cb($this, $r); |
|
| 346 | } |
|
| 347 | return false; |
|
| 348 | } |
|
| 349 | return eio_fchown($this->fd, $uid, $gid, $pri, $cb, $this); |
|
| 350 | } |
|
| 351 | ||
| 352 | /** |
|
| 353 | * touch() |
|