Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f4a3095c66 |
+18
-18
@@ -11,15 +11,15 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
static zend_function_entry posix_semaphores_functions[] = {
|
static zend_function_entry posix_semaphores_functions[] = {
|
||||||
PHP_FE(posix_sem_open, NULL)
|
PHP_FE(posix_sem_open, arginfo_posix_sem_open)
|
||||||
PHP_FE(posix_sem_close, NULL)
|
PHP_FE(posix_sem_close, arginfo_posix_sem_close)
|
||||||
PHP_FE(posix_sem_unlink, NULL)
|
PHP_FE(posix_sem_unlink, arginfo_posix_sem_unlink)
|
||||||
PHP_FE(posix_sem_getvalue, NULL)
|
PHP_FE(posix_sem_getvalue, arginfo_posix_sem_getvalue)
|
||||||
PHP_FE(posix_sem_post, NULL)
|
PHP_FE(posix_sem_post, arginfo_posix_sem_post)
|
||||||
PHP_FE(posix_sem_wait, NULL)
|
PHP_FE(posix_sem_wait, arginfo_posix_sem_wait)
|
||||||
PHP_FE(posix_sem_trywait, NULL)
|
PHP_FE(posix_sem_trywait, arginfo_posix_sem_trywait)
|
||||||
PHP_FE(posix_sem_timedwait, NULL)
|
PHP_FE(posix_sem_timedwait, arginfo_posix_sem_timedwait)
|
||||||
PHP_FE(posix_sem_error, NULL)
|
PHP_FE(posix_sem_error, arginfo_posix_sem_error)
|
||||||
{NULL, NULL, NULL}
|
{NULL, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ typedef struct _php_posix_semaphore {
|
|||||||
} php_posix_semaphore;
|
} php_posix_semaphore;
|
||||||
|
|
||||||
|
|
||||||
static void php_posix_semaphore_dtor(zend_resource *rsrc TSRMLS_DC)
|
static void php_posix_semaphore_dtor(zend_resource *rsrc)
|
||||||
{
|
{
|
||||||
php_posix_semaphore *s = (php_posix_semaphore*)rsrc->ptr;
|
php_posix_semaphore *s = (php_posix_semaphore*)rsrc->ptr;
|
||||||
if (s)
|
if (s)
|
||||||
@@ -96,7 +96,7 @@ PHP_FUNCTION(posix_sem_open)
|
|||||||
zend_long flags;
|
zend_long flags;
|
||||||
zend_long mode = 0666;
|
zend_long mode = 0666;
|
||||||
zend_long value = 0;
|
zend_long value = 0;
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|ll", &name, &name_length, &flags, &mode, &value) == FAILURE)
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|ll", &name, &name_length, &flags, &mode, &value) == FAILURE)
|
||||||
{
|
{
|
||||||
RETURN_NULL();
|
RETURN_NULL();
|
||||||
}
|
}
|
||||||
@@ -115,7 +115,7 @@ PHP_FUNCTION(posix_sem_close)
|
|||||||
{
|
{
|
||||||
php_posix_semaphore *semaphore;
|
php_posix_semaphore *semaphore;
|
||||||
zval *zsemaphore;
|
zval *zsemaphore;
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zsemaphore) == FAILURE)
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zsemaphore) == FAILURE)
|
||||||
{
|
{
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
@@ -137,7 +137,7 @@ PHP_FUNCTION(posix_sem_unlink)
|
|||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
size_t name_length;
|
size_t name_length;
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_length) == FAILURE)
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_length) == FAILURE)
|
||||||
{
|
{
|
||||||
RETURN_NULL();
|
RETURN_NULL();
|
||||||
}
|
}
|
||||||
@@ -153,7 +153,7 @@ PHP_FUNCTION(posix_sem_getvalue)
|
|||||||
{
|
{
|
||||||
php_posix_semaphore *semaphore;
|
php_posix_semaphore *semaphore;
|
||||||
zval *zsemaphore;
|
zval *zsemaphore;
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zsemaphore) == FAILURE)
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zsemaphore) == FAILURE)
|
||||||
{
|
{
|
||||||
RETURN_NULL();
|
RETURN_NULL();
|
||||||
}
|
}
|
||||||
@@ -182,7 +182,7 @@ PHP_FUNCTION(posix_sem_post)
|
|||||||
{
|
{
|
||||||
php_posix_semaphore *semaphore;
|
php_posix_semaphore *semaphore;
|
||||||
zval *zsemaphore;
|
zval *zsemaphore;
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zsemaphore) == FAILURE)
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zsemaphore) == FAILURE)
|
||||||
{
|
{
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
@@ -210,7 +210,7 @@ PHP_FUNCTION(posix_sem_wait)
|
|||||||
{
|
{
|
||||||
php_posix_semaphore *semaphore;
|
php_posix_semaphore *semaphore;
|
||||||
zval *zsemaphore;
|
zval *zsemaphore;
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zsemaphore) == FAILURE)
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zsemaphore) == FAILURE)
|
||||||
{
|
{
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
@@ -238,7 +238,7 @@ PHP_FUNCTION(posix_sem_trywait)
|
|||||||
{
|
{
|
||||||
php_posix_semaphore *semaphore;
|
php_posix_semaphore *semaphore;
|
||||||
zval *zsemaphore;
|
zval *zsemaphore;
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zsemaphore) == FAILURE)
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zsemaphore) == FAILURE)
|
||||||
{
|
{
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
@@ -268,7 +268,7 @@ PHP_FUNCTION(posix_sem_timedwait)
|
|||||||
zval *zsemaphore;
|
zval *zsemaphore;
|
||||||
zend_long timeout_sec;
|
zend_long timeout_sec;
|
||||||
zend_long timeout_nsec = 0;
|
zend_long timeout_nsec = 0;
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|l", &zsemaphore, &timeout_sec, &timeout_nsec) == FAILURE)
|
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl|l", &zsemaphore, &timeout_sec, &timeout_nsec) == FAILURE)
|
||||||
{
|
{
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -1,9 +1,11 @@
|
|||||||
#ifndef POSIX_SEMAPHORES_H
|
#ifndef POSIX_SEMAPHORES_H
|
||||||
#define POSIX_SEMAPHORES_H 1
|
#define POSIX_SEMAPHORES_H 1
|
||||||
|
|
||||||
#define PHP_POSIX_SEMAPHORES_VERSION "1.0"
|
#define PHP_POSIX_SEMAPHORES_VERSION "1.1"
|
||||||
#define PHP_POSIX_SEMAPHORES_EXTNAME "posix_semaphores"
|
#define PHP_POSIX_SEMAPHORES_EXTNAME "posix_semaphores"
|
||||||
|
|
||||||
|
#include "posix_semaphores_arginfo.h"
|
||||||
|
|
||||||
PHP_MINIT_FUNCTION(posix_semaphores);
|
PHP_MINIT_FUNCTION(posix_semaphores);
|
||||||
PHP_MSHUTDOWN_FUNCTION(posix_semaphores);
|
PHP_MSHUTDOWN_FUNCTION(posix_semaphores);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
function posix_sem_open(string $name, int $flags, int $mode, int $value) : resource|null {}
|
||||||
|
function posix_sem_close(resource $semaphore) : boolean {}
|
||||||
|
function posix_sem_unlink(resource $semaphore) : boolean {}
|
||||||
|
function posix_sem_post(resource $semaphore) : boolean {}
|
||||||
|
function posix_sem_wait(resource $semaphore) : boolean {}
|
||||||
|
function posix_sem_trywait(resource $semaphore) : boolean {}
|
||||||
|
function posix_sem_timedwait(resource $semaphore, int $timeout_sec, int $timeout_nsec = 0) : boolean {}
|
||||||
|
function posix_sem_getvalue(resource $semaphore) : int|null {}
|
||||||
|
function posix_sem_error() : int {}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
/* This is a generated file, edit the .stub.php file instead.
|
||||||
|
* Stub hash: 9e3bcd8b1562df022b0491acc13c50410cec2648 */
|
||||||
|
|
||||||
|
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_posix_sem_open, 0, 4, resource, 1)
|
||||||
|
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
|
||||||
|
ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0)
|
||||||
|
ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
|
||||||
|
ZEND_ARG_TYPE_INFO(0, value, IS_LONG, 0)
|
||||||
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
|
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_posix_sem_close, 0, 1, boolean, 0)
|
||||||
|
ZEND_ARG_OBJ_INFO(0, semaphore, resource, 0)
|
||||||
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
|
#define arginfo_posix_sem_unlink arginfo_posix_sem_close
|
||||||
|
|
||||||
|
#define arginfo_posix_sem_post arginfo_posix_sem_close
|
||||||
|
|
||||||
|
#define arginfo_posix_sem_wait arginfo_posix_sem_close
|
||||||
|
|
||||||
|
#define arginfo_posix_sem_trywait arginfo_posix_sem_close
|
||||||
|
|
||||||
|
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_posix_sem_timedwait, 0, 2, boolean, 0)
|
||||||
|
ZEND_ARG_OBJ_INFO(0, semaphore, resource, 0)
|
||||||
|
ZEND_ARG_TYPE_INFO(0, timeout_sec, IS_LONG, 0)
|
||||||
|
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timeout_nsec, IS_LONG, 0, "0")
|
||||||
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
|
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_sem_getvalue, 0, 1, IS_LONG, 1)
|
||||||
|
ZEND_ARG_OBJ_INFO(0, semaphore, resource, 0)
|
||||||
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
|
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_posix_sem_error, 0, 0, IS_LONG, 0)
|
||||||
|
ZEND_END_ARG_INFO()
|
||||||
Reference in New Issue
Block a user