summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Reay <stephen.reay@me.com>2019-08-12 00:52:30 +0700
committerNikita Popov <nikita.ppv@gmail.com>2019-08-12 10:05:36 +0200
commit47b95bd83c8f2b492a32cdfa58247c197271d248 (patch)
tree0f1f63e212f07760cb78230c028d82ae232c82be
parent5db330698187af1e6fe1e24e21980f0ca062dd96 (diff)
downloadphp-git-47b95bd83c8f2b492a32cdfa58247c197271d248.tar.gz
Added arginfo stubs for sysvsem
Closes GH-4523.
-rw-r--r--ext/sysvsem/sysvsem.c23
-rw-r--r--ext/sysvsem/sysvsem.stub.php22
-rw-r--r--ext/sysvsem/sysvsem_arginfo.h19
3 files changed, 42 insertions, 22 deletions
diff --git a/ext/sysvsem/sysvsem.c b/ext/sysvsem/sysvsem.c
index 6086d1f066..4945d4ee2f 100644
--- a/ext/sysvsem/sysvsem.c
+++ b/ext/sysvsem/sysvsem.c
@@ -38,6 +38,7 @@
#include <sys/sem.h>
#include <errno.h>
+#include "sysvsem_arginfo.h"
#include "php_sysvsem.h"
#include "ext/standard/info.h"
@@ -55,28 +56,6 @@ union semun {
#endif
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sem_get, 0, 0, 1)
- ZEND_ARG_INFO(0, key)
- ZEND_ARG_INFO(0, max_acquire)
- ZEND_ARG_INFO(0, perm)
- ZEND_ARG_INFO(0, auto_release)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sem_acquire, 0, 0, 1)
- ZEND_ARG_INFO(0, sem_identifier)
- ZEND_ARG_INFO(0, nowait)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sem_release, 0, 0, 1)
- ZEND_ARG_INFO(0, sem_identifier)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_sem_remove, 0, 0, 1)
- ZEND_ARG_INFO(0, sem_identifier)
-ZEND_END_ARG_INFO()
-/* }}} */
-
/* {{{ sysvsem_functions[]
*/
static const zend_function_entry sysvsem_functions[] = {
diff --git a/ext/sysvsem/sysvsem.stub.php b/ext/sysvsem/sysvsem.stub.php
new file mode 100644
index 0000000000..cb64eec3a5
--- /dev/null
+++ b/ext/sysvsem/sysvsem.stub.php
@@ -0,0 +1,22 @@
+<?php
+
+/**
+ * @todo use bool for $auto_release
+ * @return resource|false
+ */
+function sem_get(int $key, int $max_acquire = 1, int $perm = 0666, int $auto_release = 1) {}
+
+/**
+ * @param resource $sem_identifier
+ */
+function sem_acquire($sem_identifier, bool $nowait = false): bool {}
+
+/**
+ * @param resource $sem_identifier
+ */
+function sem_release($sem_identifier): bool {}
+
+/**
+ * @param resource $sem_identifier
+ */
+function sem_remove($sem_identifier): bool {}
diff --git a/ext/sysvsem/sysvsem_arginfo.h b/ext/sysvsem/sysvsem_arginfo.h
new file mode 100644
index 0000000000..f45cae2498
--- /dev/null
+++ b/ext/sysvsem/sysvsem_arginfo.h
@@ -0,0 +1,19 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_sem_get, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, key, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, max_acquire, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, perm, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, auto_release, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sem_acquire, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, sem_identifier)
+ ZEND_ARG_TYPE_INFO(0, nowait, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_sem_release, 0, 1, _IS_BOOL, 0)
+ ZEND_ARG_INFO(0, sem_identifier)
+ZEND_END_ARG_INFO()
+
+#define arginfo_sem_remove arginfo_sem_release