Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance and fix SPANK plugin #52

Open
wants to merge 15 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ SCONTROL_ABSPATH = @SCONTROL_ABSPATH@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SINFO_ABSPATH = @SINFO_ABSPATH@
SRUN_PATH = @SRUN_PATH@
STRIP = @STRIP@
TESTRM = @TESTRM@
Expand Down
4 changes: 4 additions & 0 deletions config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
/* Define if were using sockets for client/server communication */
#undef COMM_SOCKET

/* Define to 1 if you have the declaration of `spank_prepend_task_argv', and
to 0 if you don't. */
#undef HAVE_DECL_SPANK_PREPEND_TASK_ARGV

/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H

Expand Down
105 changes: 105 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,7 @@ BLD_FLUXPLUGIN_FALSE
BLD_FLUXPLUGIN_TRUE
BLD_SLURMPLUGIN_FALSE
BLD_SLURMPLUGIN_TRUE
SINFO_ABSPATH
SCONTROL_ABSPATH
BE_host
BE_CXXCPP
Expand Down Expand Up @@ -2187,6 +2188,52 @@ fi
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno

} # ac_fn_c_check_header_mongrel

# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
# ---------------------------------------------
# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
# accordingly.
ac_fn_c_check_decl ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
as_decl_name=`echo $2|sed 's/ *(.*//'`
as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
#ifndef $as_decl_name
#ifdef __cplusplus
(void) $as_decl_use;
#else
(void) $as_decl_name;
#endif
#endif

;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
eval "$3=yes"
else
eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno

} # ac_fn_c_check_decl
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
Expand Down Expand Up @@ -18374,6 +18421,18 @@ fi


CPPFLAGS=$OCPPFLAGS
ac_fn_c_check_decl "$LINENO" "spank_prepend_task_argv" "ac_cv_have_decl_spank_prepend_task_argv" "#include<slurm/spank.h>
"
if test "x$ac_cv_have_decl_spank_prepend_task_argv" = xyes; then :
ac_have_decl=1
else
ac_have_decl=0
fi

cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_SPANK_PREPEND_TASK_ARGV $ac_have_decl
_ACEOF


OPATH=$PATH
if test "x$SLURM_DIR" != "x"; then
Expand Down Expand Up @@ -18423,6 +18482,50 @@ fi
if test "x$SCONTROL_ABSPATH" == "xnotfound"; then
as_fn_error $? "Could not find scontrol" "$LINENO" 5
fi
# Extract the first word of "sinfo", so it can be a program name with args.
set dummy sinfo; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_SINFO_ABSPATH+:} false; then :
$as_echo_n "(cached) " >&6
else
case $SINFO_ABSPATH in
[\\/]* | ?:[\\/]*)
ac_cv_path_SINFO_ABSPATH="$SINFO_ABSPATH" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_SINFO_ABSPATH="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS

test -z "$ac_cv_path_SINFO_ABSPATH" && ac_cv_path_SINFO_ABSPATH="notfound"
;;
esac
fi
SINFO_ABSPATH=$ac_cv_path_SINFO_ABSPATH
if test -n "$SINFO_ABSPATH"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SINFO_ABSPATH" >&5
$as_echo "$SINFO_ABSPATH" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


if test "x$SINFO_ABSPATH" == "xnotfound"; then
as_fn_error $? "Could not find sinfo" "$LINENO" 5
fi
PATH=$OPATH
fi

Expand All @@ -18436,6 +18539,8 @@ fi

SCONTROL_ABSPATH=$SCONTROL_ABSPATH

SINFO_ABSPATH=$SINFO_ABSPATH


