|
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 |
} |