Bump support up to FreeBSD 13 and NetBSD 9.2

These releases are really exciting since they contained the patches we
worked to get upstreamed. It means that their /bin/sh interpreters all
work fine with Actually Portable Executable now.
This commit is contained in:
Justine Tunney 2022-06-11 09:27:14 -07:00
parent 1ae6cfc198
commit e96aceae41
14 changed files with 512 additions and 11 deletions

View file

@ -22,6 +22,7 @@
#include "libc/calls/syscall-sysv.internal.h"
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/intrin/kprintf.h"
#include "libc/mem/alloca.h"
#include "libc/paths.h"
#include "libc/runtime/runtime.h"
@ -81,11 +82,7 @@ int sys_execve(const char *prog, char *const argv[], char *const envp[]) {
shargs[2] = prog;
memcpy(shargs + 3, argv, (i + 1) * sizeof(char *));
} else if (CanExecute(prog)) {
if (IsFreebsd() || IsNetbsd()) {
shargs[0] = firstnonnull(commandv("bash", buf, PATH_MAX), _PATH_BSHELL);
} else {
shargs[0] = _PATH_BSHELL;
}
shargs[0] = _PATH_BSHELL;
shargs[1] = prog;
memcpy(shargs + 2, argv + 1, i * sizeof(char *));
} else {

View file

@ -96,6 +96,7 @@ static textwindows bool IsDirectorySymlink(const char16_t *path) {
static textwindows int sys_rmdir_nt(const char16_t *path) {
int e, ms;
e = errno;
for (ms = 1;; ms *= 2) {
if (RemoveDirectory(path)) {
return 0;
@ -108,6 +109,7 @@ static textwindows int sys_rmdir_nt(const char16_t *path) {
* Never could have imagined it'd be this bad.
*/
if (GetLastError() == kNtErrorDirNotEmpty && ms <= 2048) {
errno = e;
Sleep(ms);
continue;
} else {

View file

@ -19,7 +19,7 @@
#include "libc/macros.internal.h"
.text.startup
// Seventeen byte decompressor.
// Thirteen byte decompressor.
//
// @param di points to output buffer
// @param si points to uint8_t {len₁,byte₁}, ..., {0,0}
@ -32,8 +32,7 @@ rldecode:
xchg %al,%cl
lodsb
jrcxz 2f
1: stosb
.loop 1b
rep stosb
jmp 0b
2: .leafepilogue
.endfn rldecode,globl