aboutsummaryrefslogtreecommitdiff
path: root/lib/std/process.zig
AgeCommit message (Collapse)Author
2023-06-10process: add more missing constJacob Young
2023-05-13Update all std.mem.split calls to their appropriate functionRyan Liptak
Everywhere that can now use `splitScalar` should get a nice little performance boost.
2023-05-13Update all std.mem.tokenize calls to their appropriate functionRyan Liptak
Everywhere that can now use `tokenizeScalar` should get a nice little performance boost.
2023-04-28update codebase to use `@memset` and `@memcpy`Andrew Kelley
2023-04-24std.process: further totalSystemMemory portageDavid CARLIER
2023-04-23process: add args definition commentNicolas Sterchele
To improve understandability of its purpose.
2023-04-22process: totalSystemMemory freebsd portageDavid CARLIER
2023-04-14windows: replace GetPhysicallyInstalledSystemMemory with ntdll.xEgoist
`GetPhysicallyInstalledSystemMemory` uses SMBios to grab the physical memory size which can lead to unecessary allocation and inacurate representation of the total memory. Using `System_Basic_Information` help to retrieve the physical memory which is not reserved for the kernel/tables. This aligns better with the linux side as `/proc/meminfo` does the same thing.
2023-04-06Fix crash on some Windows machinesalion02
2023-03-25std.process.Child: implement maxrss on Darwintjog
Notably the Darwin (XNU) kernel the maxrss field is number of bytes and not kilobytes (kibibytes) like other platforms (e.g. Linux, BSD). watchOS and tvOS are not supported because they do not have the ability to spawn a child process. iOS is enabled but due to OS sandboxing it should fail with a permission error.
2023-03-15remove bad unit test from std libAndrew Kelley
This unit test tested the command line arguments which were passed to the test runner, which is not really something that unit tests are supposed to observe. The proper way to test command line argument parsing is with a standalone test, where the set of command line arguments being tested for are also being controlled by the test itself.
2023-03-15add std.process.cleanExitAndrew Kelley
2023-03-15add std.process.totalSystemMemoryAndrew Kelley
2023-03-03std.process.Child: remove pid and handle, add idAndrew Kelley
Previously, this API had pid, to be used on POSIX systems, and handle, to be used on Windows. This commit unifies the API, defining an Id type that is either the pid or the HANDLE depending on the target OS. This commit also prepares for the future by allowing one to import via `std.process.Child` which is the fully qualified namespace that I intend to migrate to in the future.
2023-02-18update std lib and compiler sources to new for loop syntaxAndrew Kelley
2023-01-19wasm: avoids allocating zero length buffers for args or envAdrian Cole
I was testing this with wazero, which defaults to not propagate any env variables. This ensures we don't try to allocate zero length buffers when there are no results from either function. Signed-off-by: Adrian Cole <adrian@tetrate.io>
2023-01-06Implement some more environment functions for WASI.Brendan Burns
2022-12-30Fix bug in WASI envmap handling.Brendan Burns
2022-12-27update uses of overflow arithmetic builtinsVeikka Tuominen
2022-12-06std: clean up imports in a couple filesAndrew Kelley
2022-11-16process.zig: remove unused function getSelfExeSharedLibPathsEric Joldasov
2022-09-14Move std.testing.zig_exe_path into build optionsMartin Wickham
2022-07-25std.mem: add `first` method to `SplitIterator` and `SplitBackwardsIterator`r00ster
2022-07-01Sema: validate deref operator type and valueVeikka Tuominen
2022-05-11document that on Windows, all key arguments in EnvMap must be valid utf8Jonathan Marler
2022-05-11incorporate review changes from squeekJonathan Marler
2022-05-11some fixes to the EnvMap HashContextJonathan Marler
2022-05-11reverse some of the now unneeded changes from squeekJonathan Marler
2022-05-11add unicode supportJonathan Marler
2022-05-11remove extra storage from EnvMap on windowsJonathan Marler
2022-05-11EnvMapWindows: Fix putUtf8 not uppercasing keysRyan Liptak
2022-05-11Set EnvMap.Size to BufMap.BufMapHashMap.SizeRyan Liptak
Now that BufMap.BufMapHashMap is pub, we can just get Size directly
2022-05-11Update usages of `process.getEnvMap` and change BufMap -> EnvMap where ↵Jonathan Marler
applicable # Conflicts: # lib/std/build/RunStep.zig
2022-05-11Add `process.EnvMap`, a platform-independent environment variable mapRyan Liptak
EnvMap provides the same API as the previously used BufMap (besides `putMove` and `getPtr`), so usage sites of `getEnvMap` can usually remain unchanged. For non-Windows, EnvMap is a wrapper around BufMap. On Windows, it uses a new EnvMapWindows to handle some Windows-specific behavior: - Lookups use Unicode-aware case insensitivity (but `get` cannot return an error because EnvMapWindows has an internal buffer to use for lookup conversions) - Canonical names are returned when iterating the EnvMap Fixes #10561, closes #4603
2022-02-06Avoid depending on child process execution when not supported by host OSCody Tapscott
In accordance with the requesting issue (#10750): - `zig test` skips any tests that it cannot spawn, returning success - `zig run` and `zig build` exit with failure, reporting the command the cannot be run - `zig clang`, `zig ar`, etc. already punt directly to the appropriate clang/lld main(), even before this change - Native `libc` Detection is not supported Additionally, `exec()` and related Builder functions error at run-time, reporting the command that cannot be run
2022-02-05std.process: add option to support single quotes to ArgIteratorGeneralVeikka Tuominen
2022-01-30Full response file (*.rsp) supportPhaseMage
I hit the "quotes in an RSP file" issue when trying to compile gRPC using "zig cc". As a fun exercise, I decided to see if I could fix it myself. I'm fully open to this code being flat-out rejected. Or I can take feedback to fix it up. This modifies (and renames) _ArgIteratorWindows_ in process.zig such that it works with arbitrary strings (or the contents of an RSP file). In main.zig, this new _ArgIteratorGeneral_ is used to address the "TODO" listed in _ClangArgIterator_. This change closes #4833. **Pros:** - It has the nice attribute of handling "RSP file" arguments in the same way it handles "cmd_line" arguments. - High Performance, minimal allocations - Fixed bug in previous _ArgIteratorWindows_, where final trailing backslashes in a command line were entirely dropped - Added a test case for the above bug - Harmonized the _ArgIteratorXxxx._initWithAllocator()_ and _next()_ interface across Windows/Posix/Wasi (Moved Windows errors to _initWithAllocator()_ rather than _next()_) - Likely perf benefit on Windows by doing _utf16leToUtf8AllocZ()_ only once for the entire cmd_line **Cons:** - Breaking Change in std library on Windows: Call _ArgIterator.initWithAllocator()_ instead of _ArgIterator.init()_ - PhaseMage is new with contributions to Zig, might need a lot of hand-holding - PhaseMage is a Windows person, non-Windows stuff will need to be double-checked **Testing Done:** - Wrote a few new test cases in process.zig - zig.exe build test -Dskip-release (no new failures seen) - zig cc now builds gRPC without error
2022-01-29fix argsAlloc buffer sizeJean Dao
The buffer `buf` contains N (= `slice_sizes.len`) slices followed by the N null-terminated arguments. The N null-terminated arguments are stored in the `contents` array list. Thus, `buf` size should be: @sizeOf([]u8) * slice_sizes.len + contents_slice.len Instead of: @sizeOf([]u8) * slice_sizes.len + contents_slice.len + slice_sizes.len This bug was found thanks to the gpa allocator which checks if freed size matches allocated sizes for large allocations.
2022-01-20remove unnecessary self argumentJonathan Marler
2021-12-21Change `ArgIterator.next()` return typeominitay
Changes the return type of `ArgIterator.next()` from `?(NextError![:0]u8)` to `NextError!?[:0]u8`.
2021-11-30allocgate: renamed getAllocator function to allocatorLee Cannon
2021-11-30allocgate: std Allocator interface refactorLee Cannon
2021-11-30std lib API deprecations for the upcoming 0.9.0 releaseAndrew Kelley
See #3811
2021-10-04migrate from `std.Target.current` to `@import("builtin").target`Andrew Kelley
closes #9388 closes #9321
2021-09-24Initial bringup of the Solaris/Illumos portStephen Gregoratto
2021-08-24remove redundant license headers from zig standard libraryAndrew Kelley
We already have a LICENSE file that covers the Zig Standard Library. We no longer need to remind everyone that the license is MIT in every single file. Previously this was introduced to clarify the situation for a fork of Zig that made Zig's LICENSE file harder to find, and replaced it with their own license that required annual payments to their company. However that fork now appears to be dead. So there is no need to reinforce the copyright notice in every single file.
2021-08-24std: [breaking] move errno to become an nonexhaustive enumAndrew Kelley
The primary purpose of this change is to eliminate one usage of `usingnamespace` in the standard library - specifically the usage for errno values in `std.os.linux`. This is accomplished by truncating the `E` prefix from error values, and making errno a proper enum. A similar strategy can be used to eliminate some other `usingnamespace` sites in the std lib.
2021-08-09Merge remote-tracking branch 'origin' into libc-wasi-testTakeshi Yoneda
2021-08-06Update all usages of mem.split/mem.tokenize for generic versionRyan Liptak
2021-07-27WASI,libc: enable tests.Takeshi Yoneda
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>