mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-30 16:28:30 +00:00
Make improvements
- You can now run `make -j8 toolchain` on Windows - You can now run `make -j` on MacOS ARM64 and BSD OSes - You can now use our Emacs dev environment on MacOS/Windows - Fix bug where the x16 register was being corrupted by --ftrace - The programs under build/bootstrap/ are updated as fat binaries - The Makefile now explains how to download cosmocc-0.0.12 toolchain - The build scripts under bin/ now support "cosmo" branded toolchains - stat() now goes faster on Windows (shaves 100ms off `make` latency) - Code cleanup and added review on the Windows signal checking code - posix_spawnattr_setrlimit() now works around MacOS ARM64 bugs - Landlock Make now favors posix_spawn() on non-Linux/OpenBSD - posix_spawn() now has better --strace logging on Windows - fstatat() can now avoid EACCES in more cases on Windows - fchmod() can now change the readonly bit on Windows
This commit is contained in:
parent
06c6baaf50
commit
c9fecf3a55
109 changed files with 1188 additions and 454 deletions
|
@ -17,6 +17,7 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/assert.h"
|
||||
#include "libc/calls/createfileflags.internal.h"
|
||||
#include "libc/calls/internal.h"
|
||||
#include "libc/calls/state.internal.h"
|
||||
#include "libc/calls/struct/sigset.internal.h"
|
||||
|
@ -56,31 +57,31 @@ static textwindows int64_t sys_open_nt_impl(int dirfd, const char *path,
|
|||
// implement no follow flag
|
||||
// you can't open symlinks; use readlink
|
||||
// this flag only applies to the final path component
|
||||
// if O_NOFOLLOW_ANY is passed (-1 on NT) it'll be rejected later
|
||||
// if _O_NOFOLLOW_ANY is passed (-1 on NT) it'll be rejected later
|
||||
uint32_t fattr = GetFileAttributes(path16);
|
||||
if (flags & O_NOFOLLOW) {
|
||||
if (flags & _O_NOFOLLOW) {
|
||||
if (fattr != -1u && (fattr & kNtFileAttributeReparsePoint)) {
|
||||
return eloop();
|
||||
}
|
||||
flags &= ~O_NOFOLLOW; // don't actually pass this to win32
|
||||
flags &= ~_O_NOFOLLOW; // don't actually pass this to win32
|
||||
}
|
||||
|
||||
// handle some obvious cases while we have the attributes
|
||||
// we should ideally resolve symlinks ourself before doing this
|
||||
if (fattr != -1u) {
|
||||
if (fattr & kNtFileAttributeDirectory) {
|
||||
if ((flags & O_ACCMODE) != O_RDONLY || (flags & O_CREAT)) {
|
||||
if ((flags & O_ACCMODE) != O_RDONLY || (flags & _O_CREAT)) {
|
||||
// tried to open directory for writing. note that our
|
||||
// undocumented O_TMPFILE support on windows requires that a
|
||||
// undocumented _O_TMPFILE support on windows requires that a
|
||||
// filename be passed, rather than a directory like linux.
|
||||
return eisdir();
|
||||
}
|
||||
// on posix, the o_directory flag is an advisory safeguard that
|
||||
// isn't required. on windows, it's mandatory for opening a dir
|
||||
flags |= O_DIRECTORY;
|
||||
flags |= _O_DIRECTORY;
|
||||
} else if (!(fattr & kNtFileAttributeReparsePoint)) {
|
||||
// we know for certain file isn't a directory
|
||||
if (flags & O_DIRECTORY) {
|
||||
if (flags & _O_DIRECTORY) {
|
||||
return enotdir();
|
||||
}
|
||||
}
|
||||
|
@ -186,7 +187,7 @@ textwindows int sys_open_nt(int dirfd, const char *file, uint32_t flags,
|
|||
ssize_t rc;
|
||||
BLOCK_SIGNALS;
|
||||
__fds_lock();
|
||||
if (!(flags & O_CREAT)) mode = 0;
|
||||
if (!(flags & _O_CREAT)) mode = 0;
|
||||
if ((rc = fd = __reservefd_unlocked(-1)) != -1) {
|
||||
if (startswith(file, "/dev/")) {
|
||||
if (!strcmp(file + 5, "tty")) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue