diff --git a/php-fastcommon/fastcommon.c b/php-fastcommon/fastcommon.c index 142cee0..b430671 100644 --- a/php-fastcommon/fastcommon.c +++ b/php-fastcommon/fastcommon.c @@ -14,6 +14,7 @@ #include "sockopt.h" #include "shared_func.h" #include "id_generator.h" +#include "system_info.h" #include "fastcommon.h" #define MAJOR_VERSION 1 @@ -54,6 +55,9 @@ const zend_fcall_info empty_fcall_info = { 0, NULL, NULL, NULL, NULL, 0, NULL, N ZEND_FE(fastcommon_id_generator_get_extra, NULL) ZEND_FE(fastcommon_id_generator_get_timestamp, NULL) ZEND_FE(fastcommon_id_generator_destroy, NULL) + ZEND_FE(fastcommon_get_ifconfigs, NULL) + ZEND_FE(fastcommon_get_cpu_count, NULL) + ZEND_FE(fastcommon_get_sysinfo, NULL) {NULL, NULL, NULL} /* Must be the last line */ }; @@ -683,3 +687,113 @@ ZEND_FUNCTION(fastcommon_id_generator_get_timestamp) RETURN_LONG(id_generator_get_timestamp(context, id)); } +/* +array fastcommon_get_ifconfigs() +return the ifconfig array, return false for error +*/ +ZEND_FUNCTION(fastcommon_get_ifconfigs) +{ +#define MAX_IFCONFIGS 16 + int argc; + int count; + int i; + FastIFConfig if_configs[MAX_IFCONFIGS]; + zval *ifconfig_array; + + argc = ZEND_NUM_ARGS(); + if (argc != 0) { + logError("file: "__FILE__", line: %d, " + "fastcommon_get_ifconfigs parameters count: %d is invalid, expect 0", + __LINE__, argc); + RETURN_BOOL(false); + } + + if ((getifconfigs(if_configs, MAX_IFCONFIGS, &count)) != 0) { + RETURN_BOOL(false); + } + + array_init(return_value); + for (i=0; i/dev/null) Name: php-fastcommon -Version: 1.0.9 +Version: 1.0.10 Release: 1%{?dist} Summary: The php extension for libfastcommon License: GPL