Skip to content

Commit 7ac6571

Browse files
committed
rt: glob, globfree dummy function for android
1 parent c3ab74b commit 7ac6571

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

src/rt/rust_android_dummy.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5+
#ifdef __ANDROID__
6+
57
#include "rust_android_dummy.h"
68
#include <math.h>
79
#include <errno.h>
810

9-
#ifdef __ANDROID__
10-
1111
int backtrace(void **array, int size) { return 0; }
1212

1313
char **backtrace_symbols(void *const *array, int size) { return 0; }
@@ -59,7 +59,18 @@ extern "C" void srand()
5959
extern "C" void atof()
6060
{
6161
}
62+
6263
extern "C" void tgammaf()
6364
{
6465
}
66+
67+
extern "C" int glob(const char *pattern, int flags, int (*errfunc) (const char *epath, int eerrno), glob_t *pglob)
68+
{
69+
return 0;
70+
}
71+
72+
extern "C" void globfree(glob_t *pglob)
73+
{
74+
}
75+
6576
#endif

src/rt/rust_android_dummy.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,28 @@ char **backtrace_symbols (void *__const *__array, int __size);
1111

1212
void backtrace_symbols_fd (void *__const *__array, int __size, int __fd);
1313

14+
#include <sys/types.h>
15+
16+
struct stat;
17+
typedef struct {
18+
size_t gl_pathc; /* Count of total paths so far. */
19+
size_t gl_matchc; /* Count of paths matching pattern. */
20+
size_t gl_offs; /* Reserved at beginning of gl_pathv. */
21+
int gl_flags; /* Copy of flags parameter to glob. */
22+
char **gl_pathv; /* List of paths matching pattern. */
23+
/* Copy of errfunc parameter to glob. */
24+
int (*gl_errfunc)(const char *, int);
25+
26+
/*
27+
* Alternate filesystem access methods for glob; replacement
28+
* versions of closedir(3), readdir(3), opendir(3), stat(2)
29+
* and lstat(2).
30+
*/
31+
void (*gl_closedir)(void *);
32+
struct dirent *(*gl_readdir)(void *);
33+
void *(*gl_opendir)(const char *);
34+
int (*gl_lstat)(const char *, struct stat *);
35+
} glob_t;
36+
1437
#endif
1538

0 commit comments

Comments
 (0)