diff --git a/desktop/posix.cpp b/desktop/posix.cpp index 4ecf76c..c4a101f 100644 --- a/desktop/posix.cpp +++ b/desktop/posix.cpp @@ -419,6 +419,20 @@ long EsPOSIXSystemCall(long n, long a1, long a2, long a3, long a4, long a5, long } } break; + case SYS_faccessat: { + if (*(char *) a2 == '/') { + // We don't support file permissions yet, so just check the file exists. + int fd = EsPOSIXSystemCall(SYS_open, a2, O_PATH, 0, 0, 0, 0); + if (fd < 0) returnValue = fd; + else { + returnValue = 0; + EsPOSIXSystemCall(SYS_close, fd, 0, 0, 0, 0, 0); + } + } else { + EsPanic("Unsupported relative faccessat.\n"); + } + } break; + case SYS_lstat: case SYS_stat: { int fd = EsPOSIXSystemCall(SYS_open, a1, O_PATH, 0, 0, 0, 0); diff --git a/kernel/posix.cpp b/kernel/posix.cpp index 989eb28..058507a 100644 --- a/kernel/posix.cpp +++ b/kernel/posix.cpp @@ -118,7 +118,7 @@ namespace POSIX { } intptr_t Write(POSIXFile *file, K_USER_BUFFER void *base, size_t length, bool baseMappedToFile) { - if (file->posixFlags & O_APPEND) { + if ((file->posixFlags & O_APPEND) && file->type == POSIX_FILE_NORMAL) { // TODO Make this atomic. file->offsetIntoFile = file->node->directoryEntry->totalSize; } @@ -241,7 +241,7 @@ namespace POSIX { const char *devZero = "/dev/zero"; const char *devNull = "/dev/null"; - // EsPrint("Open: %s, %x\n", pathLength, path, flags); + EsPrint("Open: %s, %x\n", pathLength, path, flags); if ((EsCStringLength(devZero) == pathLength && 0 == EsMemoryCompare(path, devZero, pathLength))) { file->type = POSIX_FILE_ZERO; @@ -329,6 +329,14 @@ namespace POSIX { handleTable->ModifyFlags(syscall.arguments[0], syscall.arguments[2]); } else if (syscall.arguments[1] == F_GETFL) { return file->posixFlags; + } else if (syscall.arguments[1] == F_SETFL) { + if (syscall.arguments[2] == O_APPEND) { + file->posixFlags |= O_APPEND; + } else if (syscall.arguments[2] == 0) { + file->posixFlags &= ~O_APPEND; + } else { + KernelPanic("POSIX::DoSyscall - Unimplemented F_SETFL %d.\n", syscall.arguments[2]); + } } else if (syscall.arguments[1] == F_DUPFD) { // Duplicate with FD_CLOEXEC clear. OpenHandleToObject(file, KERNEL_OBJECT_POSIX_FD, 0); diff --git a/util/build.c b/util/build.c index 4b7c2a6..dd4e113 100644 --- a/util/build.c +++ b/util/build.c @@ -55,7 +55,6 @@ bool foundValidCrossCompiler; bool coloredOutput; bool encounteredErrors; bool interactiveMode; -bool canBuildLuigi; volatile int emulatorTimeout; volatile bool emulatorDidTimeout; #ifdef __linux__ @@ -2030,9 +2029,6 @@ int main(int _argc, char **_argv) { printf("Enter 'help' to get a list of commands.\n"); char *prev = NULL; - canBuildLuigi = !CallSystem("gcc -o bin/luigi.h.gch util/luigi.h -D UI_IMPLEMENTATION -D UI_LINUX 2> /dev/null"); - unlink("bin/luigi.h.gch"); - while (true) { char *l = NULL; size_t pos = 0;