diff --git a/meson.build b/meson.build index 088eddc8f6..6b3322914b 100644 --- a/meson.build +++ b/meson.build @@ -272,23 +272,6 @@ endif have = cc.get_id().contains('clang') and cc.has_header('android/log.h') srcconf.set10('IS_BIONIC', have) -## Android Native Build -srcconf.set10('IS_BIONIC_NATIVE', false) -if meson.is_cross_build() == false and srcconf.get('IS_BIONIC') == 1 - sdk_version = run_command('getprop', 'ro.build.version.sdk', check: true).stdout().strip() - cpu_arch = build_machine.cpu_family() - if cpu_arch == 'aarch64' - add_project_arguments('--target=aarch64-linux-android' + sdk_version, language: 'c') - elif cpu_arch == 'arm' - add_project_arguments('--target=armv7a-linux-androideabi' + sdk_version, language: 'c') - elif cpu_arch == 'X86_64' - add_project_arguments('--target=x86_64-linux-android' + sdk_version, language: 'c') - else - error('Unsupported arch:', cpu_arch) - endif - srcconf.set10('IS_BIONIC_NATIVE', true) -endif - # Feature detection ## Android Log System. srcconf.set10('USE_ANDROID_LOG', false) diff --git a/src/include/hasmntopt.c b/src/include/hasmntopt.c new file mode 100644 index 0000000000..d2808f0194 --- /dev/null +++ b/src/include/hasmntopt.c @@ -0,0 +1,30 @@ +/* liblxcapi + * + * SPDX-License-Identifier: LGPL-2.1+ * + * + * This function has been copied from musl. + */ + +#include + +struct mntent { + char* mnt_fsname; + char* mnt_dir; + char* mnt_type; + char* mnt_opts; + int mnt_freq; + int mnt_passno; +}; + +char *hasmntopt(const struct mntent *mnt, const char *opt) +{ + size_t l = strlen(opt); + char *p = mnt->mnt_opts; + for (;;) { + if (!strncmp(p, opt, l) && (!p[l] || p[l]==',' || p[l]=='=')) + return p; + p = strchr(p, ','); + if (!p) return 0; + p++; + } +} \ No newline at end of file diff --git a/src/include/hasmntopt.h b/src/include/hasmntopt.h new file mode 100644 index 0000000000..1fae5892fd --- /dev/null +++ b/src/include/hasmntopt.h @@ -0,0 +1,15 @@ +/* liblxcapi + * + * SPDX-License-Identifier: LGPL-2.1+ * + * + * This function has been copied from musl. + */ + +#ifndef _HASMNTOPT_H +#define _HASMNTOPT_H + +#include "../lxc/compiler.h" + +__hidden extern char* hasmntopt(const struct mntent* mnt, const char* opt); + +#endif \ No newline at end of file diff --git a/src/include/meson.build b/src/include/meson.build index 74fc43897c..c39fc1bebf 100644 --- a/src/include/meson.build +++ b/src/include/meson.build @@ -38,3 +38,9 @@ if srcconf.get('HAVE_STRCHRNUL') == 0 'strchrnul.c', 'strchrnul.h') endif + +if srcconf.get('HAVE_HASMNTOPT') == 0 + include_sources += files( + 'hasmntopt.c', + 'hasmntopt.h') +endif diff --git a/src/lxc/conf.c b/src/lxc/conf.c index 1899b2806d..ba6bc57eeb 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -90,6 +90,10 @@ #include "strchrnul.h" #endif +#if !HAVE_HASMNTOPT +#include "hasmntopt.h" +#endif + lxc_log_define(conf, lxc); /* diff --git a/src/lxc/rexec.c b/src/lxc/rexec.c index fdc44c2334..6e3eb587b5 100644 --- a/src/lxc/rexec.c +++ b/src/lxc/rexec.c @@ -96,10 +96,9 @@ static void lxc_rexec_as_memfd(char **argv, char **envp, const char *memfd_name) tmpfd = -EBADF; int ret; ssize_t bytes_sent = 0; -#if IS_BIONIC && __ANDROID_API__ >= 30 +#if IS_BIONIC off_t fd_size = -1; #else - #error "memfd_create() not implemented under Android 30" struct stat st = {0}; #endif