Re: [PHP-DEV] [RFC] Improved Linux process title support in the CLI SAPI
Hi, could you rename these functions to: cli_process_set_title cli_process_get_title http://www.php.net/manual-lookup.php?pattern=set_scope=quickref gives me a lot of hits like: xml_parser_set_options stream_set_read_buffer pg_set_info ps_set_border_color etc. its also a lot more readable as it is: object_action_subject. Am 2013-02-07 20:59, schrieb Keyur Govande: Addressing a bunch of comments at once: 1) I've removed is_available and renamed the set/get methods to: cli_process_title_set/get. I've also removed the test dependencies on pcntl and posix. The patch is updated: https://gist.github.com/keyurdg/4728770 2) Updated the RFC's introduction section with more concrete details about why this is necessary In terms of doing this as an extension: the RFC addresses why this isn't possible. For folks who will not be using this feature, at worst they'll loose a few KB of memory: the amount needed to store the original argv and the original environ. On Thu, Feb 7, 2013 at 1:25 PM, Nikita Popov nikita@gmail.com mailto:nikita@gmail.com wrote: On Thu, Feb 7, 2013 at 2:39 PM, Christoph Rosse cro...@2bepublished.at mailto:cro...@2bepublished.atwrote: why wouldn't this go into core? setting the name of the current php-process is definitely something everyone that develops php-cli scripts could use. I use a lot of php-cli scripts and I've never seen the need. Without having hard data to back this up, I am pretty sure that this applies to nearly all php-cli scripts. We should not base the decision of putting something into the core on assumptions on how many people are going to use the feature. Obviously we should. Whether people will use it is pretty much the most important aspect for deciding whether or not something should be added. Even a trivial addition is a loose for the project if nobody is going to use it. And this is no trivial addition. This seems to be quite a bit system dependent and uses some odd methods like overwriting argv memory. And on that note, it also has to copy the argv data if I got that right, which is something it has to do always and not just when people are actually using the feature ;) I'm not saying I'm against this feature. I'd just really appreciate it if we could drop the good old it doesn't matter if people are going to use it non-arguments and instead provide a bit more info for people like me, who are not in the process-title-hacking business. I.e. what this is needed for an why this is needed in core. E.g. what Arvid mentioned, that this is useful when you are running many PHP-based daemons and want to distinguish them. That's the kind of stuff I'd like to see in the RFC. Regarding core/non-core. People mentioned that this is not implementable as an extension. That can be either solved by putting it into core or by adding the necessary API hook ;) [I'm not arguing which variant is better, just saying that not being implementable with current core does not mean that we can't make it implementable :)] Thanks, Nikita -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [RFC] Improved Linux process title support in the CLI SAPI
On Fri, Feb 8, 2013 at 7:56 AM, Rasmus Lerdorf ras...@lerdorf.com wrote: On 02/07/2013 10:25 AM, Nikita Popov wrote: On Thu, Feb 7, 2013 at 2:39 PM, Christoph Rosse cro...@2bepublished.at wrote: why wouldn't this go into core? setting the name of the current php-process is definitely something everyone that develops php-cli scripts could use. I use a lot of php-cli scripts and I've never seen the need. Without having hard data to back this up, I am pretty sure that this applies to nearly all php-cli scripts. I think you may have glossed over the part where Keyur explained that when running tons of Gearman workers under GearmanManager it makes things a lot easier if we had a working way to set the proctitle. As he explained, the pecl/proctitle way of doing it isn't sufficient because it is likely to corrupt memory if you try to set the process title to anything longer than 3 characters. The only way to fix that memory corruption is to hook in earlier and that isn't something we can do from an extension. I didn't gloss over it, it just wasn't there at the time :) But yeah, that use case makes a lot of sense to me, so +1 on this. Nikita
Re: [PHP-DEV] [RFC] Improved Linux process title support in the CLI SAPI
On Fri, Feb 8, 2013 at 3:20 AM, Christoph Rosse cro...@2bepublished.atwrote: Hi, could you rename these functions to: cli_process_set_title cli_process_get_title http://www.php.net/manual-**lookup.php?pattern=set_scope=**quickrefhttp://www.php.net/manual-lookup.php?pattern=set_scope=quickref gives me a lot of hits like: xml_parser_set_options stream_set_read_buffer pg_set_info ps_set_border_color etc. its also a lot more readable as it is: object_action_subject. Done. In keeping with object_action_subject as suggested by Christoph, I renamed the methods: cli_(get/set)_process_title. Patch updated: https://gist.github.com/keyurdg/4728770 Since there's consensus around this, I'm moving this RFC to voting state.
Re: [PHP-DEV] [RFC] Improved Linux process title support in the CLI SAPI
On Fri, Feb 8, 2013 at 4:01 PM, Ferenc Kovacs tyr...@gmail.com wrote: On Fri, Feb 8, 2013 at 9:30 PM, Keyur Govande keyurgova...@gmail.comwrote: On Fri, Feb 8, 2013 at 3:20 AM, Christoph Rosse cro...@2bepublished.at wrote: Hi, could you rename these functions to: cli_process_set_title cli_process_get_title http://www.php.net/manual-**lookup.php?pattern=set_scope=**quickref http://www.php.net/manual-lookup.php?pattern=set_scope=quickref gives me a lot of hits like: xml_parser_set_options stream_set_read_buffer pg_set_info ps_set_border_color etc. its also a lot more readable as it is: object_action_subject. Done. In keeping with object_action_subject as suggested by Christoph, I renamed the methods: cli_(get/set)_process_title. Patch updated: https://gist.github.com/keyurdg/4728770 Since there's consensus around this, I'm moving this RFC to voting state. I think that one day is a little bit stretching the line of the minimum required discussion period: https://wiki.php.net/rfc/voting#discussion_period Ah my bad :) I'll hold off on sending the [VOTE] email.
Re: [PHP-DEV] [RFC] Improved Linux process title support in the CLI SAPI
On Fri, Feb 8, 2013 at 10:16 PM, Keyur Govande keyurgova...@gmail.comwrote: On Fri, Feb 8, 2013 at 4:01 PM, Ferenc Kovacs tyr...@gmail.com wrote: On Fri, Feb 8, 2013 at 9:30 PM, Keyur Govande keyurgova...@gmail.comwrote: On Fri, Feb 8, 2013 at 3:20 AM, Christoph Rosse cro...@2bepublished.at wrote: Hi, could you rename these functions to: cli_process_set_title cli_process_get_title http://www.php.net/manual-**lookup.php?pattern=set_scope=**quickref http://www.php.net/manual-lookup.php?pattern=set_scope=quickref gives me a lot of hits like: xml_parser_set_options stream_set_read_buffer pg_set_info ps_set_border_color etc. its also a lot more readable as it is: object_action_subject. Done. In keeping with object_action_subject as suggested by Christoph, I renamed the methods: cli_(get/set)_process_title. Patch updated: https://gist.github.com/keyurdg/4728770 Since there's consensus around this, I'm moving this RFC to voting state. I think that one day is a little bit stretching the line of the minimum required discussion period: https://wiki.php.net/rfc/voting#discussion_period Ah my bad :) I'll hold off on sending the [VOTE] email. thanks! -- Ferenc Kovács @Tyr43l - http://tyrael.hu
Re: [PHP-DEV] [RFC] Improved Linux process title support in the CLI SAPI
Hi Keyur, On 07/02/13 06:40, Keyur Govande wrote: Hello, I've created a new RFC to improve support for setting a CLI process' title on Linux. It is based off of the PostgreSQL implementation and is more robust than the proctitle extension. More details and patch here: https://wiki.php.net/rfc/cli_process_title Very nice patch. It could be very useful for me. Could you precise what extensions PHP needs to use these new functions, because in your test [1], you skip when pcntl or posix are not loaded. I am sure that there is no dependency between them and *ps_title*() functions, but it has to be precised in your RFC or you need to write a simpler test. [1] https://gist.github.com/keyurdg/4728770#file-php_ps-patch-L737-L740 -- Ivan Enderlin Developer of Hoa http://hoa-project.net/ PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis) http://disc.univ-fcomte.fr/ and http://www.inria.fr/ Member of HTML and WebApps Working Group of W3C http://w3.org/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [RFC] Improved Linux process title support in the CLI SAPI
Am 2013-02-07 08:45, schrieb Alexey Zakhlestin: On 07.02.2013, at 9:40, Keyur Govande keyurgova...@gmail.com wrote: Hello, I've created a new RFC to improve support for setting a CLI process' title on Linux. It is based off of the PostgreSQL implementation and is more robust than the proctitle extension. More details and patch here: https://wiki.php.net/rfc/cli_process_title This would be useful for some of my tasks! I don't like names of functions, but I like functionality and API approach how about: bool cli_title_settable(void); bool cli_title_set(string); string cli_title_get(); Greate feature and +1 to Alexeys function names. But what is the point in checking if I'm able to set a title with is_cli_ps_title_available() if set_cli_ps_title() can fail and return false anyway? I'm just asking because I don't see the benefit of the function is_cli_ps_title_available for the user. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [RFC] Improved Linux process title support in the CLI SAPI
On 7 February 2013 09:37, Christoph Rosse cro...@2bepublished.at wrote: Am 2013-02-07 08:45, schrieb Alexey Zakhlestin: On 07.02.2013, at 9:40, Keyur Govande keyurgova...@gmail.com wrote: Hello, I've created a new RFC to improve support for setting a CLI process' title on Linux. It is based off of the PostgreSQL implementation and is more robust than the proctitle extension. More details and patch here: https://wiki.php.net/rfc/cli_process_title This would be useful for some of my tasks! I don't like names of functions, but I like functionality and API approach how about: bool cli_title_settable(void); This function name is ambiguous, does it mean set table or is settable, I guess it means the latter, so it should also be named like that. bool cli_title_set(string); string cli_title_get(); Greate feature and +1 to Alexeys function names. But what is the point in checking if I'm able to set a title with is_cli_ps_title_available() if set_cli_ps_title() can fail and return false anyway? I'm just asking because I don't see the benefit of the function is_cli_ps_title_available for the user. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- Regards, Mike -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [RFC] Improved Linux process title support in the CLI SAPI
There is a PECL extension that already does something similar. You may want to take a look at that. http://pecl.php.net/package/proctitle On 7 February 2013 05:40, Keyur Govande keyurgova...@gmail.com wrote: Hello, I've created a new RFC to improve support for setting a CLI process' title on Linux. It is based off of the PostgreSQL implementation and is more robust than the proctitle extension. More details and patch here: https://wiki.php.net/rfc/cli_process_title Thanks, Keyur.
Re: [PHP-DEV] [RFC] Improved Linux process title support in the CLI SAPI
On 07.02.2013, at 13:54, Leigh lei...@gmail.com wrote: There is a PECL extension that already does something similar. You may want to take a look at that. http://pecl.php.net/package/proctitle Did you read RFC? Keyur mentions it and its limitations there -- Alexey Zakhlestin https://github.com/indeyets -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [RFC] Improved Linux process title support in the CLI SAPI
On 7 February 2013 12:22, Alexey Zakhlestin indey...@gmail.com wrote: On 07.02.2013, at 13:54, Leigh lei...@gmail.com wrote: There is a PECL extension that already does something similar. You may want to take a look at that. http://pecl.php.net/package/proctitle Did you read RFC? Keyur mentions it and its limitations there I only skimmed it very quickly if I'm honest. Why does this need to be in core? This could just be done as a set of improvements to the existing PECL extension instead. I'd guess that the number of people who require (and would use) this functionality is very very small indeed.
Re: [PHP-DEV] [RFC] Improved Linux process title support in the CLI SAPI
On 7 February 2013 13:33, Leigh lei...@gmail.com wrote: On 7 February 2013 12:22, Alexey Zakhlestin indey...@gmail.com wrote: On 07.02.2013, at 13:54, Leigh lei...@gmail.com wrote: There is a PECL extension that already does something similar. You may want to take a look at that. http://pecl.php.net/package/proctitle Did you read RFC? Keyur mentions it and its limitations there I only skimmed it very quickly if I'm honest. Why does this need to be in core? This could just be done as a set of improvements to the existing PECL extension instead. I'd guess that the number of people who require (and would use) this functionality is very very small indeed. Then read it again, not so quick. -- Regards, Mike -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [RFC] Improved Linux process title support in the CLI SAPI
On 07.02.2013, at 16:33, Leigh lei...@gmail.com wrote: Why does this need to be in core? This could just be done as a set of improvements to the existing PECL extension instead. I'd guess that the number of people who require (and would use) this functionality is very very small indeed. well, 2 reasons: 1. it needs to be injected into main() of php_cli.c 2. it can become a good start for official CLI extension. CLI SAPI has functionality, which is specific to it and exposing it to userland could be useful -- Alexey Zakhlestin https://github.com/indeyets -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [RFC] Improved Linux process title support in the CLI SAPI
Am 2013-02-07 13:33, schrieb Leigh: On 7 February 2013 12:22, Alexey Zakhlestin indey...@gmail.com wrote: On 07.02.2013, at 13:54, Leigh lei...@gmail.com wrote: There is a PECL extension that already does something similar. You may want to take a look at that. http://pecl.php.net/package/proctitle Did you read RFC? Keyur mentions it and its limitations there I only skimmed it very quickly if I'm honest. Why does this need to be in core? This could just be done as a set of improvements to the existing PECL extension instead. I'd guess that the number of people who require (and would use) this functionality is very very small indeed. why wouldn't this go into core? setting the name of the current php-process is definitely something everyone that develops php-cli scripts could use. We should not base the decision of putting something into the core on assumptions on how many people are going to use the feature. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [RFC] Improved Linux process title support in the CLI SAPI
Am 2013-02-07 14:00, schrieb Alexey Zakhlestin: On 07.02.2013, at 16:33, Leigh lei...@gmail.com wrote: Why does this need to be in core? This could just be done as a set of improvements to the existing PECL extension instead. I'd guess that the number of people who require (and would use) this functionality is very very small indeed. well, 2 reasons: 1. it needs to be injected into main() of php_cli.c 2. it can become a good start for official CLI extension. CLI SAPI has functionality, which is specific to it and exposing it to userland could be useful 1. I'm not an expert on the php source code, so I can't say if this is a problem or not, if it really is could you explain to me why? 2. Creating an official CLI extension sounds really awesome to me but unless there is somebody willing to develop/maintain it I would rather want to have this function going into core instead of patching an old pecl-extension. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [RFC] Improved Linux process title support in the CLI SAPI
Hello internals. I'm actually using proctitle extension and it's very handy because we run like 10+ daemons written in PHP that we manage. Without it we would be lost :) But the actual awareness of the proctitle PECL extension is very low. Also it does not work on windows. I'm all over the idea to add it to the core and that will be better than current proctitle extension. Also I don't see a major effort required to keep this thing up to date. OS'es don't just change how process titles are set overnight, I would imagine that being huge thing to do without a very early notice. The RFC is superior to proctitle in every way, so i'd say go for it. Although small on the outside, it's actually a huge thing and will allow to actually start building some serious stuff without using some half-baked non-maintained extensions. My 0.02$. Arvids.
Re: [PHP-DEV] [RFC] Improved Linux process title support in the CLI SAPI
Am 2013-02-07 14:57, schrieb Christoph Rosse: Am 2013-02-07 14:00, schrieb Alexey Zakhlestin: On 07.02.2013, at 16:33, Leigh lei...@gmail.com wrote: Why does this need to be in core? This could just be done as a set of improvements to the existing PECL extension instead. I'd guess that the number of people who require (and would use) this functionality is very very small indeed. well, 2 reasons: 1. it needs to be injected into main() of php_cli.c 2. it can become a good start for official CLI extension. CLI SAPI has functionality, which is specific to it and exposing it to userland could be useful 1. I'm not an expert on the php source code, so I can't say if this is a problem or not, if it really is could you explain to me why? 2. Creating an official CLI extension sounds really awesome to me but unless there is somebody willing to develop/maintain it I would rather want to have this function going into core instead of patching an old pecl-extension. Forget my email above got a bit mixed up with the thread. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [RFC] Improved Linux process title support in the CLI SAPI
On Thu, Feb 7, 2013 at 2:39 PM, Christoph Rosse cro...@2bepublished.atwrote: why wouldn't this go into core? setting the name of the current php-process is definitely something everyone that develops php-cli scripts could use. I use a lot of php-cli scripts and I've never seen the need. Without having hard data to back this up, I am pretty sure that this applies to nearly all php-cli scripts. We should not base the decision of putting something into the core on assumptions on how many people are going to use the feature. Obviously we should. Whether people will use it is pretty much the most important aspect for deciding whether or not something should be added. Even a trivial addition is a loose for the project if nobody is going to use it. And this is no trivial addition. This seems to be quite a bit system dependent and uses some odd methods like overwriting argv memory. And on that note, it also has to copy the argv data if I got that right, which is something it has to do always and not just when people are actually using the feature ;) I'm not saying I'm against this feature. I'd just really appreciate it if we could drop the good old it doesn't matter if people are going to use it non-arguments and instead provide a bit more info for people like me, who are not in the process-title-hacking business. I.e. what this is needed for an why this is needed in core. E.g. what Arvid mentioned, that this is useful when you are running many PHP-based daemons and want to distinguish them. That's the kind of stuff I'd like to see in the RFC. Regarding core/non-core. People mentioned that this is not implementable as an extension. That can be either solved by putting it into core or by adding the necessary API hook ;) [I'm not arguing which variant is better, just saying that not being implementable with current core does not mean that we can't make it implementable :)] Thanks, Nikita
Re: [PHP-DEV] [RFC] Improved Linux process title support in the CLI SAPI
Addressing a bunch of comments at once: 1) I've removed is_available and renamed the set/get methods to: cli_process_title_set/get. I've also removed the test dependencies on pcntl and posix. The patch is updated: https://gist.github.com/keyurdg/4728770 2) Updated the RFC's introduction section with more concrete details about why this is necessary In terms of doing this as an extension: the RFC addresses why this isn't possible. For folks who will not be using this feature, at worst they'll loose a few KB of memory: the amount needed to store the original argv and the original environ. On Thu, Feb 7, 2013 at 1:25 PM, Nikita Popov nikita@gmail.com wrote: On Thu, Feb 7, 2013 at 2:39 PM, Christoph Rosse cro...@2bepublished.at wrote: why wouldn't this go into core? setting the name of the current php-process is definitely something everyone that develops php-cli scripts could use. I use a lot of php-cli scripts and I've never seen the need. Without having hard data to back this up, I am pretty sure that this applies to nearly all php-cli scripts. We should not base the decision of putting something into the core on assumptions on how many people are going to use the feature. Obviously we should. Whether people will use it is pretty much the most important aspect for deciding whether or not something should be added. Even a trivial addition is a loose for the project if nobody is going to use it. And this is no trivial addition. This seems to be quite a bit system dependent and uses some odd methods like overwriting argv memory. And on that note, it also has to copy the argv data if I got that right, which is something it has to do always and not just when people are actually using the feature ;) I'm not saying I'm against this feature. I'd just really appreciate it if we could drop the good old it doesn't matter if people are going to use it non-arguments and instead provide a bit more info for people like me, who are not in the process-title-hacking business. I.e. what this is needed for an why this is needed in core. E.g. what Arvid mentioned, that this is useful when you are running many PHP-based daemons and want to distinguish them. That's the kind of stuff I'd like to see in the RFC. Regarding core/non-core. People mentioned that this is not implementable as an extension. That can be either solved by putting it into core or by adding the necessary API hook ;) [I'm not arguing which variant is better, just saying that not being implementable with current core does not mean that we can't make it implementable :)] Thanks, Nikita
Re: [PHP-DEV] [RFC] Improved Linux process title support in the CLI SAPI
On 02/07/2013 10:25 AM, Nikita Popov wrote: On Thu, Feb 7, 2013 at 2:39 PM, Christoph Rosse cro...@2bepublished.atwrote: why wouldn't this go into core? setting the name of the current php-process is definitely something everyone that develops php-cli scripts could use. I use a lot of php-cli scripts and I've never seen the need. Without having hard data to back this up, I am pretty sure that this applies to nearly all php-cli scripts. I think you may have glossed over the part where Keyur explained that when running tons of Gearman workers under GearmanManager it makes things a lot easier if we had a working way to set the proctitle. As he explained, the pecl/proctitle way of doing it isn't sufficient because it is likely to corrupt memory if you try to set the process title to anything longer than 3 characters. The only way to fix that memory corruption is to hook in earlier and that isn't something we can do from an extension. Note that other SAPIs have the same need. The FPM SAPI does something similar and for similar reasons. Whenever you are running any sort of process manager, it is super useful to be able to tell what each individual process is doing at a particular time. -Rasmus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] [RFC] Improved Linux process title support in the CLI SAPI
Hello, I've created a new RFC to improve support for setting a CLI process' title on Linux. It is based off of the PostgreSQL implementation and is more robust than the proctitle extension. More details and patch here: https://wiki.php.net/rfc/cli_process_title Thanks, Keyur.
Re: [PHP-DEV] [RFC] Improved Linux process title support in the CLI SAPI
On 07.02.2013, at 9:40, Keyur Govande keyurgova...@gmail.com wrote: Hello, I've created a new RFC to improve support for setting a CLI process' title on Linux. It is based off of the PostgreSQL implementation and is more robust than the proctitle extension. More details and patch here: https://wiki.php.net/rfc/cli_process_title This would be useful for some of my tasks! I don't like names of functions, but I like functionality and API approach how about: bool cli_title_settable(void); bool cli_title_set(string); string cli_title_get(); -- Alexey Zakhlestin https://github.com/indeyets -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [RFC] Improved Linux process title support in the CLI SAPI
On Thu, Feb 7, 2013 at 6:40 AM, Keyur Govande keyurgova...@gmail.comwrote: Hello, I've created a new RFC to improve support for setting a CLI process' title on Linux. It is based off of the PostgreSQL implementation and is more robust than the proctitle extension. More details and patch here: https://wiki.php.net/rfc/cli_process_title Thanks, Keyur. Could you maybe also explain in the RFC why support for this is needed in the first place (and why it is needed in core)? Thanks, Nikita