1911 Commits

Author SHA1 Message Date
LeRoyce Pearson
317f06dc77 Add lock_nonblocking flag for creating or opening files
Also, make windows share delete access. Rationale: this is how it works
on Unix systems, mostly because locks are (usually) advisory on Unix.
2020-04-07 18:00:12 -06:00
LeRoyce Pearson
117d15ed7a Fix file locking on windows
The share_access bitfield was being ORed with what was supposed to be
parts of the default value, meaning that the share_access would be
more permissive than expected.
2020-04-07 16:49:37 -06:00
LeRoyce Pearson
71c5aab3e7 Make lock option an enum
For some reason, this breaks file locking on windows. Not sure if this is
a problem with wine.
2020-04-07 16:49:30 -06:00
xackus
721c76b53c refactor common pattern into a function 2020-04-07 23:37:33 +02:00
xackus
bf46117f13 std lib docs: fix null and int values 2020-04-07 23:37:01 +02:00
Andrew Kelley
4d290758bb
fix compile errors in some std.Target functions
The `ve` architecture needed to be added to a couple switch statements.
2020-04-07 15:06:58 -04:00
Andrew Kelley
22dbeab29d
Merge pull request #4857 from LemonBoy/fix-4777
Rewrite the bound checks in slice operator
2020-04-07 14:51:25 -04:00
Andrew Kelley
87a7ea4c42
Merge pull request #4971 from Vexu/const-ref
Fix missing const on address of literal
2020-04-07 14:24:50 -04:00
joachimschmidt557
1ee59c5c31 move big.rational.gcd to big.int.gcd 2020-04-07 13:43:15 -04:00
Michael Neumann
2b9cef1e04 Add missing constants for DragonFly 2020-04-07 17:23:20 +02:00
Vexu
95fefcd4c9
fix broken tests 2020-04-07 16:56:48 +03:00
LeRoyce Pearson
28d71c97d1 Fix compile error on darwin 2020-04-06 23:19:39 -06:00
LeRoyce Pearson
20597c8596 Only call os.flock on systems that lack openat locks 2020-04-06 22:28:43 -06:00
LeRoyce Pearson
49886d2e45 Remove return value from os.flock() 2020-04-06 22:07:27 -06:00
LeRoyce Pearson
798207ec80 Merge branch 'master' into feature-file-locks 2020-04-06 21:51:57 -06:00
LemonBoy
a0b73c9f02 compiler-rt: Separate max size allowed for load/store and CAS
The v6m ISA has no way to express a CAS loop natively without turning
off the interrupts or using the kernel cmpxchg harness.

On such a platform the user has to provide a few __sync_* builtins to
satisfy the linker.
2020-04-06 12:52:53 -04:00
Benjamin Feng
cb98984ae6 Generate clearer size mismatch error message 2020-04-05 18:38:19 -04:00
LemonBoy
eff7555d5d
std: Delete a hack in the feature set code
Now that bitwise not works on vectors we can simplify the code.
2020-04-05 18:34:31 -04:00
daurnimator
e9e43ed0d3
compiler_rt/atomics: be consistent with const value 2020-04-05 14:08:25 +10:00
daurnimator
f947444362
Tidy up compiler_rt/atomics 2020-04-05 14:06:12 +10:00
xackus
cd20e0cc67 rename mem.separate to mem.split 2020-04-04 17:37:51 -04:00
Felix (xq) Queißner
12cdea4525 Adds some documentation to std.atomic.Queue. 2020-04-04 13:47:07 -04:00
Andrew Kelley
e89c42655c
Merge pull request #4868 from xackus/new-arraylist-api
new ArrayList API
2020-04-03 22:31:15 -04:00
Andrew Kelley
e03cbb117e
compiler-rt: don't forget to export these functions 2020-04-03 16:07:32 -04:00
LemonBoy
ed69821f5b
compiler-rt: Add the __atomic family of builtins
The implementation was checked against a few files using std::atomic and
compiled using zig c++.

