diff options
| author | Po Lu | 2023-01-26 15:37:04 +0800 |
|---|---|---|
| committer | Po Lu | 2023-01-26 15:37:04 +0800 |
| commit | 4255d7f0514c5fa1badded6b0bc445ec2d2764c0 (patch) | |
| tree | 93efa03d4ba0c1987eab16645f9ebcc405ab9e19 /src | |
| parent | 8125e26a323cb8906a14005519b0fa5693718c90 (diff) | |
| download | emacs-4255d7f0514c5fa1badded6b0bc445ec2d2764c0.tar.gz emacs-4255d7f0514c5fa1badded6b0bc445ec2d2764c0.zip | |
Update Android port
* .gitignore: Ignore lib/math.h.
* INSTALL.android: Update accordingly.
* build-aux/ndk-build-helper-1.mk:
* build-aux/ndk-build-helper-2.mk:
* build-aux/ndk-build-helper.mk:
* build-aux/ndk-module-extract.awk: Handle C++ modules.
* configure.ac: Enable libxml2 on Android.
* cross/ndk-build/Makefile.in:
* cross/ndk-build/ndk-build-shared-library.mk:
* cross/ndk-build/ndk-build-static-library.mk:
* cross/ndk-build/ndk-build.mk.in:
* cross/ndk-build/ndk-resolve.mk: Fix dependency resolution of
includes.
* java/org/gnu/emacs/EmacsView.java (popupMenu): Fix minimum SDK
version for actual popup menus.
* lib/math.h: Delete file.
* m4/ndk-build.m4 (ndk_SEARCH_MODULE, ndk_CHECK_MODULES): Look
for nasm and C++ libraries.
* src/android.c (faccessat): Rename to `android_faccessat'.
* src/android.h: Update prototypes.
* src/dired.c (file_name_completion_dirp):
* src/fileio.c (file_access_p, Faccess_file, file_directory_p):
* src/lisp.h:
* src/lread.c (openp):
* src/process.c (allocate_pty): Use sys_faccessat.
* src/sysdep.c (sys_faccessat): New function.
Diffstat (limited to 'src')
| -rw-r--r-- | src/android.c | 24 | ||||
| -rw-r--r-- | src/android.h | 1 | ||||
| -rw-r--r-- | src/dired.c | 3 | ||||
| -rw-r--r-- | src/fileio.c | 8 | ||||
| -rw-r--r-- | src/lisp.h | 1 | ||||
| -rw-r--r-- | src/lread.c | 6 | ||||
| -rw-r--r-- | src/process.c | 3 | ||||
| -rw-r--r-- | src/sysdep.c | 10 |
8 files changed, 38 insertions, 18 deletions
diff --git a/src/android.c b/src/android.c index 2f21a03b53f..52de153eefd 100644 --- a/src/android.c +++ b/src/android.c | |||
| @@ -4214,30 +4214,34 @@ android_window_updated (android_window window, unsigned long serial) | |||
| 4214 | 4214 | ||
| 4215 | 4215 | ||
| 4216 | 4216 | ||
| 4217 | #if __ANDROID_API__ >= 17 | 4217 | #if __ANDROID_API__ >= 16 |
| 4218 | |||
| 4219 | #undef faccessat | ||
| 4220 | 4218 | ||
| 4221 | /* Replace the system faccessat with one which understands AT_EACCESS. | 4219 | /* Replace the system faccessat with one which understands AT_EACCESS. |
| 4222 | Android's faccessat simply fails upon using AT_EACCESS, so replace | 4220 | Android's faccessat simply fails upon using AT_EACCESS, so replace |
| 4223 | it with zero here. This isn't caught during configuration. | 4221 | it with zero here. This isn't caught during configuration. |
| 4224 | 4222 | ||
| 4225 | This replacement is only done when building for Android 17 or | 4223 | This replacement is only done when building for Android 16 or |
| 4226 | later, because earlier versions use the gnulib replacement that | 4224 | later, because earlier versions use the gnulib replacement that |
| 4227 | lacks these issues. */ | 4225 | lacks these issues. */ |
| 4228 | 4226 | ||
| 4229 | int | 4227 | int |
| 4230 | faccessat (int dirfd, const char *pathname, int mode, int flags) | 4228 | android_faccessat (int dirfd, const char *pathname, int mode, int flags) |
| 4231 | { | 4229 | { |
| 4232 | static int (*real_faccessat) (int, const char *, int, int); | 4230 | return faccessat (dirfd, pathname, mode, flags & ~AT_EACCESS); |
| 4231 | } | ||
| 4232 | |||
| 4233 | #else /* __ANDROID_API__ < 16 */ | ||
| 4233 | 4234 | ||
| 4234 | if (!real_faccessat) | 4235 | /* This is unnecessary on earlier API versions, as gnulib's |
| 4235 | real_faccessat = dlsym (RTLD_NEXT, "faccessat"); | 4236 | rpl_faccessat will be used instead. */ |
| 4236 | 4237 | ||
| 4237 | return real_faccessat (dirfd, pathname, mode, flags & ~AT_EACCESS); | 4238 | int |
| 4239 | android_faccessat (int dirfd, const char *pathname, int mode, int flags) | ||
| 4240 | { | ||
| 4241 | return faccessat (dirfd, pathname, mode, flags); | ||
| 4238 | } | 4242 | } |
| 4239 | 4243 | ||
| 4240 | #endif /* __ANDROID_API__ >= 17 */ | 4244 | #endif |
| 4241 | 4245 | ||
| 4242 | 4246 | ||
| 4243 | 4247 | ||
diff --git a/src/android.h b/src/android.h index 6c20995e4a1..33fad512d4a 100644 --- a/src/android.h +++ b/src/android.h | |||
| @@ -52,6 +52,7 @@ extern char *android_user_full_name (struct passwd *); | |||
| 52 | extern int android_fstat (int, struct stat *); | 52 | extern int android_fstat (int, struct stat *); |
| 53 | extern int android_fstatat (int, const char *restrict, | 53 | extern int android_fstatat (int, const char *restrict, |
| 54 | struct stat *restrict, int); | 54 | struct stat *restrict, int); |
| 55 | extern int android_faccessat (int, const char *, int, int); | ||
| 55 | extern int android_close (int); | 56 | extern int android_close (int); |
| 56 | extern int android_fclose (FILE *); | 57 | extern int android_fclose (FILE *); |
| 57 | extern const char *android_get_home_directory (void); | 58 | extern const char *android_get_home_directory (void); |
diff --git a/src/dired.c b/src/dired.c index ced08a35643..b38416e981a 100644 --- a/src/dired.c +++ b/src/dired.c | |||
| @@ -894,7 +894,8 @@ file_name_completion_dirp (int fd, struct dirent *dp, ptrdiff_t len) | |||
| 894 | return true; | 894 | return true; |
| 895 | #endif | 895 | #endif |
| 896 | 896 | ||
| 897 | bool dirp = faccessat (fd, subdir_name, F_OK, AT_EACCESS) == 0; | 897 | bool dirp = sys_faccessat (fd, subdir_name, |
| 898 | F_OK, AT_EACCESS) == 0; | ||
| 898 | SAFE_FREE (); | 899 | SAFE_FREE (); |
| 899 | return dirp; | 900 | return dirp; |
| 900 | } | 901 | } |
diff --git a/src/fileio.c b/src/fileio.c index 492a43d74c3..6f25506dbc2 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -188,7 +188,7 @@ file_access_p (char const *file, int amode) | |||
| 188 | return true; | 188 | return true; |
| 189 | #endif | 189 | #endif |
| 190 | 190 | ||
| 191 | if (faccessat (AT_FDCWD, file, amode, AT_EACCESS) == 0) | 191 | if (sys_faccessat (AT_FDCWD, file, amode, AT_EACCESS) == 0) |
| 192 | return true; | 192 | return true; |
| 193 | 193 | ||
| 194 | #ifdef CYGWIN | 194 | #ifdef CYGWIN |
| @@ -3024,7 +3024,8 @@ If there is no error, returns nil. */) | |||
| 3024 | return Qnil; | 3024 | return Qnil; |
| 3025 | #endif | 3025 | #endif |
| 3026 | 3026 | ||
| 3027 | if (faccessat (AT_FDCWD, SSDATA (encoded_filename), R_OK, AT_EACCESS) != 0) | 3027 | if (sys_faccessat (AT_FDCWD, SSDATA (encoded_filename), R_OK, |
| 3028 | AT_EACCESS) != 0) | ||
| 3028 | report_file_error (SSDATA (string), filename); | 3029 | report_file_error (SSDATA (string), filename); |
| 3029 | 3030 | ||
| 3030 | return Qnil; | 3031 | return Qnil; |
| @@ -3126,7 +3127,8 @@ file_directory_p (Lisp_Object file) | |||
| 3126 | { | 3127 | { |
| 3127 | #ifdef DOS_NT | 3128 | #ifdef DOS_NT |
| 3128 | /* This is cheaper than 'stat'. */ | 3129 | /* This is cheaper than 'stat'. */ |
| 3129 | bool retval = faccessat (AT_FDCWD, SSDATA (file), D_OK, AT_EACCESS) == 0; | 3130 | bool retval = sys_faccessat (AT_FDCWD, SSDATA (file), |
| 3131 | D_OK, AT_EACCESS) == 0; | ||
| 3130 | if (!retval && errno == EACCES) | 3132 | if (!retval && errno == EACCES) |
| 3131 | errno = ENOTDIR; /* like the non-DOS_NT branch below does */ | 3133 | errno = ENOTDIR; /* like the non-DOS_NT branch below does */ |
| 3132 | return retval; | 3134 | return retval; |
diff --git a/src/lisp.h b/src/lisp.h index f64a27ce113..6fda1e95503 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -5071,6 +5071,7 @@ extern int emacs_fstatat (int, char const *, void *, int); | |||
| 5071 | #ifdef HAVE_SYS_STAT_H | 5071 | #ifdef HAVE_SYS_STAT_H |
| 5072 | extern int sys_fstat (int, struct stat *); | 5072 | extern int sys_fstat (int, struct stat *); |
| 5073 | #endif | 5073 | #endif |
| 5074 | extern int sys_faccessat (int, const char *, int, int); | ||
| 5074 | #if !(defined HAVE_ANDROID && !defined ANDROID_STUBIFY) | 5075 | #if !(defined HAVE_ANDROID && !defined ANDROID_STUBIFY) |
| 5075 | extern int emacs_openat (int, char const *, int, int); | 5076 | extern int emacs_openat (int, char const *, int, int); |
| 5076 | #endif | 5077 | #endif |
diff --git a/src/lread.c b/src/lread.c index d585dece392..6abcea556bf 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -1964,8 +1964,8 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, | |||
| 1964 | fd = -1; | 1964 | fd = -1; |
| 1965 | if (INT_MAX < XFIXNAT (predicate)) | 1965 | if (INT_MAX < XFIXNAT (predicate)) |
| 1966 | last_errno = EINVAL; | 1966 | last_errno = EINVAL; |
| 1967 | else if (faccessat (AT_FDCWD, pfn, XFIXNAT (predicate), | 1967 | else if (sys_faccessat (AT_FDCWD, pfn, XFIXNAT (predicate), |
| 1968 | AT_EACCESS) | 1968 | AT_EACCESS) |
| 1969 | == 0) | 1969 | == 0) |
| 1970 | { | 1970 | { |
| 1971 | if (file_directory_p (encoded_fn)) | 1971 | if (file_directory_p (encoded_fn)) |
| @@ -1985,7 +1985,7 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, | |||
| 1985 | it. Only open the file when we are sure that it | 1985 | it. Only open the file when we are sure that it |
| 1986 | exists. */ | 1986 | exists. */ |
| 1987 | #ifdef WINDOWSNT | 1987 | #ifdef WINDOWSNT |
| 1988 | if (faccessat (AT_FDCWD, pfn, R_OK, AT_EACCESS)) | 1988 | if (sys_faccessat (AT_FDCWD, pfn, R_OK, AT_EACCESS)) |
| 1989 | fd = -1; | 1989 | fd = -1; |
| 1990 | else | 1990 | else |
| 1991 | #endif | 1991 | #endif |
diff --git a/src/process.c b/src/process.c index 651b5fa035b..9a8b0d7fd85 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -880,7 +880,8 @@ allocate_pty (char pty_name[PTY_NAME_SIZE]) | |||
| 880 | 880 | ||
| 881 | /* Check to make certain that both sides are available. | 881 | /* Check to make certain that both sides are available. |
| 882 | This avoids a nasty yet stupid bug in rlogins. */ | 882 | This avoids a nasty yet stupid bug in rlogins. */ |
| 883 | if (faccessat (AT_FDCWD, pty_name, R_OK | W_OK, AT_EACCESS) != 0) | 883 | if (sys_faccessat (AT_FDCWD, pty_name, |
| 884 | R_OK | W_OK, AT_EACCESS) != 0) | ||
| 884 | { | 885 | { |
| 885 | emacs_close (fd); | 886 | emacs_close (fd); |
| 886 | continue; | 887 | continue; |
diff --git a/src/sysdep.c b/src/sysdep.c index 4d89d4f25ae..ac26b12e9a5 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -2398,6 +2398,16 @@ sys_fstat (int fd, struct stat *statb) | |||
| 2398 | #endif | 2398 | #endif |
| 2399 | } | 2399 | } |
| 2400 | 2400 | ||
| 2401 | int | ||
| 2402 | sys_faccessat (int fd, const char *pathname, int mode, int flags) | ||
| 2403 | { | ||
| 2404 | #if !(defined HAVE_ANDROID && !defined ANDROID_STUBIFY) | ||
| 2405 | return faccessat (fd, pathname, mode, flags); | ||
| 2406 | #else | ||
| 2407 | return android_faccessat (fd, pathname, mode, flags); | ||
| 2408 | #endif | ||
| 2409 | } | ||
| 2410 | |||
| 2401 | /* Assuming the directory DIRFD, open FILE for Emacs use, | 2411 | /* Assuming the directory DIRFD, open FILE for Emacs use, |
| 2402 | using open flags OFLAGS and mode MODE. | 2412 | using open flags OFLAGS and mode MODE. |
| 2403 | Use binary I/O on systems that care about text vs binary I/O. | 2413 | Use binary I/O on systems that care about text vs binary I/O. |