Commit Graph

12 Commits

Author SHA1 Message Date
Dan Gohman
cf366c06d1 Optimize lseek in the tell case.
`lseek(x, 0, SEEK_CUR)` has no effect other than to return the current
file offset. The patch here uses a macro with `__builtin_constant_p` to
recognize this case and rewrite it to a library call that uses `fd_tell`
rather than `fd_seek`, so that programs that don't need actual seeking
don't end up importing `fd_seek`.

This is also the first usage of `__wasi_fd_tell` in WASI libc, so this
adds it to undefined-symbols.txt.
2019-04-30 16:19:05 -07:00
Dan Gohman
401012952d Declare getentropy in <sys/random.h>
Some systems, such as Darwin, only declare getentropy in <sys/random.h>,
so declare it there on WASI too for compatibility.

Also, give getentropy the underscore-prefix/weak-symbol treatment, as
it's not a standard-reserved identifier.
2019-04-30 16:07:49 -07:00
Dan Gohman
1cbedc6d7e Implement FD_SET, FD_CLR, etc.
Previously, FD_SET and friends were missing their actual definitions.
This provides definitions, entirely within the system headers in a
way that doesn't need instantiated out-of-line definitions.
2019-04-23 15:01:23 -07:00
Dan Gohman
538937e2c8 Remove capsicum.h; WASI libc doesn't support that API, even internally. 2019-04-23 15:01:05 -07:00
Dan Gohman
49f1a57cb8 Declare getrusage.
It's defined publicly in libc, so publicly declare it too.
2019-04-22 11:41:40 -07:00
Dan Gohman
1cc98f27f5 Update to cloudlibc 8835639f27fc42d32096d59d294a0bbb857dc368.
There's no functional change here; the only change is the patch I
submitted upstream, so we can remove some local changes.
2019-04-15 09:49:02 -07:00
Dan Gohman
65107e782f Rename README to README.md. 2019-04-15 09:47:16 -07:00
Dan Gohman
e18d69c801 Remove socket.c, which was a stub that always failed with ENOSYS. 2019-04-15 09:47:16 -07:00
Dan Gohman
ab594e4d51 Use the same indentation style as surrounding code. 2019-04-15 09:47:16 -07:00
Dan Gohman
7ba6adfc61 Fix miscellaneous lint warnings. 2019-04-15 09:47:16 -07:00
Dan Gohman
685d014446
Provide a public interface to preopened directory lookups. (#10)
* Provide a public interface to preopened directory lookups.

For users of especially non-C compilers, provide an API for looking up
preopened directories. This is used internally in WASI libc to translate
from eg. `open` to `openat`, but it can now also be used by user code.
2019-04-05 06:30:30 -07:00
Dan Gohman
320054e84f WASI libc prototype implementation.
This incoporates pieces from musl-libc, cloudlibc, cloudabi, libpreopen,
and dlmalloc, as well as a significant amount of new code.
2019-03-27 07:59:55 -07:00