Commit Graph

1971 Commits

Author SHA1 Message Date
Andrew Kelley
d2a4e5e226
Merge pull request #5749 from kubkon/wasi-notcapable
[libstd]: handle ENOTCAPABLE in WASI
2020-07-01 23:12:26 +00:00
Alexandros Naskos
30ae7f7573 Corrected default value field initialization in std.zeroInit 2020-07-01 23:09:08 +00:00
Jakub Konka
8306826d53 Map ENOTCAPABLE into error.AccessDenied instead of error.NotCapable
This is direct result of review comments left by andrewrk and
daurnimator. It makes sense to map `ENOTCAPABLE` into a more generic
`error.AccessDenied`.
2020-06-30 18:21:38 +02:00
Jakub Konka
5bc99dd7e8 Fix more compilation errors 2020-06-29 21:42:11 +02:00
Jakub Konka
b96882c57a Fix compilation errors 2020-06-29 18:09:22 +02:00
Jakub Konka
bf8bf528c6 Handle ENOTCAPABLE in WASI
This commit adds `error.NotCapable` enum value and makes sure that
every applicable WASI syscall that can return `ENOTCAPABLE` errno
remaps it to `error.NotCapable.
2020-06-29 17:10:01 +02:00
Jonathan Marler
67e97a1f0f ArenaAllocator: use full capacity 2020-06-29 05:12:30 -04:00
Jonathan Marler
35e8876c23 Revert "arena_allocator: refactor and use full capacity"
This reverts commit e120b07a52.
2020-06-29 05:12:30 -04:00
Jonathan Marler
e120b07a52 arena_allocator: refactor and use full capacity 2020-06-28 18:40:15 -04:00
Jonathan Marler
c2eead9629 Fix issue 5741, use after free 2020-06-28 18:05:18 -04:00
Jonathan Marler
374e3e42e0 WasmPageAllocator: fix bug not aligning allocations 2020-06-28 14:25:39 -04:00
Andrew Kelley
581d16154b
Merge pull request #5696 from alexnask/async_call_tuple
@asyncCall now takes arguments as a tuple instead of varargs
2020-06-28 01:00:58 -04:00
Andrew Kelley
0cfe8e5d6f
Merge pull request #5064 from marler8997/newAllocator
new allocator interface
2020-06-27 18:21:00 -04:00
Jonathan Marler
a728436992 new allocator interface after Andrew Kelley review 2020-06-27 08:57:35 -06:00
Ryan Liptak
626b5eccab Move fs-specific tests from os/test.zig to fs/test.zig
The moved tests do not use `std.os` directly and instead use `std.fs` functions, so it makes more sense for them to be in `fs/test.zig`
2020-06-27 10:17:08 +00:00
Jonathan Marler
dc9648f868 new allocator interface 2020-06-26 13:34:48 -06:00
Andrew Kelley
e820678ca1
Merge pull request #5588 from tgschultz/leb128-output
LEB128 overhaul and output
2020-06-25 19:10:31 -04:00
Andrew Kelley
061c8be049
Merge pull request #5684 from squeek502/fs-file-dir-ops
Add tests for using directory operations on files
2020-06-25 19:08:30 -04:00
data-man
77bb2dc094 Use writer in benchmarks 2020-06-25 19:07:25 -04:00
Ryan Liptak
dcdbb7006c Add tests for using directory operations on files 2020-06-25 03:49:58 -07:00
Ryan Liptak
f50ed94174 Windows: Fix fs.Dir.openDir not handling STATUS_NOT_A_DIRECTORY
Now correctly returns error.NotDir
2020-06-25 03:49:58 -07:00
Andrew Kelley
41c6cc9001
Merge pull request #5677 from kubkon/fstatat
[libstd]: implement fstatat in WASI plus fix on macOS
2020-06-25 00:01:38 -04:00
Andrew Kelley
d337469e44
Merge pull request #5583 from ziglang/zig-ast-to-zir
self-hosted: hook up Zig AST to ZIR
2020-06-24 22:37:58 -04:00
Code Hz
7875649c24 Pdb.openFile use []const u8 instead of []u8 2020-06-24 22:27:30 -04:00
Andrew Kelley
20b4a2cf2c self-hosted: add compare output test for new AST->ZIR code 2020-06-24 21:28:42 -04:00
Andrew Kelley
e42b7702eb Merge remote-tracking branch 'origin/master' into zig-ast-to-zir 2020-06-24 15:36:59 -04:00
Jakub Konka
d40e367b73 Reformat using if-else where appropriate 2020-06-24 21:00:21 +02:00
Jakub Konka
c63b23d684 Use fstatat on macOS (otherwise uses 32bit) 2020-06-24 21:00:21 +02:00
Jakub Konka
be78b7b648 Implement fstatat targeting WASI
Also, add more informative `@compileError` in a few `std.os` functions
that would otherwise yield a cryptic compile error when targeting
WASI. Finally, enhance docs in a few places and add test case for
`fstatat`.
2020-06-24 21:00:21 +02:00
Alexandros Naskos
50b70bd77f @asyncCall now requires an argument tuple 2020-06-24 14:07:39 +03:00
Jakub Konka
5fed725e0a
Remove some leftover debugging checks 2020-06-23 23:59:32 +02:00
Jakub Konka
66e5205047 Refactor PreopenList.find()
This commit generalizes `std.fs.wasi.PreopenList.find(...)` allowing
search by `std.fs.wasi.PreopenType` union type rather than by dir
name. In the future releases of WASI, it is expected to have more
preopen types (or capabilities) than just directories. This commit
aligns itself with that vision.

This is a potentially breaking change. However, since `std.fs.wasi.PreopenList`
wasn't made part of any Zig release yet, I think we should be OK
to introduce those changes without pointing to any deprecations.
2020-06-23 21:54:36 +02:00
Andrew Kelley
6938245fcc Merge remote-tracking branch 'origin/master' into zig-ast-to-zir 2020-06-22 23:22:17 -04:00
Andrew Kelley
78c6d39cd4
Merge pull request #5667 from cartr/windows-arguments-unclosed-quote
In std.process.ArgIteratorWindows, don't treat unclosed quotes like they're escaped
2020-06-22 20:07:43 -04:00
Jakub Konka
923c0feda1 Add std.fs.File.readAllAlloc tests
This commit adds some unit tests for `std.fs.File.readAllAlloc`
function. It also updates the docs of `Reader.readNoEof`
which were outdated, and swaps `inStream()` for  `reader()` in
`File.readAllAlloc` with the former being deprecated.
2020-06-22 20:03:21 -04:00
Andrew Kelley
6ff6ac866d
Merge pull request #5666 from kubkon/symlinkat-readlinkat
[libstd]: enhance std.os.{symlinkat, readlinkat} coverage
2020-06-22 20:02:27 -04:00
Andrew Kelley
44bd0a2670
Merge pull request #5662 from shtanton/meta-cast
Adds std.meta.cast and uses it to simplify translate-c
2020-06-22 19:54:30 -04:00
prime31
65ef74e2cd
try allocation of pointer type when parsing (#5665)
* `try` allocation of pointer type when parsing

* fixes pointer destroy compile error
2020-06-22 17:30:02 +03:00
Carter Sande
7cb41a415a ArgIteratorWindows: simplify quote state tracking 2020-06-22 03:03:30 -07:00
Carter Sande
8faa85ac19 ArgIteratorWindows: don't treat unclosed quotes like they're escaped 2020-06-22 03:03:20 -07:00
Jakub Konka
c950f0c6c3 Enhance std.os.readlinkat coverage
Adds Windows stub (still needs to be implemented on Windows),
adds WASI implementation, adds unit test testing basic chain of
ops: create file -> symlink -> readlink.
2020-06-22 09:40:06 +02:00
Jakub Konka
64078ca924 Enhance std.os.symlinkat coverage
Fixes `std.os.symlinkat` compile errors, adds Windows stub (still
needs to be implemented), adds WASI implementation.
2020-06-22 09:14:51 +02:00
Charlie Stanton
8c15cfe3da Compacts switch statements and string literal 2020-06-21 21:48:12 +01:00
Charlie Stanton
6f47513009 Adds std.meta.cast and uses it to simplify translate-c 2020-06-21 18:24:59 +01:00
Nameless
56220449ab Add errors to windows.WSAStartup and WSACleanup 2020-06-21 00:13:06 -04:00
Andrew Kelley
faf783e595 implement new stat functionality for WASI 2020-06-20 22:09:47 -04:00
Andrew Kelley
225f196842 std.fs: fix shadowing stat with a local variable 2020-06-20 20:43:56 -04:00
Andrew Kelley
0a9672fb86 rework zig fmt to avoid unnecessary realpath() calls
* add `std.fs.Dir.stat`
 * zig fmt checks for sym link loops using inodes instead of using
   realpath
2020-06-20 19:46:14 -04:00
Andrew Kelley
da549a72e1 zig fmt 2020-06-20 18:39:15 -04:00
Andrew Kelley
d87cd06296 rework zig fmt to use less syscalls and open fds
* `std.fs.Dir.Entry.Kind` is moved to `std.fs.File.Kind`
 * `std.fs.File.Stat` gains the `kind` field, so performing a stat() on
   a File now tells what kind of file it is. On Windows this only will
   distinguish between directories and files.
 * rework zig fmt logic so that in the case of opening a file and
   discovering it to be a directory, it closes the file descriptor
   before re-opening it with O_DIRECTORY, using fewer simultaneous open
   file descriptors when walking a directory tree.
 * rework zig fmt logic so that it pays attention to the kind of
   directory entries, and when it sees a sub-directory it attempts to
   open it as a directory rather than a file, reducing the number of
   open() syscalls when walking a directory tree.
2020-06-20 18:27:37 -04:00