mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-24 14:22:28 +00:00
Rewrite ZipOS
This reduces the virtual memory usage of Emacs for me by 30%. We now have a simpler implementation that uses read(), rather mmap()ing the whole executable.
This commit is contained in:
parent
ff77f2a6af
commit
b01282e23e
21 changed files with 408 additions and 421 deletions
|
@ -52,7 +52,7 @@ void *Worker(void *arg) {
|
|||
}
|
||||
|
||||
TEST(zipos, test) {
|
||||
int i, n = 16;
|
||||
int i, n = 20;
|
||||
pthread_t *t = gc(malloc(sizeof(pthread_t) * n));
|
||||
for (i = 0; i < n; ++i) {
|
||||
ASSERT_SYS(0, 0, pthread_create(t + i, 0, Worker, 0));
|
||||
|
@ -86,6 +86,14 @@ TEST(zipos, readPastEof) {
|
|||
EXPECT_SYS(0, 0, close(3));
|
||||
}
|
||||
|
||||
TEST(zipos, simple) {
|
||||
char buf[31] = {0};
|
||||
ASSERT_SYS(0, 3, open("/zip/libc/testlib/hyperion.txt", O_RDONLY));
|
||||
ASSERT_SYS(0, 30, read(3, buf, 30));
|
||||
ASSERT_STREQ("The fall of Hyperion - a Dream", buf);
|
||||
ASSERT_SYS(0, 0, close(3));
|
||||
}
|
||||
|
||||
TEST(zipos_O_DIRECTORY, blocksOpeningOfNormalFiles) {
|
||||
ASSERT_SYS(ENOTDIR, -1,
|
||||
open("/zip/libc/testlib/hyperion.txt", O_RDONLY | O_DIRECTORY));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue