rfc:streammetadata

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
rfc:streammetadata [2011/03/14 03:53] stasrfc:streammetadata [2017/09/22 13:28] (current) – external edit 127.0.0.1
Line 1: Line 1:
-====== Request for Comments: How to write RFCs ======+====== Request for Comments: Stream Metadata ======
   * Version: 1.0   * Version: 1.0
   * Date: 2011-03-13   * Date: 2011-03-13
   * Author: Stas Malyshev <stas@php.net>   * Author: Stas Malyshev <stas@php.net>
-  * Status: Draft+  * Status: Implemented in 5.4
   * First Published at: http://wiki.php.net/rfc/streammetadata   * First Published at: http://wiki.php.net/rfc/streammetadata
 +  * Patch: http://random-bits-of.info/stream_meta.diff
  
 ====== Purpose ====== ====== Purpose ======
Line 33: Line 34:
   * For PHP_STREAM_META_OWNER_NAME, PHP_STREAM_META_OWNER_NAME - char *   * For PHP_STREAM_META_OWNER_NAME, PHP_STREAM_META_OWNER_NAME - char *
   * For all the rest - long *   * For all the rest - long *
 +
 +The return value is 0 on failure, non-0 on success. 
  
 ====== Userspace part ====== ====== Userspace part ======
Line 47: Line 50:
   * For all the rest - integer   * For all the rest - integer
  
 +The return value is true on success, false on failure. The stream implementor has to decide what to do with unknown/unsupported options.
 ====== Examples ====== ====== Examples ======
 +
 +Virtual stream usage (mostly as before):
 +<code php>
 +<?php
 +require_once 'vstream.php';
 +VirtualStream::register("vfstest");
 +mkdir("vfstest://startdir");
 +unlink("vfstest://startdir/test123");
 +var_dump(stat("vfstest://startdir/test123"));
 +touch("vfstest://startdir/test123");
 +var_dump(stat("vfstest://startdir/test123"));
 +file_put_contents("vfstest://startdir/test123", "test test\ntest 2\n");
 +chmod("vfstest://startdir/test123", 0755);
 +var_dump(stat("vfstest://startdir/test123"));
 +$f = fopen("vfstest://startdir/test123", "r");
 +while($l = fgets($f)) {
 + echo "== $l";
 +}
 +fclose($f);
 +$d = opendir("vfstest://startdir/");
 +while($de = readdir($d)) {
 + var_dump($de);
 +}
 +closedir($d);
 +</code>
  
 Virtual stream definition: Virtual stream definition:
Line 232: Line 261:
 } }
 </code> </code>
 +
 +====== TODO ======
 +ch{own|mod}() functions are not defined on Netware and defined, but not implemented on Windows. While this API does not limit its implementation to any particular set of features, currently it follows the existing API implementation, not improving on it. We could add additional capabilities allowing to support these operations on these systems in one way or another. 
  
rfc/streammetadata.1300074832.txt.gz · Last modified: 2017/09/22 13:28 (external edit)