Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:90995 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 36050 invoked from network); 28 Jan 2016 14:48:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Jan 2016 14:48:54 -0000 Authentication-Results: pb1.pair.com smtp.mail=anatol.php@belski.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=anatol.php@belski.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain belski.net from 85.214.73.107 cause and error) X-PHP-List-Original-Sender: anatol.php@belski.net X-Host-Fingerprint: 85.214.73.107 klapt.com Received: from [85.214.73.107] ([85.214.73.107:56650] helo=h1123647.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 38/75-19998-35A2AA65 for ; Thu, 28 Jan 2016 09:48:52 -0500 Received: by h1123647.serverkompetenz.net (Postfix, from userid 1006) id 2CC587830ED; Thu, 28 Jan 2016 15:48:49 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on h1123647.serverkompetenz.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.5 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from w530phpdev (pD9FE8E05.dip0.t-ipconnect.de [217.254.142.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by h1123647.serverkompetenz.net (Postfix) with ESMTPSA id 12659783094; Thu, 28 Jan 2016 15:48:47 +0100 (CET) To: Cc: "'Pierre Joye'" , "'Dmitry Stogov'" , "'Xinchen Hui'" , "'Nikita Popov'" Date: Thu, 28 Jan 2016 15:48:42 +0100 Message-ID: <03ca01d159da$fe2d76b0$fa886410$@belski.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 16.0 Thread-Index: AdFZ12y7QFDTZgpOSVa5W4LeeaSTKQ== Content-Language: en-us Subject: Streams and I/O refactoring approach From: anatol.php@belski.net ("Anatol Belski") Hi, I'm writing to ask for a review on the following: https://gist.github.com/weltling/29779b61db26c62b5ab0 It is quite far from being even near to be ready. It is an approach for the streams refactoring. After some time playing around, I think that the ideas I was initially approaching are to the big part not applicable to our code base in its current state. For one, "isolate the actual concrete low level implementations by platforms" - it's probably the goal 1. that has to be done before anything else. However creating an isolated layer of structs for every platform (libuv alike) most likely is not doable at the current stage, if at all (and whether makes sense). So in this patch, I've started to create an I/O layer in win32, with the goal to create a framework global to the whole PHP. This serves as the first unavoidable step for the separation by platform. Ideally, we should have all the abstracted low level I/O code for platforms concentrated at one place, while currently all possible code parts of win32 I/O are spread over all the code base - Zend, TSRM, ext/standard, win32. In the current state it is hard to both maintain and to develop these pieces of our codebase. So sounds like a gross refactoring which might last for some longer time. For the Windows part it'll bring a huge functional advantage of using the native win32 APIs which means support for multibyte and long filepath and improved security, later probably overlapped I/O. For the overall codebase it'll mean simpler and better readable code, so more stability and possibility to extend with new modern features more easily. Practically in this patch, with the approach I've described, I've implemented several helpers and routines replacements for Windows that use the native APIs. Particularly PHP's fopen and mkdir there support multibyte filepaths and implementing the long path support is then quite easy. For that to work cross platform, I define macros like php_ioutil_open, php_ioutil_mkdir, etc. for the low level POSIX surrogates. There, I used several parts from libuv to not to do everything from scratch. Also I've started to pull the win32 related code out from zend_virtual_cwd.c, but that's just a start. The plus of such approach is also that the work can be done incrementally, moving the functions one by one, as the unported code will stay compatible with function signatures and functionality. Please let me know what you think about this approach as it's a very early stage which would be good to take the corrections. Thanks Anatol