diff options
author | Tiago Natel de Moura <t.nateldemoura@f5.com> | 2020-07-31 12:21:21 +0100 |
---|---|---|
committer | Tiago Natel de Moura <t.nateldemoura@f5.com> | 2020-07-31 12:21:21 +0100 |
commit | b28b4459b0899cb8357df5f6c1e904fd1a34ebe3 (patch) | |
tree | bdabea7bad1f2d04c420f2b6b84dc110c7c968ba | |
parent | f3471c29c0870cffff3d96c1c50c88c47a4d8009 (diff) | |
download | unit-b28b4459b0899cb8357df5f6c1e904fd1a34ebe3.tar.gz unit-b28b4459b0899cb8357df5f6c1e904fd1a34ebe3.tar.bz2 |
Isolation: fixed the generation of mounts table.
Since the introduction of rootfs feature, some language modules
can't be configured multiple times.
Now the configure generates a separate nxt_<module>_mounts.h for
each module compiled.
-rw-r--r-- | auto/modules/java | 9 | ||||
-rw-r--r-- | auto/modules/python | 9 | ||||
-rw-r--r-- | auto/modules/ruby | 15 | ||||
-rw-r--r-- | src/nxt_java.c | 3 | ||||
-rw-r--r-- | src/nxt_python_wsgi.c | 12 | ||||
-rw-r--r-- | src/ruby/nxt_ruby.c | 3 |
6 files changed, 28 insertions, 23 deletions
diff --git a/auto/modules/java b/auto/modules/java index a3b1b958..fa68f573 100644 --- a/auto/modules/java +++ b/auto/modules/java @@ -227,7 +227,6 @@ NXT_JAVA_INSTALL_JARS= NXT_JAVA_UNINSTALL_JARS= NXT_JAVA_JARS=$NXT_BUILD_DIR/$NXT_JAVA_MODULE/nxt_jars.h -NXT_JAVA_MOUNTS_HEADER=$NXT_BUILD_DIR/$NXT_JAVA_MODULE/nxt_java_mounts.h mkdir -p $NXT_BUILD_DIR/$NXT_JAVA_MODULE cat << END > $NXT_JAVA_JARS @@ -318,7 +317,10 @@ NXT_JAVA_LIBC_DIR=`ldd "$NXT_JAVA_LIBJVM" | grep libc.so | cut -d' ' -f3` NXT_JAVA_LIBC_DIR=`dirname $NXT_JAVA_LIBC_DIR` fi -cat << END > $NXT_JAVA_MOUNTS_HEADER + +NXT_JAVA_MOUNTS_HEADER=nxt_${NXT_JAVA_MODULE}_mounts.h + +cat << END > $NXT_BUILD_DIR/$NXT_JAVA_MOUNTS_HEADER #ifndef _NXT_JAVA_MOUNTS_H_INCLUDED_ #define _NXT_JAVA_MOUNTS_H_INCLUDED_ @@ -371,7 +373,8 @@ for nxt_src in $NXT_JAVA_MODULE_SRCS; do $NXT_BUILD_DIR/$nxt_obj: $nxt_src $NXT_VERSION_H mkdir -p $NXT_BUILD_DIR/src/java - \$(CC) -c \$(CFLAGS) \$(NXT_INCS) $NXT_JAVA_INCLUDE \\ + \$(CC) -c \$(CFLAGS) -DNXT_JAVA_MOUNTS_H=\"$NXT_JAVA_MOUNTS_HEADER\" \\ + \$(NXT_INCS) $NXT_JAVA_INCLUDE \\ $nxt_dep_flags \\ -o $NXT_BUILD_DIR/$nxt_obj $nxt_src $nxt_dep_post diff --git a/auto/modules/python b/auto/modules/python index ab314013..c14bf7e0 100644 --- a/auto/modules/python +++ b/auto/modules/python @@ -130,13 +130,13 @@ if grep ^$NXT_PYTHON_MODULE: $NXT_MAKEFILE 2>&1 > /dev/null; then fi -NXT_PYTHON_MOUNTS_HEADER=$NXT_BUILD_DIR/nxt_python_mounts.h +NXT_PYTHON_MOUNTS_HEADER=nxt_${NXT_PYTHON_MODULE}_mounts.h $NXT_PYTHON -c 'import os.path import sys pyver = "python" + str(sys.version_info[0]) + "." + str(sys.version_info[1]) -print("static const nxt_fs_mount_t nxt_python%d%d_mounts[] = {" % (sys.version_info[0], sys.version_info[1])) +print("static const nxt_fs_mount_t nxt_python_mounts[] = {") pattern = "{(u_char *) \"%s\", (u_char *) \"%s\", (u_char *) \"bind\", NXT_MS_BIND|NXT_MS_REC, NULL}," base = None @@ -157,7 +157,7 @@ for p in sys.path: print("};\n\n") -' >> $NXT_PYTHON_MOUNTS_HEADER +' > $NXT_BUILD_DIR/$NXT_PYTHON_MOUNTS_HEADER $echo " + Python module: ${NXT_PYTHON_MODULE}.unit.so" @@ -185,7 +185,8 @@ for nxt_src in $NXT_PYTHON_MODULE_SRCS; do cat << END >> $NXT_MAKEFILE $NXT_BUILD_DIR/$nxt_obj: $nxt_src $NXT_VERSION_H - \$(CC) -c \$(CFLAGS) \$(NXT_INCS) $NXT_PYTHON_INCLUDE \\ + \$(CC) -c \$(CFLAGS) -DNXT_PYTHON_MOUNTS_H=\"$NXT_PYTHON_MOUNTS_HEADER\" \\ + \$(NXT_INCS) $NXT_PYTHON_INCLUDE \\ $nxt_dep_flags \\ -o $NXT_BUILD_DIR/$nxt_obj $nxt_src $nxt_dep_post diff --git a/auto/modules/ruby b/auto/modules/ruby index f7334cc7..5cead26b 100644 --- a/auto/modules/ruby +++ b/auto/modules/ruby @@ -51,7 +51,6 @@ $echo "configuring Ruby module ..." >> $NXT_AUTOCONF_ERR NXT_RUBY=${NXT_RUBY=ruby} NXT_RUBY_MODULE=${NXT_RUBY_MODULE=${NXT_RUBY}} -NXT_RUBY_MOUNTS_HEADER=$NXT_BUILD_DIR/nxt_ruby_mounts.h nxt_found=no @@ -145,7 +144,10 @@ if grep ^$NXT_RUBY_MODULE: $NXT_MAKEFILE 2>&1 > /dev/null; then fi -cat << END > $NXT_RUBY_MOUNTS_HEADER +NXT_RUBY_MOUNTS_HEADER=nxt_${NXT_RUBY_MODULE}_mounts.h +NXT_RUBY_MOUNTS_PATH=$NXT_BUILD_DIR/$NXT_RUBY_MOUNTS_HEADER + +cat << END > $NXT_RUBY_MOUNTS_PATH static const nxt_fs_mount_t nxt_ruby_mounts[] = { {(u_char *) "$NXT_RUBY_RUBYHDRDIR", (u_char *) "$NXT_RUBY_RUBYHDRDIR", @@ -166,11 +168,11 @@ static const nxt_fs_mount_t nxt_ruby_mounts[] = { END for path in `echo $NXT_RUBY_GEMPATH | tr ':' '\n'`; do - $echo "{(u_char *) \"$path\", (u_char *) \"$path\"," >> $NXT_RUBY_MOUNTS_HEADER - $echo "(u_char *) \"bind\", NXT_MS_BIND | NXT_MS_REC, NULL}," >> $NXT_RUBY_MOUNTS_HEADER + $echo "{(u_char *) \"$path\", (u_char *) \"$path\"," >> $NXT_RUBY_MOUNTS_PATH + $echo "(u_char *) \"bind\", NXT_MS_BIND | NXT_MS_REC, NULL}," >> $NXT_RUBY_MOUNTS_PATH done -$echo "};" >> $NXT_RUBY_MOUNTS_HEADER +$echo "};" >> $NXT_RUBY_MOUNTS_PATH $echo " + Ruby module: ${NXT_RUBY_MODULE}.unit.so" @@ -200,7 +202,8 @@ for nxt_src in $NXT_RUBY_MODULE_SRCS; do $NXT_BUILD_DIR/$nxt_obj: $nxt_src $NXT_VERSION_H mkdir -p $NXT_BUILD_DIR/src/ruby - \$(CC) -c \$(CFLAGS) \$(NXT_INCS) $NXT_RUBY_INCPATH \\ + \$(CC) -c \$(CFLAGS) -DNXT_RUBY_MOUNTS_H=\"$NXT_RUBY_MOUNTS_HEADER\" \\ + \$(NXT_INCS) $NXT_RUBY_INCPATH \\ $nxt_dep_flags \\ -o $NXT_BUILD_DIR/$nxt_obj $nxt_src $nxt_dep_post diff --git a/src/nxt_java.c b/src/nxt_java.c index c7471509..1f8864bd 100644 --- a/src/nxt_java.c +++ b/src/nxt_java.c @@ -26,7 +26,8 @@ #include "java/nxt_jni_URLClassLoader.h" #include "nxt_jars.h" -#include "nxt_java_mounts.h" + +#include NXT_JAVA_MOUNTS_H static nxt_int_t nxt_java_setup(nxt_task_t *task, nxt_process_t *process, nxt_common_app_conf_t *conf); diff --git a/src/nxt_python_wsgi.c b/src/nxt_python_wsgi.c index 7e8d1d79..c4b7702e 100644 --- a/src/nxt_python_wsgi.c +++ b/src/nxt_python_wsgi.c @@ -18,7 +18,8 @@ #include <nxt_unit_field.h> #include <nxt_unit_request.h> #include <nxt_unit_response.h> -#include <nxt_python_mounts.h> + +#include NXT_PYTHON_MOUNTS_H /* * According to "PEP 3333 / A Note On String Types" @@ -39,11 +40,6 @@ */ -#define _NXT_PYTHON_MOUNTS(major, minor) \ - nxt_python ## major ## minor ## _mounts - -#define NXT_PYTHON_MOUNTS(major, minor) _NXT_PYTHON_MOUNTS(major, minor) - #if PY_MAJOR_VERSION == 3 #define NXT_PYTHON_BYTES_TYPE "bytestring" @@ -123,8 +119,8 @@ NXT_EXPORT nxt_app_module_t nxt_app_module = { compat, nxt_string("python"), PY_VERSION, - NXT_PYTHON_MOUNTS(PY_MAJOR_VERSION, PY_MINOR_VERSION), - nxt_nitems(NXT_PYTHON_MOUNTS(PY_MAJOR_VERSION, PY_MINOR_VERSION)), + nxt_python_mounts, + nxt_nitems(nxt_python_mounts), NULL, nxt_python_start, }; diff --git a/src/ruby/nxt_ruby.c b/src/ruby/nxt_ruby.c index 9c4126f6..743bf646 100644 --- a/src/ruby/nxt_ruby.c +++ b/src/ruby/nxt_ruby.c @@ -7,7 +7,8 @@ #include <nxt_unit.h> #include <nxt_unit_request.h> -#include <nxt_ruby_mounts.h> + +#include NXT_RUBY_MOUNTS_H #define NXT_RUBY_RACK_API_VERSION_MAJOR 1 |