Closes #4887
2020-04-03 16:04:44 -04:00
markfirmware
203d6554b1 Update fmt.zig 2020-04-03 12:12:40 -04:00
Ryan Liptak
08a9ab4d8c Update all remaining uses of &outStream().stream 2020-04-03 12:12:23 -04:00
LemonBoy
dc54e50db2 std: Fix one more sentinel buffer overrun 2020-04-03 12:03:36 +02:00
LemonBoy
aa5865b9be std: Fix oob slicing operator 2020-04-03 10:58:39 +02:00
LeRoyce Pearson
ea32a7d2bc Fix compile errors about adding error.FileLocksNotSupported 2020-04-03 00:27:34 -06:00
LeRoyce Pearson
4dd0822a36 Add LOCK_* constants to BSD os/bits 2020-04-02 23:50:12 -06:00
LeRoyce Pearson
733f1c25bd Fix compile errors in stage2 2020-04-02 23:39:25 -06:00
LeRoyce Pearson
ea6525797d Use flock instead of fcntl to lock files
`flock` locks based on the file handle, instead of the process id.
This brings the file locking on unix based systems closer to file
locking on Windows.
2020-04-02 22:57:02 -06:00
LeRoyce Pearson
e7cf3f92a9 Add FileLocksNotSupported error to OpenError 2020-04-02 22:12:45 -06:00
LeRoyce Pearson
f757f0ea59 Merge branch 'master' into feature-file-locks 2020-04-02 21:47:41 -06:00
LeRoyce Pearson
35c462caf0 Merge branch 'master' into feature-file-locks 2020-04-02 21:46:48 -06:00
Jay Petacat
0dbf8aaab8
crypto: fix benchmark compile error (#4919) 2020-04-02 23:46:46 -04:00
Andrew Kelley
8bf7cffe29
slight modification of the semantics of std.os.getenvW
Now, this function first attempts a case-sensitive lookup.
If no match is found, and `key` is ASCII, then it attempts a
second case-insensitive lookup.

It is not planned to support full Unicode case-insensitivity
on Windows, and in fact relying on non-ASCII case-insensitive
environment variables is fundamentally problematic.
2020-04-02 15:04:42 -04:00
Ilmari Autio
ba1a8b64c4
make std.os.getenvW case insensitive
partially addresses #4603

Fixing std.process.getEnvMap is NOT included in this commit.
2020-04-02 13:01:32 -04:00
xackus
7a28c644aa new ArrayList API: fix everything else 2020-04-02 16:12:08 +02:00
xackus
d3ab0eb28d new ArrayList API: fix ArrayList.shrink 2020-04-02 15:15:20 +02:00
xackus
93a20f2e82 new ArrayList API: fix std.ArrayListSentineled 2020-04-02 15:14:28 +02:00
xackus
dd570dbc0d new ArrayList API, fix enough std lib to test 2020-04-02 15:14:18 +02:00
daurnimator
34524a1792
std: add LinearFifo().inStream 2020-04-02 21:14:15 +11:00
daurnimator
2a031c8825
std: LinearFifo matches ArrayList in always having outStream method 2020-04-02 21:07:44 +11:00
Timon Kruiper
eefb0a36c0 Fix CrossTarget.parse test on platforms where abi != gnu
Closes #4902
2020-04-01 18:05:49 -04:00
Andrew Kelley
2e806682f4
(breaking) std.Buffer => std.ArrayListSentineled(u8, 0)
This new name (and the fact that it is a function returning a type) will
make it more clear which use cases are better suited for ArrayList and
which are better suited for ArrayListSentineled.

Also for consistency with ArrayList,
 * `append` => `appendSlice`
 * `appendByte` => `append`

Thanks daurnimator for pointing out the confusion of std.Buffer.
2020-04-01 13:30:07 -04:00
Andrew Kelley
553f0e0546
fixups and revert a few things 2020-04-01 11:56:39 -04:00
daurnimator
e535057364
std: use std.ArrayList(u8).OutStream instead of std.Buffer.OutStream 2020-04-01 10:36:38 -04:00
daurnimator
37e6a64690
std: use Buffer.outStream in std/child_process.zig 2020-04-01 10:36:38 -04:00