rfc:fsync_function

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
Next revisionBoth sides next revision
rfc:fsync_function [2021/01/30 16:01] – update to under discussion, emailed internals dwgeblerrfc:fsync_function [2021/02/02 16:56] – updated example code in accordance with implementation tests dwgebler
Line 11: Line 11:
 ===== Proposal ===== ===== Proposal =====
 This RFC would add an fsync() function accepting a single parameter of a stream resource. The implementation of this function would be a thin wrapper around the standard C fsync (or equivalent _commit on Windows API, which uses an identical signature). This RFC would add an fsync() function accepting a single parameter of a stream resource. The implementation of this function would be a thin wrapper around the standard C fsync (or equivalent _commit on Windows API, which uses an identical signature).
 +
 +The related function fdatasync() which syncs data but not necessarily metadata would also be added, however this is not supported on Windows and the proposal there is to still provide fdatasync() but merely as an alias of fsync(). On POSIX, fdatasync() is properly implemented.
  
 <code php> <code php>
Line 18: Line 20:
  
 bool(true) bool(true)
 +
 +$fp = fopen('php://memory','w+');
 +fwrite($fp,"Test line 1\nLine 2\n");
 +var_dump(fsync($fp));
 +
 +Warning: fsync(): Can't fsync this stream in php shell code on line 1
 +bool(false)
 +
 +$fp = fopen('php://stdin', 'w');
 +var_dump(fsync($fp));
 +bool(false)
 </code> </code>
  
rfc/fsync_function.txt · Last modified: 2021/04/13 14:10 by nikic