[PHP-CVS] cvs: php-src(PHP_5_3) /ext/sysvshm sysvshm.c
iliaa Thu Mar 19 23:11:32 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/sysvshmsysvshm.c Log: MFB: Fixed bug #47721 (Aligment issues in mbstring and sysvshm extension) http://cvs.php.net/viewvc.cgi/php-src/ext/sysvshm/sysvshm.c?r1=1.70.2.2.2.5.2.11&r2=1.70.2.2.2.5.2.12&diff_format=u Index: php-src/ext/sysvshm/sysvshm.c diff -u php-src/ext/sysvshm/sysvshm.c:1.70.2.2.2.5.2.11 php-src/ext/sysvshm/sysvshm.c:1.70.2.2.2.5.2.12 --- php-src/ext/sysvshm/sysvshm.c:1.70.2.2.2.5.2.11 Tue Mar 17 23:21:37 2009 +++ php-src/ext/sysvshm/sysvshm.c Thu Mar 19 23:11:32 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: sysvshm.c,v 1.70.2.2.2.5.2.11 2009/03/17 23:21:37 iliaa Exp $ */ +/* $Id: sysvshm.c,v 1.70.2.2.2.5.2.12 2009/03/19 23:11:32 iliaa Exp $ */ /* This has been built and tested on Linux 2.2.14 * @@ -357,7 +357,7 @@ long total_size; long shm_varpos; - total_size = ((long) (len + sizeof(sysvshm_chunk) - 1) / 4) * 4 + 4; /* 4-byte alligment */ + total_size = ((long) (len + sizeof(sysvshm_chunk) - 1) / sizeof(long)) * sizeof(long) + sizeof(long); /* long alligment */ if ((shm_varpos = php_check_shm_data(ptr, key)) > 0) { php_remove_shm_data(ptr, shm_varpos); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/sysvshm sysvshm.c
iliaa Tue Mar 17 23:21:37 2009 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/sysvshmsysvshm.c Log: Fixed compiler warning http://cvs.php.net/viewvc.cgi/php-src/ext/sysvshm/sysvshm.c?r1=1.70.2.2.2.5.2.10&r2=1.70.2.2.2.5.2.11&diff_format=u Index: php-src/ext/sysvshm/sysvshm.c diff -u php-src/ext/sysvshm/sysvshm.c:1.70.2.2.2.5.2.10 php-src/ext/sysvshm/sysvshm.c:1.70.2.2.2.5.2.11 --- php-src/ext/sysvshm/sysvshm.c:1.70.2.2.2.5.2.10 Wed Dec 31 11:15:46 2008 +++ php-src/ext/sysvshm/sysvshm.c Tue Mar 17 23:21:37 2009 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: sysvshm.c,v 1.70.2.2.2.5.2.10 2008/12/31 11:15:46 sebastian Exp $ */ +/* $Id: sysvshm.c,v 1.70.2.2.2.5.2.11 2009/03/17 23:21:37 iliaa Exp $ */ /* This has been built and tested on Linux 2.2.14 * @@ -166,19 +166,19 @@ /* get the id from a specified key or create new shared memory */ if ((shm_id = shmget(shm_key, 0, 0)) < 0) { if (shm_size < sizeof(sysvshm_chunk_head)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%x: memorysize too small", shm_key); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%lx: memorysize too small", shm_key); efree(shm_list_ptr); RETURN_FALSE; } if ((shm_id = shmget(shm_key, shm_size, shm_flag | IPC_CREAT | IPC_EXCL)) < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%x: %s", shm_key, strerror(errno)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%lx: %s", shm_key, strerror(errno)); efree(shm_list_ptr); RETURN_FALSE; } } if ((shm_ptr = shmat(shm_id, NULL, 0)) == (void *) -1) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%x: %s", shm_key, strerror(errno)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed for key 0x%lx: %s", shm_key, strerror(errno)); efree(shm_list_ptr); RETURN_FALSE; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/sysvshm sysvshm.c /ext/sysvshm/tests 001.phpt 002.phpt 003.phpt 004.phpt 005.phpt 006.phpt 007.phpt
2008/6/27 Felipe Pena <[EMAIL PROTECTED]>: > felipe Fri Jun 27 00:22:18 2008 UTC > > Modified files: (Branch: PHP_5_3) >/php-src/ext/sysvshmsysvshm.c >/php-src/ext/sysvshm/tests 001.phpt 002.phpt 003.phpt 004.phpt >005.phpt 006.phpt 007.phpt > Log: > - New parameter parsing API This is totally different then HEAD. How about merging stuff from HEAD then to do complete rewrite in 5.3? We now have 3 completely different versions of pretty much exactly the same code. -Hannes -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/sysvshm sysvshm.c
felipe Tue Jul 1 15:45:54 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/sysvshmsysvshm.c Log: - Added arginfo http://cvs.php.net/viewvc.cgi/php-src/ext/sysvshm/sysvshm.c?r1=1.70.2.2.2.5.2.3&r2=1.70.2.2.2.5.2.4&diff_format=u Index: php-src/ext/sysvshm/sysvshm.c diff -u php-src/ext/sysvshm/sysvshm.c:1.70.2.2.2.5.2.3 php-src/ext/sysvshm/sysvshm.c:1.70.2.2.2.5.2.4 --- php-src/ext/sysvshm/sysvshm.c:1.70.2.2.2.5.2.3 Fri Jun 27 00:22:18 2008 +++ php-src/ext/sysvshm/sysvshm.c Tue Jul 1 15:45:54 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: sysvshm.c,v 1.70.2.2.2.5.2.3 2008/06/27 00:22:18 felipe Exp $ */ +/* $Id: sysvshm.c,v 1.70.2.2.2.5.2.4 2008/07/01 15:45:54 felipe Exp $ */ /* This has been built and tested on Linux 2.2.14 * @@ -39,15 +39,53 @@ #include "ext/standard/php_smart_str.h" #include "php_ini.h" +/* {{{ arginfo */ +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_shm_attach, 0, 0, 1) + ZEND_ARG_INFO(0, key) + ZEND_ARG_INFO(0, memsize) + ZEND_ARG_INFO(0, perm) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_shm_detach, 0, 0, 1) + ZEND_ARG_INFO(0, shm_identifier) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_shm_remove, 0, 0, 1) + ZEND_ARG_INFO(0, shm_identifier) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_shm_put_var, 0, 0, 3) + ZEND_ARG_INFO(0, shm_identifier) + ZEND_ARG_INFO(0, variable_key) + ZEND_ARG_INFO(0, variable) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_shm_get_var, 0, 0, 2) + ZEND_ARG_INFO(0, id) + ZEND_ARG_INFO(0, variable_key) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_shm_remove_var, 0, 0, 2) + ZEND_ARG_INFO(0, id) + ZEND_ARG_INFO(0, variable_key) +ZEND_END_ARG_INFO() +/* }}} */ + /* {{{ sysvshm_functions[] */ const zend_function_entry sysvshm_functions[] = { - PHP_FE(shm_attach, NULL) - PHP_FE(shm_remove, NULL) - PHP_FE(shm_detach, NULL) - PHP_FE(shm_put_var, NULL) - PHP_FE(shm_get_var, NULL) - PHP_FE(shm_remove_var, NULL) + PHP_FE(shm_attach, arginfo_shm_attach) + PHP_FE(shm_remove, arginfo_shm_detach) + PHP_FE(shm_detach, arginfo_shm_remove) + PHP_FE(shm_put_var, arginfo_shm_put_var) + PHP_FE(shm_get_var, arginfo_shm_get_var) + PHP_FE(shm_remove_var, arginfo_shm_remove_var) {NULL, NULL, NULL} }; /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/sysvshm sysvshm.c /ext/sysvshm/tests 001.phpt 002.phpt 003.phpt 004.phpt 005.phpt 006.phpt 007.phpt
felipe Fri Jun 27 00:22:18 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/sysvshmsysvshm.c /php-src/ext/sysvshm/tests 001.phpt 002.phpt 003.phpt 004.phpt 005.phpt 006.phpt 007.phpt Log: - New parameter parsing API http://cvs.php.net/viewvc.cgi/php-src/ext/sysvshm/sysvshm.c?r1=1.70.2.2.2.5.2.2&r2=1.70.2.2.2.5.2.3&diff_format=u Index: php-src/ext/sysvshm/sysvshm.c diff -u php-src/ext/sysvshm/sysvshm.c:1.70.2.2.2.5.2.2 php-src/ext/sysvshm/sysvshm.c:1.70.2.2.2.5.2.3 --- php-src/ext/sysvshm/sysvshm.c:1.70.2.2.2.5.2.2 Mon Dec 31 07:17:16 2007 +++ php-src/ext/sysvshm/sysvshm.c Fri Jun 27 00:22:18 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: sysvshm.c,v 1.70.2.2.2.5.2.2 2007/12/31 07:17:16 sebastian Exp $ */ +/* $Id: sysvshm.c,v 1.70.2.2.2.5.2.3 2008/06/27 00:22:18 felipe Exp $ */ /* This has been built and tested on Linux 2.2.14 * @@ -107,7 +107,7 @@ Creates or open a shared memory segment */ PHP_FUNCTION(shm_attach) { - zval **arg_key, **arg_size, **arg_flag; + long arg_key, arg_size, arg_flag; long shm_size, shm_flag; sysvshm_shm *shm_list_ptr; char *shm_ptr; @@ -118,21 +118,18 @@ shm_flag = 0666; shm_size = php_sysvshm.init_mem; - - if (ac < 1 || ac > 3 || zend_get_parameters_ex(ac, &arg_key, &arg_size, &arg_flag) == FAILURE) { - WRONG_PARAM_COUNT; + + if (zend_parse_parameters(ac TSRMLS_CC, "l|ll", &arg_key, &arg_size, &arg_flag) == FAILURE) { + return; } + + shm_key = arg_key; - switch (ac) { - case 3: - convert_to_long_ex(arg_flag); - shm_flag = Z_LVAL_PP(arg_flag); - case 2: - convert_to_long_ex(arg_size); - shm_size= Z_LVAL_PP(arg_size); - case 1: - convert_to_long_ex(arg_key); - shm_key = Z_LVAL_PP(arg_key); + if (ac > 1) { + shm_size = arg_size; + if (ac > 2) { + shm_flag = arg_flag; + } } if (shm_size < 1) { @@ -184,22 +181,21 @@ Disconnects from shared memory segment */ PHP_FUNCTION(shm_detach) { - zval **arg_id; + long arg_id; int type; sysvshm_shm *shm_list_ptr; - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg_id) == FAILURE) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &arg_id) == FAILURE) { + return; } - convert_to_long_ex(arg_id); - shm_list_ptr = (sysvshm_shm *) zend_list_find(Z_LVAL_PP(arg_id), &type); + shm_list_ptr = (sysvshm_shm *) zend_list_find(arg_id, &type); if (!shm_list_ptr || type != php_sysvshm.le_shm) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The parameter is not a valid shm_identifier"); RETURN_FALSE; } - zend_list_delete(Z_LVAL_PP(arg_id)); + zend_list_delete(arg_id); RETURN_TRUE; } @@ -209,17 +205,16 @@ Removes shared memory from Unix systems */ PHP_FUNCTION(shm_remove) { - zval **arg_id; + long arg_id; long id; int type; sysvshm_shm *shm_list_ptr; - if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg_id) == FAILURE) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &arg_id) == FAILURE) { + return; } - convert_to_long_ex(arg_id); - id = Z_LVAL_PP(arg_id); + id = arg_id; shm_list_ptr = (sysvshm_shm *) zend_list_find(id, &type); if (!shm_list_ptr || type != php_sysvshm.le_shm) { @@ -240,7 +235,8 @@ Inserts or updates a variable in shared memory */ PHP_FUNCTION(shm_put_var) { - zval **arg_id, **arg_key, **arg_var; + long arg_id, arg_key; + zval **arg_var; long key, id; sysvshm_shm *shm_list_ptr; int type; @@ -248,14 +244,12 @@ int ret; php_serialize_data_t var_hash; - if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg_id, &arg_key, &arg_var) == FAILURE) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llZ", &arg_id, &arg_key, &arg_var) == FAILURE) { + return; } - - convert_to_long_ex(arg_id); - id = Z_LVAL_PP(arg_id); - convert_to_long_ex(arg_key); - key = Z_LVAL_PP(arg_key); + + id = arg_id; + key = arg_key; shm_list_ptr = (sysvshm_shm *) zend_list_find(id, &type); if (!shm_list_ptr || type != php_sysvshm.le_shm) { @@ -286,7 +280,7 @@ Returns a variable from shared memor