View | Details | Raw Unified | Return to ticket 2131 | Differences between
and this patch

Collapse All | Expand All

(-)a/src/common/Makefile.am (+1 lines)
Lines 131-136 libcommon_la_SOURCES = \ Link Here
131
	layouts_mgr.h layouts_mgr.c	\
131
	layouts_mgr.h layouts_mgr.c	\
132
	mapping.c mapping.h		\
132
	mapping.c mapping.h		\
133
	xcgroup_read_config.c xcgroup_read_config.h \
133
	xcgroup_read_config.c xcgroup_read_config.h \
134
	xlua.c xlua.h			\
134
	callerid.c callerid.h
135
	callerid.c callerid.h
135
136
136
EXTRA_libcommon_la_SOURCES = 		\
137
EXTRA_libcommon_la_SOURCES = 		\
(-)a/src/common/Makefile.in (-3 / +6 lines)
Lines 193-200 am__libcommon_la_SOURCES_DIST = cpu_frequency.c cpu_frequency.h \ Link Here
193
	proc_args.h slurm_strcasestr.c slurm_strcasestr.h node_conf.h \
193
	proc_args.h slurm_strcasestr.c slurm_strcasestr.h node_conf.h \
194
	node_conf.c gres.h gres.c entity.h entity.c layout.h layout.c \
194
	node_conf.c gres.h gres.c entity.h entity.c layout.h layout.c \
195
	layouts_mgr.h layouts_mgr.c mapping.c mapping.h \
195
	layouts_mgr.h layouts_mgr.c mapping.c mapping.h \
196
	xcgroup_read_config.c xcgroup_read_config.h callerid.c \
196
	xcgroup_read_config.c xcgroup_read_config.h xlua.c xlua.h \
197
	callerid.h
197
	callerid.c callerid.h
198
@HAVE_UNSETENV_FALSE@am__objects_1 = unsetenv.lo
198
@HAVE_UNSETENV_FALSE@am__objects_1 = unsetenv.lo
199
am_libcommon_la_OBJECTS = cpu_frequency.lo assoc_mgr.lo xmalloc.lo \
199
am_libcommon_la_OBJECTS = cpu_frequency.lo assoc_mgr.lo xmalloc.lo \
200
	xassert.lo xstring.lo xsignal.lo strnatcmp.lo forward.lo \
200
	xassert.lo xstring.lo xsignal.lo strnatcmp.lo forward.lo \
Lines 219-225 am_libcommon_la_OBJECTS = cpu_frequency.lo assoc_mgr.lo xmalloc.lo \ Link Here
219
	parse_time.lo job_options.lo global_defaults.lo timers.lo \
219
	parse_time.lo job_options.lo global_defaults.lo timers.lo \
220
	stepd_api.lo write_labelled_message.lo proc_args.lo \
220
	stepd_api.lo write_labelled_message.lo proc_args.lo \
221
	slurm_strcasestr.lo node_conf.lo gres.lo entity.lo layout.lo \
221
	slurm_strcasestr.lo node_conf.lo gres.lo entity.lo layout.lo \
222
	layouts_mgr.lo mapping.lo xcgroup_read_config.lo callerid.lo
222
	layouts_mgr.lo mapping.lo xcgroup_read_config.lo xlua.lo \
223
	callerid.lo
223
am__EXTRA_libcommon_la_SOURCES_DIST = unsetenv.c unsetenv.h \
224
am__EXTRA_libcommon_la_SOURCES_DIST = unsetenv.c unsetenv.h \
224
	uthash/LICENSE uthash/README uthash/uthash.h
225
	uthash/LICENSE uthash/README uthash/uthash.h
225
libcommon_la_OBJECTS = $(am_libcommon_la_OBJECTS)
226
libcommon_la_OBJECTS = $(am_libcommon_la_OBJECTS)
Lines 679-684 libcommon_la_SOURCES = \ Link Here
679
	layouts_mgr.h layouts_mgr.c	\
680
	layouts_mgr.h layouts_mgr.c	\
680
	mapping.c mapping.h		\
681
	mapping.c mapping.h		\
681
	xcgroup_read_config.c xcgroup_read_config.h \
682
	xcgroup_read_config.c xcgroup_read_config.h \
683
	xlua.c xlua.h			\
682
	callerid.c callerid.h
684
	callerid.c callerid.h
