summaryrefslogtreecommitdiff
path: root/ext/shmop
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2014-08-19 14:05:39 +0200
committerAnatol Belski <ab@php.net>2014-08-19 14:05:39 +0200
commit64d54461bf17efe0f0facb5856e566010a5eb0da (patch)
treed726ee93353ec44161583914c440cc2493293458 /ext/shmop
parente41ec2cfebf9af73dfe02bb6bfd4af9345468b34 (diff)
downloadphp-git-64d54461bf17efe0f0facb5856e566010a5eb0da.tar.gz
ported ext/shmop
Diffstat (limited to 'ext/shmop')
-rw-r--r--ext/shmop/php_shmop.h2
-rw-r--r--ext/shmop/shmop.c31
2 files changed, 16 insertions, 17 deletions
diff --git a/ext/shmop/php_shmop.h b/ext/shmop/php_shmop.h
index 2779fe14be..e0e0448709 100644
--- a/ext/shmop/php_shmop.h
+++ b/ext/shmop/php_shmop.h
@@ -45,7 +45,7 @@ struct php_shmop
int shmflg;
int shmatflg;
char *addr;
- int size;
+ php_int_t size;
};
typedef struct {
diff --git a/ext/shmop/shmop.c b/ext/shmop/shmop.c
index 97e0ce14e9..3a66d7343c 100644
--- a/ext/shmop/shmop.c
+++ b/ext/shmop/shmop.c
@@ -146,13 +146,13 @@ PHP_MINFO_FUNCTION(shmop)
gets and attaches a shared memory segment */
PHP_FUNCTION(shmop_open)
{
- long key, mode, size;
+ php_int_t key, mode, size;
struct php_shmop *shmop;
struct shmid_ds shm;
char *flags;
int flags_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lsll", &key, &flags, &flags_len, &mode, &size) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "isii", &key, &flags, &flags_len, &mode, &size) == FAILURE) {
return;
}
@@ -227,13 +227,13 @@ err:
reads from a shm segment */
PHP_FUNCTION(shmop_read)
{
- long shmid, start, count;
+ php_int_t shmid, start, count;
struct php_shmop *shmop;
char *startaddr;
int bytes;
zend_string *return_string;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &shmid, &start, &count) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iii", &shmid, &start, &count) == FAILURE) {
return;
}
@@ -262,10 +262,10 @@ PHP_FUNCTION(shmop_read)
closes a shared memory segment */
PHP_FUNCTION(shmop_close)
{
- long shmid;
+ php_int_t shmid;
zval *res;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &shmid) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &shmid) == FAILURE) {
return;
}
@@ -280,10 +280,10 @@ PHP_FUNCTION(shmop_close)
returns the shm size */
PHP_FUNCTION(shmop_size)
{
- long shmid;
+ php_int_t shmid;
struct php_shmop *shmop;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &shmid) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &shmid) == FAILURE) {
return;
}
@@ -299,11 +299,10 @@ PHP_FUNCTION(shmop_write)
{
struct php_shmop *shmop;
int writesize;
- long shmid, offset;
- char *data;
- int data_len;
+ php_int_t shmid, offset;
+ zend_string *data;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lsl", &shmid, &data, &data_len, &offset) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iSi", &shmid, &data, &offset) == FAILURE) {
return;
}
@@ -319,8 +318,8 @@ PHP_FUNCTION(shmop_write)
RETURN_FALSE;
}
- writesize = (data_len < shmop->size - offset) ? data_len : shmop->size - offset;
- memcpy(shmop->addr + offset, data, writesize);
+ writesize = (data->len < shmop->size - offset) ? data->len : shmop->size - offset;
+ memcpy(shmop->addr + offset, data->val, writesize);
RETURN_INT(writesize);
}
@@ -330,10 +329,10 @@ PHP_FUNCTION(shmop_write)
mark segment for deletion */
PHP_FUNCTION(shmop_delete)
{
- long shmid;
+ php_int_t shmid;
struct php_shmop *shmop;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &shmid) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &shmid) == FAILURE) {
return;
}