@@ 134-152 (lines=19) @@ | ||
131 | * @param integer $pri Priority |
|
132 | * @return resource|boolean |
|
133 | */ |
|
134 | public function truncate($offset = 0, $cb = null, $pri = EIO_PRI_DEFAULT) |
|
135 | { |
|
136 | $cb = CallbackWrapper::forceWrap($cb); |
|
137 | if (!$this->fd || $this->fd === -1) { |
|
138 | if ($cb) { |
|
139 | $cb($this, false); |
|
140 | } |
|
141 | return false; |
|
142 | } |
|
143 | if (!FileSystem::$supported) { |
|
144 | $fp = fopen($this->path, 'r+'); |
|
145 | $r = $fp && ftruncate($fp, $offset); |
|
146 | if ($cb) { |
|
147 | $cb($this, $r); |
|
148 | } |
|
149 | return $r; |
|
150 | } |
|
151 | return eio_ftruncate($this->fd, $offset, $pri, $cb, $this); |
|
152 | } |
|
153 | ||
154 | /** |
|
155 | * Stat() |
|
@@ 350-370 (lines=21) @@ | ||
347 | * @param integer $pri = EIO_PRI_DEFAULT Priority |
|
348 | * @return resource|false |
|
349 | */ |
|
350 | public function chown($uid, $gid = -1, $cb = null, $pri = EIO_PRI_DEFAULT) |
|
351 | { |
|
352 | $cb = CallbackWrapper::forceWrap($cb); |
|
353 | if (!$this->fd) { |
|
354 | if ($cb) { |
|
355 | $cb($this, false); |
|
356 | } |
|
357 | return false; |
|
358 | } |
|
359 | if (!FileSystem::$supported) { |
|
360 | $r = chown($this->path, $uid); |
|
361 | if ($gid !== -1) { |
|
362 | $r = $r && chgrp($this->path, $gid); |
|
363 | } |
|
364 | if ($cb) { |
|
365 | $cb($this, $r); |
|
366 | } |
|
367 | return false; |
|
368 | } |
|
369 | return eio_fchown($this->fd, $uid, $gid, $pri, $cb, $this); |
|
370 | } |
|
371 | ||
372 | /** |
|
373 | * touch() |