From 082fdfb20387af02956a68ba77dfa78e2ae9c5b8 Mon Sep 17 00:00:00 2001 From: Bob Weinand Date: Sat, 15 Feb 2020 17:49:53 +0100 Subject: [PATCH] Add uv_process_get_pid() (Closes #71) --- php_uv.c | 19 +++++++++++++++++++ ...e59.phpt => 800-uv_stdio_new-issue59.phpt} | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) rename tests/{800-uv_spawn-issue59.phpt => 800-uv_stdio_new-issue59.phpt} (83%) diff --git a/php_uv.c b/php_uv.c index 25be576..e609844 100644 --- a/php_uv.c +++ b/php_uv.c @@ -3026,6 +3026,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_uv_process_kill, 0, 0, 2) ZEND_ARG_INFO(0, signal) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(arginfo_uv_process_get_pid, 0, 0, 1) + ZEND_ARG_INFO(0, process) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(arginfo_uv_chdir, 0, 0, 1) ZEND_ARG_INFO(0, dir) ZEND_END_ARG_INFO() @@ -5162,6 +5166,20 @@ PHP_FUNCTION(uv_process_kill) } /* }}} */ +/* {{{ proto void uv_process_get_pid(UVProcess $handle) +*/ +PHP_FUNCTION(uv_process_get_pid) +{ + php_uv_t *uv; + + ZEND_PARSE_PARAMETERS_START(1, 1) + UV_PARAM_OBJ(uv, php_uv_t, uv_process_ce) + ZEND_PARSE_PARAMETERS_END(); + + RETURN_LONG(uv_process_get_pid(&uv->uv.process)); +} +/* }}} */ + /* {{{ proto void uv_kill(long $pid, long $signal) */ PHP_FUNCTION(uv_kill) @@ -6216,6 +6234,7 @@ static zend_function_entry uv_functions[] = { /* spawn */ PHP_FE(uv_spawn, arginfo_uv_spawn) PHP_FE(uv_process_kill, arginfo_uv_process_kill) + PHP_FE(uv_process_get_pid, arginfo_uv_process_get_pid) PHP_FE(uv_kill, arginfo_uv_kill) /* c-ares */ PHP_FE(uv_getaddrinfo, arginfo_uv_getaddrinfo) diff --git a/tests/800-uv_spawn-issue59.phpt b/tests/800-uv_stdio_new-issue59.phpt similarity index 83% rename from tests/800-uv_spawn-issue59.phpt rename to tests/800-uv_stdio_new-issue59.phpt index f8f4731..b1cf29f 100644 --- a/tests/800-uv_spawn-issue59.phpt +++ b/tests/800-uv_stdio_new-issue59.phpt @@ -1,5 +1,5 @@ --TEST-- -Test uv_spawn doesn't cause segfault #56 +Test uv_stdio_new doesn't cause segfault #56 --FILE--