aboutsummaryrefslogtreecommitdiff
path: root/lib/std/c.zig
AgeCommit message (Collapse)Author
2022-08-27Sema: add error for non-comptime param in comptime funcantlilja
Adds error for taking a non comptime parameter in a function returning a comptime-only type but not when that type is dependent on a parameter. Co-authored-by: Veikka Tuominen <git@vexu.eu>
2022-08-24pthread_key_create: make it build with stage2Sébastien Marie
2022-05-07std.c: Move Darwin-unspecific functions from std/c/darwin.zig to std/c.zigaiotter
2022-05-06std.c: Add C APIs to read directoriesaiotter
2022-04-15stage2: fix bugs preventing stage2 from building stage3 with LLVMVeikka Tuominen
2022-03-23Add sem_open & sem_closeLocria Cyber
2022-03-13std+macho: revert and fix exposing Mach wrappers in std.os and std.cJakub Konka
2022-03-13std: fix imports for darwin specific flags and funcsJakub Konka
2022-02-11std: validate frame-pointer address in stack walkingm
2022-01-17std.c: add shm_open and shm_unlinkMeghan
https://man7.org/linux/man-pages/man3/shm_open.3.html
2022-01-12Use libc if_nametoindex if available when parsing IPsJohn Schmidt
Fixes https://github.com/ziglang/zig/issues/10521 and makes a couple of additional tests pass when linking libc.
2021-12-19stage1, stage2: rename c_void to anyopaque (#10316)Isaac Freund
zig fmt now replaces c_void with anyopaque to make updating code easy.
2021-11-15Add `chmod` and `chown`Ominitay
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-09-01std.os fixes to get the test suite passing againAndrew Kelley
2021-09-01std: fix regressions from this branchAndrew Kelley
Also move some usingnamespace test cases from compare_output to behavior.
2021-09-01std: reorganization that allows new usingnamespace semanticsAndrew Kelley
The proposal #9629 is now accepted, usingnamespace stays but no longer puts identifiers in scope.
2021-09-01std.os: fix FILENO constants mapped to wrong valuesAndrew Kelley
yikes!
2021-09-01std.os: more reorganization effortsAndrew Kelley
* std lib tests are passing on x86_64-linux with and without -lc * stage2 is building from source on x86_64-linux * down to 38 remaining uses of `usingnamespace`
2021-09-01std: reorganize std.c to eliminate `usingnamespace`Andrew Kelley
Behavior tests pass on x86_64-linux with -lc
2021-09-01std.os reorganization, avoiding `usingnamespace`Andrew Kelley
The main purpose of this branch is to explore avoiding the `usingnamespace` feature of the zig language, specifically with regards to `std.os` and related functionality. If this experiment is successful, it will provide a data point on whether or not it would be practical to entirely remove `usingnamespace` from the language. In this commit, `usingnamespace` has been completely eliminated from the Linux x86_64 compilation path, aside from io_uring. The behavior tests pass, however that's as far as this branch goes. It is very breaking, and a lot more work is needed before it could be considered mergeable. I wanted to put a pull requset up early so that zig programmers have time to provide feedback. This is progress towards closing #6600 since it clarifies where the actual "owner" of each declaration is, and reduces the number of different ways to import the same declarations. One of the main organizational strategies used here is to do namespacing with real namespaces (e.g. structs) rather than by having declarations share a common prefix (the C strategy). It's no coincidence that `usingnamespace` has similar semantics to `#include` and becomes much less necessary when using proper namespaces.
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-09review: use defined flag for oflags.Takeshi Yoneda
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2021-07-27WASI,libc: enable tests.Takeshi Yoneda
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2021-06-30std.Thread: more cleanup & testingkprotty
2021-06-16netbsd: add more std.os.bitsMichael Dusan
2021-06-14translate-c: move utility functions to a separate namespaceVeikka Tuominen
2021-06-11c.zig: fix waitpid() definitioncodic12
2021-06-11c.zig: add sigfillset, alarm, sigwaitcodic12
I've added these three functions to all switches except NetBSD, because I don't know what the function is named there. I've even added it on the .windows switch since all the posix functions seem to be there anyways.
2021-06-01os: have sendmsg, recvmsg flags be c_intlithdew
2021-06-01std/c: have sendmsg, recvmsg flags be u32lithdew
2021-06-01std/c: add recvmsg, sendmsglithdew
2021-05-22std.os: munmap takes a const pointerSobeston
2021-05-11std: Harmonize use of off_t between libc and Zig implsLemonBoy
Let's follow the libc/kernel convention and use an i64 for offsets, we bitcast as needed and avoid the useless conditional casts.
2021-05-10std/os, x/os/socket: windows support, socket helpers, getpeername()lithdew
Socket I/O methods such as read, readv, write, writev, send, recv, sendmsg, recvmsg have been generalized to read(buf, flags), write(buf, flags), readVectorized(vectors, flags), and writeVectorized(vectors, flags). There is still some work left to be done abstracting both readVectorized and writeVectorized properly across platforms, which is work to be done in a future PR. Support for setting the linger timeout of a socket, querying the remote address of a socket, setting whether or not keep-alive messages are to be sent through a connection-oriented socket periodically depending on host operating system settings has been added. `std.io.Reader` and `std.io.Writer` wrappers around `Socket` has been implemented, which wrap around Socket.read(buf, flags) and Socket.write(buf, flags). Both wrappers may be provided flags which are passed to Socket.read / Socket.write accordingly. Cross-platform support for `getpeername()` has been implemented. Windows support for the new `std.x.os.Socket` has been implemented. To accomplish this, a full refactor of `std.os.windows.ws2_32` has been done to supply any missing definitions and constants based on auto-generated Windows syscall bindings by @marler8997. `std.x.net.TCP.Listener.setQuickACK` has been moved to `std.x.net.TCP.Client.setQuickACK`. Windows support for resolving the scope ID of an interface name specified in an IPv6 address has been provided. `sockaddr_storage` definitions have been provided for Windows, Linux, and Darwin. `sockaddr_storage` is used to allocate space before any socket addresses are queried via. calls such as accept(), getsockname(), and getpeername(). Zig-friendly wrappers for GetQueuedCompletionStatusEx(), getpeername(), SetConsoleCtrlHandler(), SetFileCompletionNotificationModes() syscalls on Windows have been provided. Socket.setOption() was provided to set the value of a socket option in place of os.setsockopt. Socket.getOption() will be provided in a future PR. There is still further work to be done regarding querying socket option values on Windows, which is to be done in a subsequent PR.
2021-05-04std: remove dead and rotting C parsing codeAndrew Kelley
2021-03-16std: support optional getaddrinfo argumentsAnders Conbere
2021-03-12make std.c.getErrno() return same type as _errno() aka c_intSébastien Marie
adjust std.os.unexpectedErrno() to be correct for all std.os.system.errno (c_int, u12, usize, ...)
2021-02-21Rebase link(at) properlyTau
2021-01-22std: Update `test ""` to `test` where it makes senseLemonBoy
2021-01-18std: define pipe2 only for os that support itLemonBoy
2021-01-14organize std lib concurrency primitives and add RwLockAndrew Kelley
* move concurrency primitives that always operate on kernel threads to the std.Thread namespace * remove std.SpinLock. Nobody should use this in a non-freestanding environment; the other primitives are always preferable. In freestanding, it will be necessary to put custom spin logic in there, so there are no use cases for a std lib version. * move some std lib files to the top level fields convention * add std.Thread.spinLoopHint * add std.Thread.Condition * add std.Thread.Semaphore * new implementation of std.Thread.Mutex for Windows and non-pthreads Linux * add std.Thread.RwLock Implementations provided by @kprotty
2021-01-12add pthread_key functionsSébastien Marie
2021-01-05std.c add syslogxackus
2021-01-04std.c: add some noaliasxackus
2020-12-31Year++Frank Denis
2020-12-26std: add c._exit() and use in ChildProcessIsaac Freund
This issue with atexit() functions after forking isn't isolated to linux I'm sure, the proper way to do this when linking libc is to use _exit(2)
2020-12-23restore std.ResetEvent.isSet functionalityAndrew Kelley