Al Hoang
c17396691c
initial support for haiku sync update
...
* add cpu count
* use haiku find_directory
* add definitions and exports for building in haiku
2021-02-25 16:41:42 -07:00
Al Hoang
6b0372229d
initial support for haiku continue clean up
...
* remove unused definitions
* setup os specific blocks
2021-02-25 16:41:42 -07:00
Al Hoang
025635c3f8
initial support for haiku past stage0
2021-02-25 16:41:42 -07:00
Benjamin Graf
c70832bc41
replace ArrayList.shrinkAndFree by ArrayList.shrinkRetainingCapacity
2021-02-21 11:56:14 +02:00
LemonBoy
134f5fd3d6
std: Update test "" to test where it makes sense
2021-01-22 15:46:58 +01:00
Alex Cameron
89286376c6
std: Rename ArrayList shrink => shrinkAndFree
2021-01-06 00:55:51 +11:00
Andrew Kelley
99203e4177
Merge pull request #7578 from vrischmann/walker
...
fix segfault in std.fs.Walker
2021-01-01 13:28:01 -08:00
Frank Denis
6c2e0c2046
Year++
2020-12-31 15:45:24 -08:00
Vincent Rischmann
9c53564af1
fs: fix segfault in Walker.next
...
`top` might point to invalid memory after a call to self.stack.append
which causes a segfault.
Prevent this by recomputing `top`.
Fixes #7560
2020-12-28 18:14:27 +01:00
frmdstryr
577b57784a
Return encoded slice from base64 encode
2020-12-24 01:27:21 +02:00
Andrew Kelley
013efaf139
std: introduce a thread-local CSPRNG for general use
...
std.crypto.random
* cross platform, even freestanding
* can't fail. on initialization for some systems requires calling
os.getrandom(), in which case there are rare but theoretically
possible errors. The code panics in these cases, however the
application may choose to override the default seed function and then
handle the failure another way.
* thread-safe
* supports the full Random interface
* cryptographically secure
* no syscall required to initialize on Linux (AT_RANDOM)
* calls arc4random on systems that support it
`std.crypto.randomBytes` is removed in favor of `std.crypto.random.bytes`.
I moved some of the Random implementations into their own files in the
interest of organization.
stage2 no longer requires passing a RNG; instead it uses this API.
Closes #6704
2020-12-18 12:22:46 -07:00
Mathieu Guay-Paquet
4c8632e244
fix the tinyest typo
2020-12-02 19:08:25 +02:00
Jonathan Marler
48660371a2
std.meta: add assumeSentinel
2020-11-29 10:36:02 -08:00
LemonBoy
8ed7561422
std: Re-enable the use of O_EXLOCK/O_SHLOCK on macos
2020-11-24 10:23:54 +01:00
LemonBoy
26d20e39fc
std: Close dangling fd on error
...
This patch was already submitted for openFileZ, createFileZ was left
unpatched.
2020-11-23 18:00:05 +01:00
LemonBoy
0d4f05bb8a
std: Remove O_NONBLOCK flag after locking
...
We only need O_NONBLOCK when O_SHLOCK/O_EXLOCK are used and we don't
want open() to block, don't let this bit leak to the user fd.
2020-11-23 18:00:05 +01:00
LemonBoy
f8ddc3d873
std: Fix file locking logic for BSD targets
2020-11-23 18:00:05 +01:00
Sébastien Marie
b174942e6a
openbsd, netbsd: getdents: entry with d_fileno==0 should be skipped
2020-11-19 13:55:46 +00:00
Sébastien Marie
7579ce180f
Iterator: rename freebsd_entry to bsd_entry to reflect that nextBsd is not freebsd only
2020-11-19 13:54:47 +00:00
Sébastien Marie
ad2ff9e65d
darwin: getdents: entry with d_ino==0 should be skipped
2020-11-19 13:54:29 +00:00
Veikka Tuominen
6d5b76a75d
Merge pull request #7005 from jshholland/deprecate-span
...
Remove ArrayList.span
2020-11-18 13:14:48 +02:00
g-w1
a0226ab05b
std: openDirAbsolute and accessAbsolute ( #7082 )
...
* add more abosolutes
* added wrong files
* adding 2 tests and changing the function signatures because of lazy analysis not checking them
* fix a bug that got uncovered by lazy eval
* Add compile error when using WASI with openDirAbsolute and accessAbsolute
* typo
2020-11-18 08:42:35 +01:00
Josh Holland
c25b157dda
remove deprecated uses of ArrayList.span
2020-11-07 11:15:44 +00:00
Alex Cameron
ecdd636605
Fix file descriptor leak in fs.openFileZ.
2020-11-02 13:28:29 -05:00
Sébastien Marie
3115d2f2cd
readd original code from #6638 . realpathZ() is expected to take a [*:0]const u8
2020-10-25 10:02:10 +01:00
Andrew Kelley
05b1a7414e
code cleanups
...
* in selfExePath, return errors instead of defaulting to bogus data
* less invasive edits to the logic of link/Elf.zig
* less indentation
2020-10-17 17:52:09 -07:00
Sebastien Marie
35a7247a2c
Merge branch 'master' into openbsd-minimal
2020-10-17 17:38:23 +02:00
Vignesh Rajagopalan
2ab0c7391a
Rename .macosx to .macos
2020-10-12 18:56:25 -04:00
Sébastien Marie
a6dc2b7fcc
openbsd: selfExePath adjustements
2020-10-11 12:23:52 +00:00
Sébastien Marie
97ec9fdd79
opensd: selfExePath: do not rely on environment as it could be inherited
2020-10-11 08:23:37 +00:00
Sébastien Marie
78a7543056
openbsd: use mem.span() + mem.indexOf() instead of defining custom function
2020-10-11 08:23:37 +00:00
Sébastien Marie
f33a610c84
add minimal openbsd support
2020-10-11 08:23:36 +00:00
Andrew Kelley
9f8f446435
fixups to previous commit
...
* std.fs.Dir.readFile: add doc comments to explain what it means when
the returned slice has the same length as the supplied buffer.
* introduce readSmallFile / writeSmallFile to abstract over the
decision to use symlink or file contents to store data.
2020-10-09 16:45:39 -07:00
mlarouche
57912964af
Use regular file for caching stage 1 hash digest instead of symlink, fix zig build caching on Windows
...
Fix #6500
2020-10-09 16:50:43 -04:00
Andrew Kelley
76a195473d
Merge pull request #6516 from LemonBoy/fastfilecopy
...
std: Make file copy ops use zero-copy mechanisms
2020-10-08 20:14:47 -04:00
LemonBoy
03762da2af
New review round
2020-10-07 11:13:26 +02:00
LemonBoy
1f7ec0de70
Address review comments & fix compilation errors
2020-10-06 11:57:23 +02:00
LemonBoy
a419a1aabc
Move copy_file to fs namespace
...
Now it is a private API.
Also handle short writes in copy_file_range fallback implementation.
2020-10-06 09:38:59 +02:00
Noah Altunian
c507c7862e
Fix spelling in code comment
...
Changed **an handle** -> **a handle**.
2020-10-05 22:25:07 -04:00
LemonBoy
8b4f5f039d
Alternative strategy to avoid calling stat()
...
This is an optimization as it avoids an extra syscall, but it's also a
workaround for fstat being not available on Windows.
2020-10-03 19:51:22 +02:00
LemonBoy
0f248e0988
std: Make file copy ops use zero-copy mechanisms
...
Use copy_file_range on Linux (if available), fcopyfile on Darwin,
sendfile on *BSDs (and on Linux kernels without copy_file_range).
2020-10-03 12:31:17 +02:00
Loris Cro
276598346a
provide the full buffer length to _NSGetExecutablePath
...
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-10-03 12:03:22 +02:00
Loris Cro
f841ea77e2
make symlink buffer null-terminated
...
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-10-02 19:33:14 +02:00
Loris Cro
a2074c1ec3
fix symlink path not being resolved in darwin
...
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-10-02 17:06:29 +02:00
Ryan Liptak
5e3fa0e94f
Add rename to std.fs API
...
- Moves fs.rename functions to fs.renameAbsolute to match other functions outside of fs.Dir
- Adds fs.Dir.rename that takes two paths relative to the given Dir
- Adds fs.rename that takes two separate Dir's that the given paths are relative to (for renaming across directories without having to make the second path relative to a single directory)
- Fixes FileNotFound error return in std.os.windows.MoveFileExW
- Returns error.RenameAcrossMountPoints from renameatW
+ Matches the RenameAcrossMountPoints error return in renameatWasi/renameatZ
2020-09-17 17:22:26 -04:00
LemonBoy
3c8e1bc25b
std: Fix for 32bit systems
2020-09-04 12:48:36 +02:00
LemonBoy
90743881cf
std: Minor changes to the fs module
...
* Add a size_hint parameter to the read{toEnd,File}AllocOptions fns
* Rename readAllAlloc{,Options} to readToEndAlloc{,Options} as they
don't rewind the file before reading
* Fix missing rewind in test case
2020-09-04 10:17:00 +02:00
LemonBoy
73a8c9beaa
std: Don't trust stat() size in readAllAlloc fns
...
Some files such as the ones in /proc report a st_size of zero, try to
read the file anyway if we hit that case.
2020-09-02 11:11:57 +02:00
daurnimator
129d3e274d
std: use O_NOCTTY flag
2020-08-24 02:28:31 +10:00
daurnimator
23a81b4396
std: refactor fs.openFileZ flag handling
2020-08-24 02:27:26 +10:00