Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:15843 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16432 invoked by uid 1010); 6 Apr 2005 06:52:25 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 16268 invoked by uid 1007); 6 Apr 2005 06:52:18 -0000 Message-ID: <20050406065218.16267.qmail@lists.php.net> To: internals@lists.php.net Date: Wed, 06 Apr 2005 09:52:13 +0300 Organization: cmax.gg User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 62.248.140.79 Subject: [PATCH] Bug #26610 sem_get and sem_acquire From: horo@mbnet.fi (Pauli) Is this patch possible to get in php 5.x? What should I improve so my patch would get reviewed? I would need it in php 5.0 my self. It would come to comercial webserver so there is required _stable_ build which won't self build and patched version. Specialy because this was first time I ever looked php source code. (Happily using it about 5 years now) Should I make some changes to documentation also? I didn't got time to check it out yet how to change documentation. I checked that 5.0 and 5.1 branches got same source for this file so this patch could be applied for both of them. There was some minor changes from 4.3 branch. I tested this with 5.0 cvs branch (checkout today). It worked well after I got sem_acquire parameter parsing converted to new functions. I got little confused with that I must read everything to zval and then convert it to what I want. This patch is adds IPC_CREAT, IPC_EXCL and IPC_NOWAIT functionality to sem_get and sem_acquire. The code changes add some constants and handles those constants as parameters. There is possible issue that sem_get could get unwanted parameters because values aren't checked before they are passed to 'real' sem_get but that was functionality of old implementation so I didn't want to change it. Here is also changed sem_acquire to use new parameter parsing function. I included 2 php test cases that I demo straits functionality of new implemantion. test.php is not mean to output anything special. test_nowait.php. Shows what happens if semaphore is tried to access same time by 2 scripts. Execute test_nowait in 2 shells same time. The first one to terminate should tell you that 2nd acquire was busy. 2nd should tell that 2nd acquire was also successful. http://cmax.gg/~coren/bug26610.patch http://cmax.gg/~coren/test.phps http://cmax.gg/~coren/test_nowait.phps That's it. Thanks for comments and help how to improve this patch. Also big thanks for reading to end. ;)