rfc:fsync_function
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:fsync_function [2021/01/30 16:01] – update to under discussion, emailed internals dwgebler | rfc:fsync_function [2021/04/13 14:10] (current) – nikic | ||
---|---|---|---|
Line 2: | Line 2: | ||
* Version: 1.0 | * Version: 1.0 | ||
* Date: 2021-01-30 | * Date: 2021-01-30 | ||
- | * Author: David Gebler, | + | * Author: David Gebler, |
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
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(' | ||
+ | fwrite($fp," | ||
+ | var_dump(fsync($fp)); | ||
+ | |||
+ | Warning: fsync(): Can't fsync this stream in php shell code on line 1 | ||
+ | bool(false) | ||
+ | |||
+ | $fp = fopen(' | ||
+ | var_dump(fsync($fp)); | ||
+ | bool(false) | ||
</ | </ | ||
+ | |||
+ | ======== Sample documentation ======== | ||
+ | |||
+ | |||
+ | fsync() - synchronize changes to a file | ||
+ | |||
+ | fdatasync() - synchronize the data of a file | ||
+ | |||
+ | fsync ( resource $stream ) : bool | ||
+ | |||
+ | Request that all data for the open file pointer $stream is to be transferred to the storage device. The manner of synchronization is OS dependent. The fsync() function shall not return until the system has completed that action or until an error is detected. | ||
+ | |||
+ | Returns true on success or false on failure. | ||
+ | |||
+ | If the resource indicated by $stream is not a file pointer, an E_WARNING is emitted. | ||
+ | |||
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
Line 39: | Line 68: | ||
===== Proposed Voting Choices ===== | ===== Proposed Voting Choices ===== | ||
Accept RFC as proposed. | Accept RFC as proposed. | ||
- | |||
- | ===== Patches and Tests ===== | ||
- | [[https:// | ||
===== Implementation ===== | ===== Implementation ===== | ||
+ | [[https:// | ||
+ | |||
+ | ===== Vote ===== | ||
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
===== References ===== | ===== References ===== | ||
[[https:// | [[https:// |
rfc/fsync_function.1612022518.txt.gz · Last modified: 2021/01/30 16:01 by dwgebler