It’s not worth the porting hassle, and as the glibc manual says,
“this function is generally a poor choice for processing strings”.
* admin/merge-gnulib (GNULIB_MODULES): Remove stpncpy.
* exec/configure.ac: Do not check for stpncpy.
* exec/exec.c (rpl_stpncpy, stpncpy): Remove this replacement.
(exec_0): Properly clear buffer1. Use memcpy instead of
stpncpy to add the trailing name. This code is clearly
still suboptimal but efficiency is not that important here
and I tried to minimize the change.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* exec/exec.h (struct exec_tracee): New field `new_child'.
Also, make `waiting_for_syscall' a bitfield.
* exec/trace.c (PTRACE_GETEVENTMSG): New declaration.
(MAX_TRACEES): Bump to 4096.
(handle_clone_prepare): New function.
(handle_clone): If required, set `new_child' and wait for a
ptrace event describing the parent to arrive.
(after_fork): Clear new field.
(exec_waitpid): Upon a ptrace event describing a clone, create
the child's tracee if it doesn't already exist. Otherwise, copy
over the parent's cmdline and start running it.
* doc/emacs/android.texi (Android Environment): Document lossage
with SIGSTOP.
* exec/exec.c (exec_0): Check X_OK on file being opened. Also
handle /proc/self/exe.
* exec/trace.c (check_signal): New function.
(handle_exec, process_system_call): Handle signal-delivery-stop
while waiting synchronously for syscall completion.
* exec/config.h.in: Autoheader.
* exec/configure.ac: Check for siginfo_t.si_syscall.
* exec/trace.c (exec_waitpid): If SIGSYS is received, and caused by
seccomp, drop it should the call number be the invalid system call
used by Emacs.
* exec/config.h.in: Autoheader.
* exec/configure.ac: Use system extensions.
(HAVE_PROCESS_VM): Define if process_vm_readv and
process_vm_writev are available.
* exec/trace.c (read_memory, user_copy): Implement in terms of
process_vm if possible.
* exec/config.h.in (__bool_true_false_are_defined):
* exec/configure.ac (REENTRANT): New definition.
(READLINKAT_SYSCALL, READLINK_SYSCALL): New defines. Set on all
hosts.
* exec/exec.c (MIN, MAX): Remove redundant declarations. Move
to config.h.
(exec_0): Copy name of executable into NAME when !REENTRANT.
* exec/exec.h (struct exec_tracee): New struct `exec_file'.
* exec/trace.c (remove_tracee, handle_exec, handle_readlinkat)
(process_system_call, after_fork): Handle readlinkat system
calls.
* exec/Makefile.in (.SUFFIXES): Include ., then `srcdir'.
* exec/loader-aarch64.s (_start):
* exec/loader-armeabi.s (_start):
* exec/loader-mips64el.s (__start):
* exec/loader-mipsel.s (__start):
* exec/loader-x86.s (_start):
* exec/loader-x86_64.s (_start): Get basename of opened exec
file and make it the command name. Fix envp skipping on x86
and various leaks.
* exec/config.h.in: Autoheader.
* exec/configure.ac: Check for declarations of stpcpy and
stpncpy.
* exec/exec.c (stpcpy, stpncpy): Use replacements if
declarations are not present; this happens when a new Android
NDK is building for an old version of Android.
* exec/config.h.in: Update config.h.in.
* exec/configure.ac: Check for stpcpy and stpncpy.
* exec/exec.c (rpl_stpcpy, rpl_stpncpy): Define replacements
when they are not present on the system.
(process_program_header): Fill comment.
* Makefile.in (extraclean): Clean in exec as well.
* configure.ac: Fix detection of absolute srcdir. Also, pass
CFLAGS.
* exec/Makefile.in: (.c.o): Add -I. so config.h can be
found.:(.s.o): Don't create m4 temporary in srcdir.
* exec/config-mips.m4.in (DADDI2, DADDI3): New macros. Define
to substitute if as cannot assemble daddi.
* exec/configure.ac (user_h): Look for user.h in asm/ as well.
Use new user.h. Also look in ptrace.h on arm systems. Check if
as supports daddi on mips64.
* exec/exec.c (check_interpreter): Fix char signedness bug.
* exec/loader-mips64el.s (__start): Use DADDI2 and DADDI3 for
two- and 3-operand daddi.
* exec/mipsel-user.h: Don't include sgidefs.h.
* java/INSTALL: Document that m4 is now required.
* src/android.c (android_rewrite_spawn_argv): Add missing NULL.
* doc/emacs/android.texi (Android Environment): Document
`android-use-exec-loader'.
* exec/exec1.c (main): Set program group of child process.
* src/android.c (android_rewrite_spawn_argv): New function.
* src/android.h: Update prototypes.
* src/androidfns.c (syms_of_androidfns): New variable
`android_use_exec_loader'.
* src/callproc.c (emacs_spawn): Rewrite the argument vector to
use exec1 if necessary.