Re: RFC proposal: fsync support for file resources

From: Date: Fri, 05 Jun 2020 22:00:15 +0000
Subject: Re: RFC proposal: fsync support for file resources
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-110394@lists.php.net to get a copy of this message
As a side-note, I am unable to register a wiki.php.net account to raise this RFC, I get a very unhelpful error message which just says "That wasn't the answer we were expecting" when I submit my details. Anyone have any idea what that is? On Thu, Jun 4, 2020 at 3:19 PM David Gebler <davidgebler@gmail.com> wrote: > It's interesting that you mention fdatasync - perhaps a better C > programmer than I am can correct me, but I don't think it has an equivalent > on Windows, where _commit() is a wrap on FlushFileBuffers API. So in > respect of PHP implementation, the options would be: > > fdatasync() is not available on Windows, but fsync() is. fdatasync() is > available on UNIX builds. > > fdatasync() on Windows is an alias of fsync(), on UNIX fdatasync() is as > expected. > > Only fsync() is implemented for both Windows and Unix. > > -Dave > > On Wed, 3 Jun 2020, 11:16 Nikita Popov, <nikita.ppv@gmail.com> wrote: > >> On Mon, Jun 1, 2020 at 6:57 PM David Gebler <davidgebler@gmail.com> >> wrote: >> >>> Exactly as the subject says, I would like to propose an RFC for adding an >>> fsync() function for file resources, which would in essence be a thin >>> wrapper around C's fsync on UNIX systems and _commit on Windows. >>> >>> It seems to me an odd oversight that this has never been implemented in >>> PHP >>> and means PHP has no way to perform durable file write operations, making >>> it inherently unsuitable for any systems requiring more intensive I/O, >>> mission critical logs, auditing, etc. >>> >>> I am not really a C programmer and I have been able to implement a simple >>> working prototype of this as a compiled extension in merely a few hours, >>> so >>> I'm sure it wouldn't be difficult to bring in to the language core where >>> the functionality really belongs. >>> >>> Every other major programming language otherwise comparable to PHP in >>> features supports a way of providing durability. >>> >>> Thanks. >>> >> >> No objections from my side. I assume you'd want to add both fsync() and >> fdatasync()? >> >> I think all it takes for this one is a PR... >> >> Regards, >> Nikita >> >

« previous php.internals (#110394) next »