683
685
684
EXTRA_libcommon_la_SOURCES = \
686
EXTRA_libcommon_la_SOURCES = \
Lines 874-879 distclean-compile: Link Here
874
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xassert.Plo@am__quote@
876
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xassert.Plo@am__quote@
875
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xcgroup_read_config.Plo@am__quote@
877
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xcgroup_read_config.Plo@am__quote@
876
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xhash.Plo@am__quote@
878
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xhash.Plo@am__quote@
879
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xlua.Plo@am__quote@
877
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmalloc.Plo@am__quote@
880
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmalloc.Plo@am__quote@
878
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xsignal.Plo@am__quote@
881
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xsignal.Plo@am__quote@
879
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xstring.Plo@am__quote@
882
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xstring.Plo@am__quote@
(-)a/src/common/xlua.c (+62 lines)
Line 0 Link Here
1
/*****************************************************************************\
2
 *  xlua.h - Lua integration common functions
3
 *****************************************************************************
4
 *  Copyright (C) 2015 SchedMD LLC.
5
 *  Written by Tim Wickberg <tim@schedmd.com>
6
 *
7
 *  This file is part of SLURM, a resource management program.
8
 *  For details, see <http://slurm.schedmd.com/>.
9
 *  Please also read the included file: DISCLAIMER.
10
 *
11
 *  SLURM is free software; you can redistribute it and/or modify it under
12
 *  the terms of the GNU General Public License as published by the Free
13
 *  Software Foundation; either version 2 of the License, or (at your option)
14
 *  any later version.
15
 *
16
 *  In addition, as a special exception, the copyright holders give permission
17
 *  to link the code of portions of this program with the OpenSSL library under
18
 *  certain conditions as described in each individual source file, and
19
 *  distribute linked combinations including the two. You must obey the GNU
20
 *  General Public License in all respects for all of the code used other than
21
 *  OpenSSL. If you modify file(s) with this exception, you may extend this
22
 *  exception to your version of the file(s), but you are not obligated to do
23
 *  so. If you do not wish to do so, delete this exception statement from your
24
 *  version.  If you delete this exception statement from all source files in
25
 *  the program, then also delete it here.
26
 *
27
 *  SLURM is distributed in the hope that it will be useful, but WITHOUT ANY
28
 *  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
29
 *  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
30
 *  details.
31
 *
32
 *  You should have received a copy of the GNU General Public License along
33
 *  with SLURM; if not, write to the Free Software Foundation, Inc.,
34
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
35
\*****************************************************************************/
36
37
#include "src/common/xlua.h"
38
39
/*
40
 *  Common function to dlopen() the appropriate Lua libraries, and
41
 *   ensure the lua version matches what we compiled against.
42
 */
43
int xlua_dlopen(void)
44
{
45
	/*
46
	 *  Need to dlopen() liblua.so with RTLD_GLOBAL in order to
47
	 *   ensure symbols from liblua are available to libs opened
48
	 *   by any lua scripts.
49
	 */
50
	if (!dlopen("liblua.so",       RTLD_NOW | RTLD_GLOBAL) &&
51
	    !dlopen("liblua-5.2.so",   RTLD_NOW | RTLD_GLOBAL) &&
52
	    !dlopen("liblua5.2.so",    RTLD_NOW | RTLD_GLOBAL) &&
53
	    !dlopen("liblua5.2.so.0",  RTLD_NOW | RTLD_GLOBAL) &&
54
	    !dlopen("liblua-5.1.so",   RTLD_NOW | RTLD_GLOBAL) &&
55
	    !dlopen("liblua5.1.so",    RTLD_NOW | RTLD_GLOBAL) &&
56
	    !dlopen("liblua5.1.so.0",  RTLD_NOW | RTLD_GLOBAL)) {
57
		error("Failed to open liblua.so: %s", dlerror());
58
		return SLURM_ERROR;
59
	}
60
61
	return SLURM_SUCCESS;
62
}
(-)a/src/common/xlua.h (+49 lines)
Line 0 Link Here
1
/*****************************************************************************\
2
 *  xlua.h - Lua integration common functions
3
 *****************************************************************************
4
 *  Copyright (C) 2015 SchedMD LLC.
5
 *  Written by Tim Wickberg <tim@schedmd.com>
6
 *
7
 *  This file is part of SLURM, a resource management program.
8
 *  For details, see <http://slurm.schedmd.com/>.
9
 *  Please also read the included file: DISCLAIMER.
10
 *
11
 *  SLURM is free software; you can redistribute it and/or modify it under
12
 *  the terms of the GNU General Public License as published by the Free
13
 *  Software Foundation; either version 2 of the License, or (at your option)
14
 *  any later version.
15
 *
16
 *  In addition, as a special exception, the copyright holders give permission
17
 *  to link the code of portions of this program with the OpenSSL library under
18
 *  certain conditions as described in each individual source file, and
19
 *  distribute linked combinations including the two. You must obey the GNU
20
 *  General Public License in all respects for all of the code used other than
21
 *  OpenSSL. If you modify file(s) with this exception, you may extend this
22
 *  exception to your version of the file(s), but you are not obligated to do
23
 *  so. If you do not wish to do so, delete this exception statement from your
24
 *  version.  If you delete this exception statement from all source files in
25
 *  the program, then also delete it here.
26
 *
27
 *  SLURM is distributed in the hope that it will be useful, but WITHOUT ANY
28
 *  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
29
 *  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
30
 *  details.
31
 *
32
 *  You should have received a copy of the GNU General Public License along
33
 *  with SLURM; if not, write to the Free Software Foundation, Inc.,
34
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
35
\*****************************************************************************/
36
37
#ifndef _SLURM_XLUA_H
38
#define _SLURM_XLUA_H
39
40
#include <dlfcn.h>
41
#include <stdio.h>
42
43
#include "slurm/slurm.h"
44
#include "slurm/slurm_errno.h"
45
#include "src/common/log.h"
46
47
int xlua_dlopen();
48
49
#endif
(-)a/src/plugins/job_submit/lua/job_submit_lua.c (-12 / +7 lines)
Lines 66-71 Link Here
66
66
67
#include "src/common/slurm_xlator.h"
67
#include "src/common/slurm_xlator.h"
68
#include "src/common/assoc_mgr.h"
68
#include "src/common/assoc_mgr.h"
69
#include "src/common/xlua.h"
69
#include "src/slurmctld/locks.h"
70
#include "src/slurmctld/locks.h"
70
#include "src/slurmctld/slurmctld.h"
71
#include "src/slurmctld/slurmctld.h"
71
#include "src/slurmctld/reservation.h"
72
#include "src/slurmctld/reservation.h"
Lines 1410-1429 static int _load_script(void) Link Here
1410
 */