if test "x$ENABLE_FLUX_PLUGIN" = "xtrue"; then
BLD_FLUXPLUGIN_TRUE=
Expand Down
6 changes: 6 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ if test "x$ENABLE_SLURM_PLUGIN" == "xtrue"; then
[],
[AC_MSG_ERROR([Could not find slurm/spank.h])])
CPPFLAGS=$OCPPFLAGS
AC_CHECK_DECLS([spank_prepend_task_argv], [], [], [[#include<slurm/spank.h>]])

OPATH=$PATH
if test "x$SLURM_DIR" != "x"; then
Expand All @@ -82,11 +83,16 @@ if test "x$ENABLE_SLURM_PLUGIN" == "xtrue"; then
if test "x$SCONTROL_ABSPATH" == "xnotfound"; then
AC_MSG_ERROR([Could not find scontrol])
fi
AC_PATH_PROG([SINFO_ABSPATH], [sinfo], [notfound])
if test "x$SINFO_ABSPATH" == "xnotfound"; then
AC_MSG_ERROR([Could not find sinfo])
fi
PATH=$OPATH
fi

AM_CONDITIONAL([BLD_SLURMPLUGIN], [test "x$ENABLE_SLURM_PLUGIN" == "xtrue"])
AC_SUBST(SCONTROL_ABSPATH, $SCONTROL_ABSPATH)
AC_SUBST(SINFO_ABSPATH, $SINFO_ABSPATH)

AM_CONDITIONAL([BLD_FLUXPLUGIN], [test "x$ENABLE_FLUX_PLUGIN" = "xtrue"])

Expand Down
1 change: 1 addition & 0 deletions doc/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ SCONTROL_ABSPATH = @SCONTROL_ABSPATH@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SINFO_ABSPATH = @SINFO_ABSPATH@
SRUN_PATH = @SRUN_PATH@
STRIP = @STRIP@
TESTRM = @TESTRM@
Expand Down
7 changes: 6 additions & 1 deletion src/client/auditclient/redirect.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,14 @@ ElfX_Addr client_call_binding(const char *symname, ElfX_Addr symvalue)
if (!binding)
return symvalue;

if (!binding->libc_func) {
debug_printf("%s: symname %s has no libc_func container\n",
__func__, symname);
return (ElfX_Addr) binding->spindle_func;
}

if (*binding->libc_func == NULL)
*binding->libc_func = (void *) symvalue;

return (ElfX_Addr) binding->spindle_func;
}

2 changes: 1 addition & 1 deletion src/client/client/lookup_libc.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ int lookup_libc_symbols()
}
else {
mallocfunc = (malloc_sig_t) (symtab[result].st_value + libc->l_addr);
debug_printf3("Bound errno_location to %p\n", app_errno_location);
debug_printf3("Bound mallocfunc to %p\n", mallocfunc);
found++;
}

Expand Down
5 changes: 3 additions & 2 deletions src/fe/startup/spindle_fe.cc
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,14 @@ int fillInSpindleArgsCmdlineFE(spindle_args_t *params, unsigned int options, int
mod_argv[i+1] = sargv[i];
}
mod_argv[i+1] = const_cast<char*>("launcher");
mod_argv[i] = NULL;
mod_argv[i+2] = NULL;
mod_argc = i+2;

opts = PARSECMD_FLAG_NOEXIT;
opts |= PARSECMD_FLAG_CAPTUREIO;
opts |= (options & SPINDLE_FILLARGS_NOUNIQUEID) ? PARSECMD_FLAG_NOUNIQUEID : 0;
opts |= (options & SPINDLE_FILLARGS_NONUMBER) ? PARSECMD_FLAG_NONUMBER : 0;
result = parseCommandLine(i, mod_argv, params, opts, errstr);
result = parseCommandLine(mod_argc, mod_argv, params, opts, errstr);

params->use_launcher = external_launcher;
params->startup_type = startup_external;
Expand Down
1 change: 1 addition & 0 deletions src/flux/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ SCONTROL_ABSPATH = @SCONTROL_ABSPATH@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SINFO_ABSPATH = @SINFO_ABSPATH@
SRUN_PATH = @SRUN_PATH@
STRIP = @STRIP@
TESTRM = @TESTRM@
Expand Down
1 change: 1 addition & 0 deletions src/logging/spindle_logc.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ void spawnLogDaemon(char *tempdir)
if (result == 0) {
char *params[7];
int cur = 0;
setpgid(0, 0); /* escape to own process group */
params[cur++] = spindle_log_daemon_name;
params[cur++] = tempdir;
if (spindle_debug_prints) {
Expand Down
2 changes: 1 addition & 1 deletion src/slurm_plugin/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ lib_LTLIBRARIES = libspindleslurm.la
libver=`$(top_srcdir)/LIB_VERSION spindleslurm`

libspindleslurm_la_SOURCES = encode_decode.c plugin_utils.c slurm_plugin.c $(top_srcdir)/src/utils/spindle_mkdir.c $(top_srcdir)/src/utils/parseloc.c
libspindleslurm_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/src/include -I$(top_srcdir)/src/logging -DUSE_PLUGIN_DEBUG -DDEBUG -DCUSTOM_GETENV -DCUSTOM_GETENV_FREE -DSCONTROL_BIN="$(SCONTROL_ABSPATH)" -DSPINDLE_DO_EXPORT
libspindleslurm_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/src/include -I$(top_srcdir)/src/logging -DUSE_PLUGIN_DEBUG -DDEBUG -DCUSTOM_GETENV -DCUSTOM_GETENV_FREE -DSCONTROL_BIN="$(SCONTROL_ABSPATH)" -DSINFO_BIN="$(SINFO_ABSPATH)" -DSPINDLE_DO_EXPORT
libspindleslurm_la_LDFLAGS = $(AM_LDFLAGS) -ldl -version-info $(libver)
libspindleslurm_la_LIBADD = $(top_builddir)/src/server/startup/libspindlebe.la $(top_builddir)/src/fe/startup/libspindlefe.la
libspindleslurm_la_CFLAGS = $(CFLAGS) -fvisibility=hidden
Expand Down
3 changes: 2 additions & 1 deletion src/slurm_plugin/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ SCONTROL_ABSPATH = @SCONTROL_ABSPATH@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SINFO_ABSPATH = @SINFO_ABSPATH@
SRUN_PATH = @SRUN_PATH@
STRIP = @STRIP@
TESTRM = @TESTRM@
Expand Down Expand Up @@ -378,7 +379,7 @@ top_srcdir = @top_srcdir@
lib_LTLIBRARIES = libspindleslurm.la
libver = `$(top_srcdir)/LIB_VERSION spindleslurm`
libspindleslurm_la_SOURCES = encode_decode.c plugin_utils.c slurm_plugin.c $(top_srcdir)/src/utils/spindle_mkdir.c $(top_srcdir)/src/utils/parseloc.c
libspindleslurm_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/src/include -I$(top_srcdir)/src/logging -DUSE_PLUGIN_DEBUG -DDEBUG -DCUSTOM_GETENV -DCUSTOM_GETENV_FREE -DSCONTROL_BIN="$(SCONTROL_ABSPATH)" -DSPINDLE_DO_EXPORT
libspindleslurm_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/src/include -I$(top_srcdir)/src/logging -DUSE_PLUGIN_DEBUG -DDEBUG -DCUSTOM_GETENV -DCUSTOM_GETENV_FREE -DSCONTROL_BIN="$(SCONTROL_ABSPATH)" -DSINFO_BIN="$(SINFO_ABSPATH)" -DSPINDLE_DO_EXPORT
libspindleslurm_la_LDFLAGS = $(AM_LDFLAGS) -ldl -version-info $(libver)
libspindleslurm_la_LIBADD = $(top_builddir)/src/server/startup/libspindlebe.la $(top_builddir)/src/fe/startup/libspindlefe.la
libspindleslurm_la_CFLAGS = $(CFLAGS) -fvisibility=hidden
Expand Down
Loading