Marcin Mielniczuk
f07392c175
Quick fix for path_filestat_set_times. Closes #95 .
2019-09-11 15:01:01 -07:00
Dan Gohman
e85376ec07
Add doc comments to WasiCtxBuilder's methods.
2019-09-11 11:33:37 +02:00
Dan Gohman
c1c74ca54b
Add a method for inhering the command-line arguments from the host.
2019-09-11 11:05:29 +02:00
Dan Gohman
aea2f11f06
Mark WasiCtx's internals as pub(crate).
2019-09-11 10:39:02 +02:00
Dan Gohman
52b69c21cf
Miscellaneous clippy fixes.
2019-09-09 18:07:39 +02:00
Dan Gohman
39161d020f
Clippy: use from functions rather than as casts.
...
`as` is a many-faceted conversion operator, while `from` functions only do
lossless conversions.
2019-09-09 18:07:39 +02:00
Dan Gohman
09ace35295
Clippy: use ptr::add rather than ptr::offset.
2019-09-09 18:07:39 +02:00
Jakub Konka
33c78e2e5b
Fix formatting
2019-09-09 11:26:06 +02:00
Marcin Mielniczuk
612617b0ba
reuse the host::* consts in enum Error
2019-09-09 11:26:06 +02:00
Marcin Mielniczuk
c5339d01cf
refactor errno_from_ioerror
2019-09-09 11:26:06 +02:00
Marcin Mielniczuk
ae836df42d
reformat
2019-09-09 11:26:06 +02:00
Marcin Mielniczuk
57c19cf073
fixes
2019-09-09 11:26:06 +02:00
Marcin Mielniczuk
438c693508
Impl Fail
2019-09-09 11:26:06 +02:00
Marcin Mielniczuk
3fd0cdcc12
Cleanup
2019-09-09 11:26:06 +02:00
Marcin Mielniczuk
b09f7e860f
Refactor try_from and try_into error handing.
2019-09-09 11:26:06 +02:00
Marcin Mielniczuk
14aaffd46f
Initial error refactor
2019-09-09 11:26:06 +02:00
Marcin Mielniczuk
85a41d449c
Treat FIFOs' type as __WASI_FILETYPE_UNKNOWN.
2019-09-06 20:38:50 -07:00
Marcin Mielniczuk
d308c47822
Add a no-op implementation of fd_advise on Windows
...
Windows apparently has no similar syscall available.
2019-09-06 18:06:51 -07:00
Marcin Mielniczuk
947eb1fb53
Move fd_advise on Linux to nix
2019-08-30 15:53:07 +02:00
Jakub Konka
3609a82dc9
Fix incorrect fd_readdir behaviour
...
* when executed twice in a row, need to manually reset the stream
by calling seekdir with __WASI_DIRCOOKIE_START, if __WASI_DIRCOOKIE_START
was specified
* fix mapping between d_type and __wasi_filetype_t
* include minor refactor - removes use of wasm32 module on the
host's side
2019-08-28 22:01:24 +02:00
Marcin Mielniczuk
417ec0be01
Update src/sys/windows/hostcalls_impl/fs.rs
...
Co-Authored-By: Jakub Konka <kubkon@jakubkonka.com >
2019-08-26 15:49:48 +02:00
Marcin Mielniczuk
d617fe67ad
Check for socket type in filetype.
...
The signature for Windows has also been changed, so that the function
can be reused in cross-platform modules.
2019-08-26 15:49:48 +02:00
Marcin Mielniczuk
9950bddee5
Use safe casts in path_filestat_set_times on unix.
2019-08-23 13:02:21 +02:00
Sendil Kumar
69d60c4711
update nix version
2019-08-23 09:24:38 +02:00
Marcin Mielniczuk
1bf5106f40
Implement path_filestat_get & path_filestat_set_times on Windows.
2019-08-21 13:20:40 +02:00
Marcin Mielniczuk
2ed69b1d10
Add .concatenate() method to PathGet on Windows.
2019-08-21 13:20:40 +02:00
Jakub Konka
cf0bef84cc
Fix filestat_from_nix conversion fn
2019-08-20 23:38:53 -07:00
Marcin Mielniczuk
065fbea252
Implement path_filestat_set_times using nix instead of libc.
...
As advised in #16 .
2019-08-20 17:28:25 +02:00
Dan Gohman
05852977ac
Use char/byte literals instead of single-char/byte string literals.
2019-08-14 12:59:00 +02:00
Jakub Konka
b14570e887
Move checks into error handling of std::fs::rename (where possible)
2019-08-14 12:10:34 +02:00
Jakub Konka
1b7d9bed2b
Implement path_rename on Windows
2019-08-14 12:10:34 +02:00
Jakub Konka
5c7373959c
Fix linter warnings
2019-08-13 21:34:35 +02:00
Marcin Mielniczuk
74d1c11fbe
Fix fd_filestat_set_times and enable the fd_filestat_set test on Windows.
2019-08-13 21:34:35 +02:00
Marcin Mielniczuk
2f1afc4846
Implement fd_filestat_set_times using the filetime crate.
2019-08-13 21:34:35 +02:00
Marcin Mielniczuk
4c9be5909a
Add an overflow check
...
The check will be removed when rust-lang/rust#63326 is fixed
2019-08-08 18:41:41 +02:00
Marcin Mielniczuk
e731965fbb
Implement fd_filestat_set_size using libstd
2019-08-08 18:41:41 +02:00
Marcin Mielniczuk
92c2b563fc
Reuse errno_from_ioerror to simplify error handling
2019-08-08 18:22:58 +02:00
Jakub Konka
e18175c556
path_get refactor and implementation of missing path_ hostcalls on Windows ( #41 )
...
* Move path_get outside of sys module
* Add implementation of readlinkat
* Clean up path_open; use OpenOptions as much as possible
* Enable close_preopen test
* Implement path_create_directory; fix path_open
* Refactor path concatenation onto a descriptor
* Implement path_remove_directory
* Implement path_unlink_file
* Rewrite path_open using specific access mask
* Fix error mapping when unlinking file
* Fix readlinkat to pass nofollow_errors testcase
* Clean up winerror to WASI conversion
* Spoof creating dangling symlinks on windows (hacky!)
* Add positive testcase for readlink
* Implement path_readlink (for nonzero buffers for now)
* Clean up
* Add Symlink struct immitating *nix symlink
* Fix path_readlink
* Augment interesting_paths testcase with trailing slashes example
* Encapsulate path_get return value as PathGet struct
* Remove dangling symlink emulation
* Extract dangling symlinks into its own testcase
This way, we can re-enable nofollow_errors testcase
on Windows also.
* Return __WASI_ENOTCAPABLE if user lacks perms to symlink
2019-08-08 17:06:01 +02:00
Jakub Konka
8ea7a983d8
Make fd_write unbuffered; fixes CraneStation/wasmtime#255
2019-08-07 04:44:48 -07:00
Marcin Mielniczuk
89fbde2c3f
Implement fd_filestat_get for all platforms ( #42 )
...
* Implement fd_filestat_get for all platforms
* Remove an old comment
* Remove panics from the syscall wrappers
* Return WASI error type
* Reuse Metadata if possible to save syscalls.
* Refactor the change for two separate fd_filestat_get_impl
* Refactor error handling
2019-07-26 19:15:29 +02:00
Marcin Mielniczuk
696eee22b2
Mark all functions in host_impl.rs as pub(crate)
...
It will allow the compiler to spot more unused functions.
2019-07-26 09:02:01 +02:00
Jakub Konka
86ae6e3df4
Refactor hostcalls_impl in sys module
2019-07-23 15:02:23 -07:00
Jakub Konka
7f0219e6d0
Move hostcalls impl into separate module
2019-07-23 15:02:23 -07:00
Jakub Konka
c4704ba573
Fix error mapping for fd_seek on Windows
2019-07-22 16:05:30 -07:00
Jakub Konka
919262b5b9
Make fd_tell host independent
2019-07-22 16:05:30 -07:00
Jakub Konka
5bbf59e1c5
Make fd_seek host independent
2019-07-22 16:05:30 -07:00
Jakub Konka
0d571a4e6d
Move extracting fds from context into hostcalls
2019-07-22 15:56:46 -07:00
Jakub Konka
14391bab56
Clean up more hostcalls
2019-07-22 15:56:46 -07:00
Jakub Konka
13823e2b39
Clean up fd_renumber
2019-07-22 15:56:46 -07:00
Jakub Konka
310ecb5b5b
Create helper Result<T> type
2019-07-22 15:56:46 -07:00