1411
 */
1411
int init(void)
1412
int init(void)
1412
{
1413
{
1414
	int rc = SLURM_SUCCESS;
1415
1413
	/*
1416
	/*
1414
	 *  Need to dlopen() liblua.so with RTLD_GLOBAL in order to
1417
	 * Need to dlopen() the Lua library to ensure plugins see
1415
	 *   ensure symbols from liblua are available to libs opened
1418
	 * appropriate symptoms
1416
	 *   by any lua scripts.
1417
	 */
1419
	 */
1418
	if (!dlopen("liblua.so",       RTLD_NOW | RTLD_GLOBAL) &&
1420
	if ((rc = xlua_dlopen()) != SLURM_SUCCESS)
1419
	    !dlopen("liblua-5.2.so",   RTLD_NOW | RTLD_GLOBAL) &&
1421
		return rc;
1420
	    !dlopen("liblua5.2.so",    RTLD_NOW | RTLD_GLOBAL) &&
1421
	    !dlopen("liblua5.2.so.0",  RTLD_NOW | RTLD_GLOBAL) &&
1422
	    !dlopen("liblua-5.1.so",   RTLD_NOW | RTLD_GLOBAL) &&
1423
	    !dlopen("liblua5.1.so",    RTLD_NOW | RTLD_GLOBAL) &&
1424
	    !dlopen("liblua5.1.so.0",  RTLD_NOW | RTLD_GLOBAL)) {
1425
		return error("Failed to open liblua.so: %s", dlerror());
1426
	}
1427
1422
1428
	return _load_script();
1423
	return _load_script();
1429
}
1424
}
(-)a/src/plugins/proctrack/lua/proctrack_lua.c (-13 / +5 lines)
Lines 63-68 Link Here
63
63
64
#include "src/common/log.h"
64
#include "src/common/log.h"
65
#include "src/common/macros.h"
65
#include "src/common/macros.h"
66
#include "src/common/xlua.h"
66
#include "src/slurmd/slurmstepd/slurmstepd_job.h"
67
#include "src/slurmd/slurmstepd/slurmstepd_job.h"
67
68
68
69
Lines 226-244 int init (void) Link Here
226
	int rc = SLURM_SUCCESS;
227
	int rc = SLURM_SUCCESS;
227
228
228
	/*
229
	/*
229
	 *  Need to dlopen() liblua.so with RTLD_GLOBAL in order to
230
	 * Need to dlopen() the Lua library to ensure plugins see
230
	 *   ensure symbols from liblua are available to libs opened
231
	 * appropriate symptoms
231
	 *   by any lua scripts.
232
	 */
232
	 */
233
	if (!dlopen("liblua.so",      RTLD_NOW | RTLD_GLOBAL) &&
233
	if ((rc = xlua_dlopen()) != SLURM_SUCCESS)
234
	    !dlopen("liblua-5.2.so",   RTLD_NOW | RTLD_GLOBAL) &&
234
		return rc;
235
	    !dlopen("liblua5.2.so",    RTLD_NOW | RTLD_GLOBAL) &&
236
	    !dlopen("liblua5.2.so.0",  RTLD_NOW | RTLD_GLOBAL) &&
237
	    !dlopen("liblua-5.1.so",   RTLD_NOW | RTLD_GLOBAL) &&
238
	    !dlopen("liblua5.1.so",    RTLD_NOW | RTLD_GLOBAL) &&
239
	    !dlopen("liblua5.1.so.0",  RTLD_NOW | RTLD_GLOBAL)) {
240
		return (error("Failed to open liblua.so: %s", dlerror()));
241
	}
242
235
243
	/*
236
	/*
244
	 *  Initilize lua
237
	 *  Initilize lua
245
- 

Return to ticket 2131