Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

use xfree and xmalloc when available

  • Loading branch information...
commit 342597476b82525496373b63265b6597150d5242 1 parent 0f6151d
Jimmy Tang authored
Showing with 34 additions and 20 deletions.
  1. +28 −19 config.m4
  2. +6 −1 slurm_php.c
View
47 config.m4
@@ -8,51 +8,60 @@
# Use to make the php slurm extension
##*****************************************************************************
PHP_ARG_WITH(slurm, whether to use slurm,
-[ --with-slurm=SLURM_INSTALL_PATH])
-
+[ --with-slurm SLURM install dir])
+
+AC_MSG_CHECKING([for phpize in default path])
+if test ! -f "/usr/bin/phpize"; then
+ PHP_SLURM="no"
+ AC_MSG_RESULT([NO, CANNOT MAKE SLURM_PHP])
+else
+ AC_MSG_RESULT([yes])
+fi
+
if test "$PHP_SLURM" != "no"; then
SLURMLIB_PATH="/usr/lib64 /usr/lib"
SLURMINCLUDE_PATH="/usr/include"
- SEARCH_FOR="libslurm.so"
-
- # --with-libslurm -> check with-path
-
+ SEARCH_FOR="libslurmdb.so"
+
+ # --with-libslurm -> check with-path
+
if test -r $PHP_SLURM/; then # path given as parameter
SLURM_DIR=$PHP_SLURM
SLURMLIB_PATH="$SLURM_DIR/lib"
else # search default path list
- AC_MSG_CHECKING([for libslurm.so in default paths])
+ AC_MSG_CHECKING([for libslurmdb.so in default paths])
for i in $SLURMLIB_PATH ; do
if test -r $i/$SEARCH_FOR; then
SLURM_DIR=$i
PHP_ADD_LIBPATH($i, SLURM_PHP_SHARED_LIBADD)
-
+
AC_MSG_RESULT([found in $i])
-
+
fi
done
fi
-
+
if test -z "$SLURM_DIR"; then
AC_MSG_RESULT([not found])
AC_MSG_ERROR([Please reinstall the slurm distribution])
fi
-
+
PHP_ADD_INCLUDE($SLURMINCLUDE_PATH)
-
- LIBNAME=slurm
+
+ LIBNAME=slurmdb
LIBSYMBOL=slurm_acct_storage_init
-
+
PHP_CHECK_LIBRARY($LIBNAME, $LIBSYMBOL,
[PHP_ADD_LIBRARY($LIBNAME, , SLURM_PHP_SHARED_LIBADD)
AC_DEFINE(HAVE_SLURMLIB,1,[ ])],
- [AC_MSG_ERROR([wrong libslurm version or lib not found])],
- [-L$SLURM_DIR -lslurm])
-
-
+ [AC_MSG_ERROR([wrong libslurmdb version or lib not found])],
+ [-L$SLURM_DIR -l$LIBNAME])
+
+
PHP_SUBST(SLURM_PHP_SHARED_LIBADD)
-
+
AC_CHECK_HEADERS(stdbool.h)
+ AC_CHECK_HEADERS(xmalloc.h)
AC_DEFINE(HAVE_SLURM_PHP, 1, [Whether you have SLURM])
#PHP_EXTENSION(slurm_php, $ext_shared)
View
7 slurm_php.c
@@ -90,6 +90,11 @@ zend_module_entry slurm_php_module_entry = {
ZEND_GET_MODULE(slurm_php)
#endif
+#ifdef HAVE_XMALLOC_H
+#define malloc(size) xmalloc(size)
+#define free(ptr) xfree(ptr)
+#endif
+
/*****************************************************************************\
* TODO
@@ -116,7 +121,7 @@ void parse_node_pointer(zval *sub_arr, node_info_t *node_arr)
zend_add_valid_assoc_time_string(sub_arr, "Boot Time",
&node_arr->boot_time);
add_assoc_long(sub_arr, "#CPU'S", node_arr->cpus);
- add_assoc_long(sub_arr, "#Cores/CPU", node_arr->cpus);
+ add_assoc_long(sub_arr, "#Cores/CPU", node_arr->cores);
if (node_arr->features == NULL) {
add_assoc_null(sub_arr, "Features");
Please sign in to comment.
Something went wrong with that request. Please try again.