Commit Graph

83 Commits

Author SHA1 Message Date
Andrew Kelley
9bf283c085 fixups
* getrandom libc prototypes had the wrong return type
 * `total_read` local variable was unnecessary since the sub-slice
   buffer has a length
 * I was able to get rid of all the integer casts
 * the err == 0 check can be a switch case
 * add missing `return` statement
2019-08-20 15:25:30 -04:00
Euan Torano
79354243e3 fix os.getrandom logic to fill the entire buffer 2019-08-20 14:52:38 -04:00
Andrew Kelley
3dce41b61a improvements to std lib for event-based I/O 2019-08-16 21:29:29 -04:00
Euan Torano
7b8c96612f Fix #2993 - use getrandom on freebsd 2019-08-05 09:31:38 -07:00
Euan T
08251fbc54 Omit system namespace.
Co-Authored-By: Andrew Kelley <andrew@ziglang.org>
2019-08-03 07:51:36 +01:00
Euan T
8e157ccb23 Update returned error return when not a character device.
Co-Authored-By: Andrew Kelley <andrew@ziglang.org>
2019-08-03 07:50:30 +01:00
Euan Torano
1583efda69 Fix call to S_ISCHR and implement for Mac 2019-08-02 15:55:56 +01:00
Euan Torano
c0c228b758 Check if /dev/urandom is a character device 2019-08-02 13:19:49 +01:00
Sahnvour
d08425a0a5 os: missing accessW since recent refactoring 2019-07-29 23:33:58 +02:00
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