Release pledge.com v1.1

This change fixes bugs, adds more system calls, and improves
compatibility with OpenBSD. Going forward, versions on the web will be
pinned to a permanent version. There were many other changes over the
last week which also improved this new release.
This commit is contained in:
Justine Tunney 2022-07-22 13:44:00 -07:00
parent b5904947e9
commit 76d2f68c91
34 changed files with 164 additions and 89 deletions

View file

@ -0,0 +1,16 @@
#ifndef COSMOPOLITAN_LIBC_CALLS_STRUCT_UTSNAME_NETBSD_INTERNAL_H_
#define COSMOPOLITAN_LIBC_CALLS_STRUCT_UTSNAME_NETBSD_INTERNAL_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
struct utsname_netbsd {
char sysname[256]; /* name of os */
char nodename[256]; /* name of network node */
char release[256]; /* release level */
char version[256]; /* version level */
char machine[256]; /* hardware type */
};
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_CALLS_STRUCT_UTSNAME_NETBSD_INTERNAL_H_ */

View file

@ -96,7 +96,7 @@ i32 sys_sync_file_range(i32, i64, i64, u32) hidden;
i32 sys_tgkill(i32, i32, i32) hidden;
i32 sys_tkill(i32, i32, void *) hidden;
i32 sys_truncate(const char *, u64, u64) hidden;
i32 sys_uname(char *) hidden;
i32 sys_uname(void *) hidden;
i32 sys_unlinkat(i32, const char *, i32) hidden;
i32 sys_unveil(const char *, const char *) hidden;
i64 sys_copy_file_range(i32, long *, i32, long *, u64, u32) hidden;

View file

@ -32,7 +32,7 @@
int touch(const char *file, uint32_t mode) {
int rc, fd, olderr;
olderr = errno;
if ((rc = utimes(file, NULL)) == -1 && errno == ENOENT) {
if ((rc = utimes(file, 0)) == -1 && errno == ENOENT) {
errno = olderr;
if ((fd = open(file, O_CREAT | O_WRONLY, mode)) == -1) return -1;
return close(fd);

View file

@ -19,6 +19,7 @@
#include "libc/bits/weaken.h"
#include "libc/calls/calls.h"
#include "libc/calls/strace.internal.h"
#include "libc/calls/struct/utsname-netbsd.internal.h"
#include "libc/calls/struct/utsname.h"
#include "libc/calls/syscall-sysv.internal.h"
#include "libc/calls/syscall_support-sysv.internal.h"
@ -52,14 +53,14 @@ int uname(struct utsname *lool) {
int rc;
char *out, *p;
size_t i, j, len;
char tmp[sizeof(struct utsname)];
if (!lool) return efault();
if (!lool || (IsAsan() && !__asan_is_valid(lool, sizeof(*lool)))) {
rc = efault();
} else {
bzero(tmp, sizeof(tmp));
if (!IsWindows()) {
if (IsLinux() || IsFreebsd()) {
char tmp[sizeof(struct utsname)];
bzero(tmp, sizeof(tmp));
if ((rc = sys_uname(tmp)) != -1) {
out = (char *)lool;
for (i = j = 0;;) {