mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 14:58:30 +00:00
finish intellisense support and sync with upstream
This commit is contained in:
commit
ec9bfd8c56
221 changed files with 2360 additions and 1439 deletions
|
@ -27,7 +27,6 @@ TOOL_BUILD_LIB_A_DIRECTDEPS = \
|
|||
LIBC_ALG \
|
||||
LIBC_BITS \
|
||||
LIBC_CALLS \
|
||||
LIBC_CALLS_HEFTY \
|
||||
LIBC_ELF \
|
||||
LIBC_FMT \
|
||||
LIBC_INTRIN \
|
||||
|
|
|
@ -8,6 +8,29 @@
|
|||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
struct ElfWriterSyms {
|
||||
size_t i, n;
|
||||
Elf64_Sym *p;
|
||||
};
|
||||
|
||||
enum ElfWriterSymOrder {
|
||||
kElfWriterSymSection,
|
||||
kElfWriterSymLocal,
|
||||
kElfWriterSymGlobal
|
||||
};
|
||||
|
||||
struct ElfWriterSymRef {
|
||||
int slg;
|
||||
uint32_t sym;
|
||||
};
|
||||
|
||||
struct ElfWriterRela {
|
||||
uint64_t offset;
|
||||
struct ElfWriterSymRef symkey;
|
||||
uint32_t type;
|
||||
int64_t addend;
|
||||
};
|
||||
|
||||
struct ElfWriter {
|
||||
char *path;
|
||||
char *tmppath;
|
||||
|
@ -22,25 +45,10 @@ struct ElfWriter {
|
|||
size_t i, n;
|
||||
Elf64_Shdr *p;
|
||||
} shdrs[1];
|
||||
struct ElfWriterSyms {
|
||||
size_t i, n;
|
||||
Elf64_Sym *p;
|
||||
} syms[3][1];
|
||||
struct ElfWriterSyms syms[3][1];
|
||||
struct {
|
||||
size_t i, j, n;
|
||||
struct ElfWriterRela {
|
||||
uint64_t offset;
|
||||
struct ElfWriterSymRef {
|
||||
enum ElfWriterSymOrder {
|
||||
kElfWriterSymSection,
|
||||
kElfWriterSymLocal,
|
||||
kElfWriterSymGlobal
|
||||
} slg;
|
||||
uint32_t sym;
|
||||
} symkey;
|
||||
uint32_t type;
|
||||
int64_t addend;
|
||||
} * p;
|
||||
struct ElfWriterRela * p;
|
||||
} relas[1];
|
||||
struct Interner *strtab;
|
||||
struct Interner *shstrtab;
|
||||
|
|
|
@ -4,21 +4,27 @@
|
|||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
struct MachineFdClosed {
|
||||
unsigned fd;
|
||||
struct MachineFdClosed *next;
|
||||
};
|
||||
|
||||
struct MachineFdCb {
|
||||
int (*close)(int);
|
||||
ssize_t (*readv)(int, const struct iovec *, int);
|
||||
ssize_t (*writev)(int, const struct iovec *, int);
|
||||
int (*ioctl)(int, uint64_t, void *);
|
||||
};
|
||||
|
||||
struct MachineFd {
|
||||
int fd;
|
||||
struct MachineFdCb * cb;
|
||||
};
|
||||
|
||||
struct MachineFds {
|
||||
size_t i, n;
|
||||
struct MachineFd {
|
||||
int fd;
|
||||
struct MachineFdCb {
|
||||
int (*close)(int);
|
||||
ssize_t (*readv)(int, const struct iovec *, int);
|
||||
ssize_t (*writev)(int, const struct iovec *, int);
|
||||
int (*ioctl)(int, uint64_t, void *);
|
||||
} * cb;
|
||||
} * p;
|
||||
struct MachineFdClosed {
|
||||
unsigned fd;
|
||||
struct MachineFdClosed *next;
|
||||
} * closed;
|
||||
struct MachineFd * p;
|
||||
struct MachineFdClosed * closed;
|
||||
};
|
||||
|
||||
int MachineFdAdd(struct MachineFds *);
|
||||
|
|
|
@ -3,17 +3,21 @@
|
|||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
struct JavadownTag {
|
||||
char *tag;
|
||||
char *text;
|
||||
};
|
||||
|
||||
struct JavadownTags {
|
||||
size_t n;
|
||||
struct JavadownTag * p;
|
||||
};
|
||||
|
||||
struct Javadown {
|
||||
bool isfileoverview;
|
||||
char *title;
|
||||
char *text;
|
||||
struct JavadownTags {
|
||||
size_t n;
|
||||
struct JavadownTag {
|
||||
char *tag;
|
||||
char *text;
|
||||
} * p;
|
||||
} tags;
|
||||
struct JavadownTags tags;
|
||||
};
|
||||
|
||||
struct Javadown *ParseJavadown(const char *, size_t);
|
||||
|
|
|
@ -3,16 +3,18 @@
|
|||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
struct ObjectArrayParam {
|
||||
size_t len;
|
||||
size_t size;
|
||||
void *pp;
|
||||
};
|
||||
|
||||
struct ObjectParam {
|
||||
size_t size;
|
||||
void *p;
|
||||
uint32_t *magic;
|
||||
int32_t *abi;
|
||||
struct ObjectArrayParam {
|
||||
size_t len;
|
||||
size_t size;
|
||||
void *pp;
|
||||
} * arrays;
|
||||
struct ObjectArrayParam * arrays;
|
||||
};
|
||||
|
||||
void PersistObject(const char *, size_t, const struct ObjectParam *);
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/internal.h"
|
||||
#include "libc/calls/ioctl.h"
|
||||
#include "libc/calls/struct/dirent.h"
|
||||
#include "libc/calls/struct/iovec.h"
|
||||
#include "libc/calls/struct/rusage.h"
|
||||
#include "libc/calls/struct/sigaction-linux.internal.h"
|
||||
|
@ -770,6 +771,30 @@ static ssize_t OpRead(struct Machine *m, int fd, int64_t addr, size_t size) {
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int OpGetdents(struct Machine *m, int dirfd, int64_t addr,
|
||||
uint32_t size) {
|
||||
int rc;
|
||||
DIR *dir;
|
||||
struct dirent *ent;
|
||||
if (size < sizeof(struct dirent)) return einval();
|
||||
if (0 <= dirfd && dirfd < m->fds.i) {
|
||||
if ((dir = fdopendir(m->fds.p[dirfd].fd))) {
|
||||
rc = 0;
|
||||
while (rc + sizeof(struct dirent) <= size) {
|
||||
if (!(ent = readdir(dir))) break;
|
||||
VirtualRecvWrite(m, addr + rc, ent, ent->d_reclen);
|
||||
rc += ent->d_reclen;
|
||||
}
|
||||
free(dir);
|
||||
} else {
|
||||
rc = -1;
|
||||
}
|
||||
} else {
|
||||
rc = ebadf();
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
static ssize_t OpPread(struct Machine *m, int fd, int64_t addr, size_t size,
|
||||
int64_t offset) {
|
||||
ssize_t rc;
|
||||
|
@ -1011,6 +1036,10 @@ static int OpMkdir(struct Machine *m, int64_t path, int mode) {
|
|||
return mkdir(LoadStr(m, path), mode);
|
||||
}
|
||||
|
||||
static int OpMkdirat(struct Machine *m, int dirfd, int64_t path, int mode) {
|
||||
return mkdirat(XlatAfd(m, dirfd), LoadStr(m, path), mode);
|
||||
}
|
||||
|
||||
static int OpMknod(struct Machine *m, int64_t path, uint32_t mode,
|
||||
uint64_t dev) {
|
||||
return mknod(LoadStr(m, path), mode, dev);
|
||||
|
@ -1024,10 +1053,20 @@ static int OpUnlink(struct Machine *m, int64_t path) {
|
|||
return unlink(LoadStr(m, path));
|
||||
}
|
||||
|
||||
static int OpUnlinkat(struct Machine *m, int dirfd, int64_t path, int flags) {
|
||||
return unlinkat(XlatAfd(m, dirfd), LoadStr(m, path), XlatAtf(flags));
|
||||
}
|
||||
|
||||
static int OpRename(struct Machine *m, int64_t src, int64_t dst) {
|
||||
return rename(LoadStr(m, src), LoadStr(m, dst));
|
||||
}
|
||||
|
||||
static int OpRenameat(struct Machine *m, int srcdirfd, int64_t src,
|
||||
int dstdirfd, int64_t dst) {
|
||||
return renameat(XlatAfd(m, srcdirfd), LoadStr(m, src), XlatAfd(m, dstdirfd),
|
||||
LoadStr(m, dst));
|
||||
}
|
||||
|
||||
static int OpTruncate(struct Machine *m, int64_t path, uint64_t length) {
|
||||
return truncate(LoadStr(m, path), length);
|
||||
}
|
||||
|
@ -1381,15 +1420,16 @@ void OpSyscall(struct Machine *m, uint32_t rde) {
|
|||
SYSCALL(0x09E, OpArchPrctl(m, di, si));
|
||||
SYSCALL(0x0BA, OpGetTid(m));
|
||||
SYSCALL(0x0CB, sched_setaffinity(di, si, P(dx)));
|
||||
SYSCALL(0x0D9, OpGetdents(m, di, si, dx));
|
||||
SYSCALL(0x0DD, OpFadvise(m, di, si, dx, r0));
|
||||
SYSCALL(0x0E4, OpClockGettime(m, di, si));
|
||||
SYSCALL(0x101, OpOpenat(m, di, si, dx, r0));
|
||||
SYSCALL(0x102, mkdirat(XlatAfd(m, di), P(si), dx));
|
||||
SYSCALL(0x102, OpMkdirat(m, di, si, dx));
|
||||
SYSCALL(0x104, fchownat(XlatAfd(m, di), P(si), dx, r0, XlatAtf(r8)));
|
||||
SYSCALL(0x105, futimesat(XlatAfd(m, di), P(si), P(dx)));
|
||||
SYSCALL(0x106, OpFstatat(m, di, si, dx, r0));
|
||||
SYSCALL(0x107, unlinkat(XlatAfd(m, di), P(si), XlatAtf(dx)));
|
||||
SYSCALL(0x108, renameat(XlatAfd(m, di), P(si), XlatAfd(m, dx), P(r0)));
|
||||
SYSCALL(0x107, OpUnlinkat(m, di, si, dx));
|
||||
SYSCALL(0x108, OpRenameat(m, di, si, dx, r0));
|
||||
SYSCALL(0x10D, OpFaccessat(m, di, si, dx, r0));
|
||||
SYSCALL(0x113, splice(di, P(si), dx, P(r0), r8, XlatAtf(r9)));
|
||||
SYSCALL(0x115, sync_file_range(di, si, dx, XlatAtf(r0)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue