74 Commits

Author SHA1 Message Date
Andrew Kelley
6096dc5f94
move some of the installation from cmake to zig build
This moves the installation of shipped source files from large
CMakeLists.txt lists to zig build recursive directory installation.

On my computer a cmake `make install` takes 2.4 seconds even when it has
to do nothing, and prints a lot of unnecessary lines to stdout that say
"up-to-date: [some file it is installing]".

After this commit, the default output of `make` is down to 1
second, and it does not print any junk to stdout. Further, a `make
install` is no longer required and `make` is sufficient.

This closes #2874.

It also closes #2585. `make` now always invokes `zig build` for
installing files and libuserland.a, and zig's own caching system makes
that go fast.
2019-07-15 01:45:26 -04:00
Andrew Kelley
fc9e28ea37
std.os.getrandom does a libc version check
closes #397
2019-07-08 14:42:28 -04:00
daurnimator
111e5ed0a2
std: MAP_FAILED is a libc concept on linux 2019-07-07 17:15:30 +10:00
Andrew Kelley
0d84d52e37
std.os.abort no longer calls msvcrt abort() when linking libc
closes #2071
2019-07-05 12:53:36 -04:00
Andrew Kelley
1a1598c58c
stack traces on segfault by default for linux-x86_64
closes #2355
2019-07-02 13:41:16 -04:00
Andrew Kelley
b735764898
different array literal syntax when inferring the size
old syntax:  []i32{1, 2, 3}
new syntax: [_]i32{1, 2, 3}

closes #1797
2019-06-09 19:26:32 -04:00
Andrew Kelley
7eb82b8651
std.os.mmap: update doc comments for previous commits 2019-06-04 12:31:20 -04:00
LemonBoy
46cbed621b Move dl_iterate_phdr to os.zig 2019-05-31 11:59:53 +02:00
LemonBoy
4b30e40a91 Remove length restriction in mmap wrapper 2019-05-31 11:48:42 +02:00
LemonBoy
477ee9c8b9 Fix some syscalls on arm64 2019-05-30 16:28:33 +02:00
Andrew Kelley
c66a747045
Merge pull request #2546 from LemonBoy/sigaltstack
Add sigaltstack syscall for Linux
2019-05-29 19:38:01 -04:00
Andrew Kelley
bfc86776d5
run zig fmt to update use to usingnamespace 2019-05-29 19:09:58 -04:00
LemonBoy
399e026cc0 Add sigaltstack wrapper in os.zig 2019-05-29 22:38:14 +02:00
Andrew Kelley
c518b7b8bf
thread.spawn: bubble up mprotect error.OutOfMemory 2019-05-28 12:46:44 -04:00
LemonBoy
594366a482 Fix os.mprotect signature 2019-05-28 18:25:48 +02:00
Andrew Kelley
3640303ce1
freebsd fixes 2019-05-27 17:28:59 -04:00
Andrew Kelley
af4b8eb6c0 windows does not integrate cleanly with libc 2019-05-27 15:55:15 -04:00
Andrew Kelley
86bb7e5984 fixes for windows to build self hosted compiler 2019-05-27 15:55:15 -04:00
Andrew Kelley
b3dc1c380d
use close$NOCANCEL on darwin 2019-05-27 14:41:13 -04:00
Andrew Kelley
06435535d3
fixes for darwin 2019-05-27 14:12:50 -04:00
Andrew Kelley
f1610f6c1d
nanosleep: move windows logic to std.time 2019-05-27 12:16:32 -04:00
Andrew Kelley
fda7e0bb01
std lib fixes for zig build on windows 2019-05-27 02:00:39 -04:00
Andrew Kelley
129714d077
more fixes for windows and wasi 2019-05-27 01:35:58 -04:00
Andrew Kelley
6be79d79aa
fixes for Windows and WASI 2019-05-27 00:48:56 -04:00
Andrew Kelley
0c6ab61b22
tests passing on linux 2019-05-26 23:35:26 -04:00
Andrew Kelley
2b42e910bf
behavior tests passing on Linux 2019-05-26 19:56:37 -04:00
Andrew Kelley
44a049e01e
more cleanup. down to just the @hasDecl builtin 2019-05-26 18:32:45 -04:00
Andrew Kelley
2f040a23c8
clean up references to os 2019-05-26 18:32:44 -04:00
Andrew Kelley
7cb6279ac0
clean up references to posix 2019-05-26 18:32:44 -04:00
Andrew Kelley
ca6debcaf4
starting to fix the regressions 2019-05-26 18:32:44 -04:00
Andrew Kelley
3d61e42282
rename "posix" to "bits" 2019-05-26 18:32:44 -04:00
Andrew Kelley
17b0166e00
do Jay's suggestion with posix/os API naming & layout 2019-05-26 18:32:44 -04:00
Andrew Kelley
2def23063f
more progress. moving windows API layer to its own file 2019-05-26 18:32:44 -04:00
Andrew Kelley
daae7e1f5a
more progress on posix API layer
see #2380
2019-05-26 18:32:43 -04:00
Andrew Kelley
67726e36b0
extract posix functions from std/os.zig to std/os/posix.zig
See #2380
2019-05-26 18:32:40 -04:00
Shawn Landden
1fdb24827f
breaking changes to all bit manipulation intrinsics
* `@clz`, `@ctz`, `@popCount`, `@bswap`, `@bitreverse` now
   have a type parameter
 * rename @bitreverse to @bitReverse
 * rename @bswap to @byteSwap

Closes #2119
Closes #2120
2019-05-16 16:37:58 -04:00
Andrew Kelley
72899da44b
fix std.os.copyFile
closes #2454
2019-05-09 13:05:06 -04:00
LemonBoy
d8ab301aa8 std: Implement TLS support for Linux
Tested on x86_64, i386, ARM, AARCH64
2019-05-07 13:09:18 +02:00
Shritesh Bhattarai
84682eb862 wasi: implement os.exit 2019-05-02 11:26:33 -05:00
Shritesh Bhattarai
6fb677c4f6 wasi: native os.abort 2019-05-02 11:25:25 -05:00
Shritesh Bhattarai
1fabd6bbf3 wasi: implement getRandomBytes 2019-04-30 20:50:41 -04:00
Shritesh Bhattarai
0a693b70e4 wasi: use mem.separate instead 2019-04-30 18:43:43 -05:00
Shritesh Bhattarai
20458f56d8 wasi: add getEnvMap 2019-04-30 18:18:20 -05:00
Shritesh Bhattarai
01365be82f WASI: implement argsAlloc and argsFree (#2364)
* wasi: change URL to canon WASI-core.md

* wasi: import args_get and args_sizes_get

* wasi: Implement argsAlloc and argsFree

* test return value for wasi arg syscalls

* wasi: return unexpectedErrorPosix in argsAlloc

* wasi: Add TODO for ArgIterator
2019-04-29 21:54:30 -04:00
Andrew Kelley
0a280b6062
update std.os.page_size for WebAssembly 2019-04-15 21:20:41 -04:00
Shritesh Bhattarai
72bcd5a4a5 WIP: hello world 2019-04-13 15:15:39 -05:00
Andrew Kelley
fd65cdc55a
fix incorrect Thread.getCurrentId test
Documentation comments copied here:

On Linux, it is possible that the thread spawned with `spawnThread`
finishes executing entirely before the clone syscall completes. In this
case, `std.os.Thread.handle` will return 0 rather than the
no-longer-existing thread's pid.
2019-04-05 16:06:35 -04:00
Andrew Kelley
947c87b558
threads: fix using unmapped memory in some cases
as pointed out in #musl IRC, the memory for the fs register address
value needs to be taken into account in the mmap call.
2019-04-04 01:36:01 -04:00
Andrew Kelley
e4d595a8ba
fix thread local variables for non- position independent code
This fixes comes thanks to Rich Felker from the musl libc project,
who gave me this crucial information:

"to satisfy the abi, your init code has to write the same value
to that memory location as the value passed to the [arch_prctl]
syscall"

This commit also changes the rules for when to build statically
by default. When building objects and static libraries, position
independent code is disabled if no libraries will be dynamically
linked and the target does not require position independent code.

closes #2063
2019-04-04 01:08:26 -04:00
Shritesh Bhattarai
85575704a4 Use linux.exit_group if not single threaded 2019-03-26 17:49:20 -04:00