Skip to content
Merged
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
17 changes: 0 additions & 17 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
30 changes: 30 additions & 0 deletions src/include/hasmntopt.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* liblxcapi
*
* SPDX-License-Identifier: LGPL-2.1+ *
*
* This function has been copied from musl.
*/

#include <string.h>

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++;
}
}
15 changes: 15 additions & 0 deletions src/include/hasmntopt.h
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions src/include/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions src/lxc/conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@
#include "strchrnul.h"
#endif

#if !HAVE_HASMNTOPT
#include "hasmntopt.h"
#endif

lxc_log_define(conf, lxc);

/*
Expand Down
3 changes: 1 addition & 2 deletions src/lxc/rexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down