91 Commits

Author SHA1 Message Date
Isaac Freund
a1777cb5cb
std: fix pthread_{get,set}name_np return type ABI
I believe this was accidentally broken when the E enum for errno values
was introduces. These functions are quite the special case in that they
return the error value directly rather than returning -1 and passing the
error value through the errno variable.

In any case, using a u16 as the return type at the ABI boundary where a
c_int is expected is asking for trouble.
2024-06-17 23:26:53 +02:00
Jacob Young
5a41704f7e cbe: rewrite CType
Closes #14904
2024-03-30 20:50:48 -04:00
Jacob Young
2dd74cd312 haiku: debitrot 2024-03-23 18:11:32 +01:00
Andrew Kelley
cd62005f19 extract std.posix from std.os
closes #5019
2024-03-19 11:45:09 -07:00
Jacob Young
d10c52c194 AstGen: disallow alignment on function types
A pointer type already has an alignment, so this information does not
need to be duplicated on the function type.  This already has precedence
with addrspace which is already disallowed on function types for this
reason.  Also fixes `@TypeOf(&func)` to have the correct addrspace and
alignment.
2024-03-17 03:06:17 +01:00
Michael Dusan
d7cf25f5ca
bsd: debitrot std.c
- follow-up to f4bf061d8a8
- updated std.fs.Dir to use properly named symbols
2024-03-15 02:28:50 -04:00
Michael Dusan
6724a524d4 bsd: add missing os.IFNAMESIZE
- based on system API value IF_NAMESIZE
- unblocks `zig test lib/std/std.zig`
2024-03-14 18:54:25 -07:00
Michael Dusan
2ff64c7cb2
std.os.termios: add/fix std.c.TCSA for BSDs 2024-02-15 02:40:11 -05:00
Michael Dusan
7e83e7d9a8 bsd: debitrot type-safe std.c.O
Minor changes as per 7680c5330cb mostly about pipe2() flags.

closes #18927
2024-02-14 19:26:12 -08:00
Andrew Kelley
ae107cf71b std.os.speed_t: add type safety
and collect the missing flag bits from all the operating systems.
2024-02-12 21:49:09 -07:00
Andrew Kelley
e97fa8b038 std.os.termios: add type safety to cflag field
This creates `tc_cflag_t` even though such a type is not defined by
libc.

I also collected the missing flag bits from all the operating systems.
2024-02-12 18:24:07 -07:00
Andrew Kelley
20abc0caee std.os.termios: add type safety to oflag field
This creates `tc_oflag_t` even though such a type is not defined by
libc.

I also collected the missing flag bits from all the operating systems.
2024-02-12 17:28:09 -07:00
Andrew Kelley
47643cc5cc std.os.termios: add type safety to iflag field
This creates `tc_iflag_t` even though such a type is not defined by
libc.

I also collected the missing flag bits from all the operating systems.
2024-02-12 16:43:51 -07:00
Andrew Kelley
0c88f927f1 std.os.termios: consolidate and correct 2024-02-12 16:21:21 -07:00
Andrew Kelley
9a64318554 std.c.NCSS: consolidate and correct 2024-02-12 15:52:13 -07:00
Andrew Kelley
5258c3caad std: add type safety to cc_t 2024-02-12 15:41:38 -07:00
Andrew Kelley
7680c5330c some API work on std.c, std.os, std.os.wasi
* std.c: consolidate some definitions, making them share code. For
  example, freebsd, dragonfly, and openbsd can all share the same
  `pthread_mutex_t` definition.
* add type safety to std.c.O
  - this caught a bug where mode flags were incorrectly passed as the
    open flags.
* 3 fewer uses of usingnamespace keyword
* as per convention, remove purposeless field prefixes from struct field
  names even if they have those prefixes in the corresponding C code.
* fix incorrect wasi libc Stat definition
* remove C definitions from incorrectly being in std.os.wasi
* make std.os.wasi definitions type safe
* go through wasi native APIs even when linking libc because the libc
  APIs are problematic and wasteful
* don't expose WASI definitions in std.posix
* remove std.os.wasi.rights_t.ALL: this is a footgun. should it be all
  future rights too? or only all current rights known? both are
  the wrong answer.
2024-02-11 13:38:55 -07:00
Andrew Kelley
a60f219660 std.c.MAP: use a packed struct
Same as previous commit, but for the libc interface.
2024-02-06 22:06:01 -07:00
Michael Dusan
4532ff2780
netbsd: std.c: fix pthread_rwlock_t
- make .owner field optional
2023-08-15 17:29:35 -04:00
Michael Dusan
25542c3443
netbsd: std.c.REG: populate indexes for x86_64 2023-08-15 17:20:04 -04:00
Andrew Kelley
14353590f2 Revert "std: adding netbsd's pthread to cpu affinity api"
This reverts commit 3f259d35502ed5a8bdb6bbc22f9adb39d610b006.
2023-07-31 11:23:33 -07:00
Andrew Kelley
5f101b253e Revert "std: adding sigevent to supported platforms."
This reverts commit 23c4f55a612842d8544a9dfe604a9caf1ca39697.
2023-07-31 11:20:39 -07:00
Andrew Kelley
c9de5304ab Revert "std.c:complete further more netbsd's mmap flags"
This reverts commit 4f248e1b519b001cee67e461068245c142d38e73.
2023-07-31 11:17:25 -07:00
Andrew Kelley
a208c59a25 Revert "std.c: add netbsd's accept_filter_data for ACCEPT_FILTER sock opt."
This reverts commit b677b3627818edc24828f36f8269a3c3843703a1.
2023-07-31 10:57:22 -07:00
Andrew Kelley
43162efbf4 Revert "std.c: adding ptrace for netbsd."
This reverts commit ccfb0d408d5ffb40f77a8ad1fb57f0bb854583ad.
2023-07-31 10:55:03 -07:00
Andrew Kelley
1b9ffa0824 Revert "std.Thread: refining stack size from platform minimum, changes more targetted towards platform like Linux/musl (#15791)"
This reverts commit 41502c6aa53a3da31b276c23c4db74db7d04796b.
2023-07-31 10:54:35 -07:00
Andrew Kelley
9f20d01cfb Revert "std.c: exposing timer api"
This reverts commit 54ea0bbcdddc9e13ed98415d8883f03d59392509.
2023-07-31 10:51:44 -07:00
Andrew Kelley
dad7eea8d9 Revert "std.c: update netbsd/openbsd mman constants"
This reverts commit 64f0059cd33b571d6cf91df45f4cb2e0af9c0742.
2023-07-31 10:50:39 -07:00
Andrew Kelley
95e2605d30 Revert "std.c: msghdr* struct removing prefixes to match linux."
This reverts commit 8f14431bc883898aaf78cc985e2d90716187e882.
2023-07-31 10:49:57 -07:00
David CARLIER
8f14431bc8 std.c: msghdr* struct removing prefixes to match linux. 2023-07-01 11:14:39 -07:00
mlugg
f26dda2117 all: migrate code to new cast builtin syntax
Most of this migration was performed automatically with `zig fmt`. There
were a few exceptions which I had to manually fix:

* `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten
* `@truncate`'s fixup is incorrect for vectors
* Test cases are not formatted, and their error locations change
2023-06-24 16:56:39 -07:00
David CARLIER
64f0059cd3 std.c: update netbsd/openbsd mman constants 2023-06-22 10:21:48 +00:00
Eric Joldasov
50339f595a all: zig fmt and rename "@XToY" to "@YFromX"
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-19 12:34:42 -07:00
David CARLIER
54ea0bbcdd std.c: exposing timer api 2023-06-18 08:09:42 -07:00
David CARLIER
41502c6aa5
std.Thread: refining stack size from platform minimum, changes more targetted towards platform like Linux/musl (#15791) 2023-05-25 14:32:17 -05:00
David CARLIER
ccfb0d408d std.c: adding ptrace for netbsd. 2023-05-20 11:06:11 +03:00
David CARLIER
b677b36278 std.c: add netbsd's accept_filter_data for ACCEPT_FILTER sock opt. 2023-05-16 04:31:15 +03:00
David CARLIER
4f248e1b51 std.c:complete further more netbsd's mmap flags 2023-04-30 12:21:35 +03:00
David CARLIER
23c4f55a61 std: adding sigevent to supported platforms. 2023-04-23 19:46:43 +03:00
David CARLIER
3f259d3550 std: adding netbsd's pthread to cpu affinity api 2023-04-22 13:59:00 +03:00
Nikita Ronja
d92b5fcfb0 Add NetBSD termios constants to std.c.netbsd 2023-04-06 03:46:44 +03:00
Michael Dusan
599b3ef9e9 netbsd: use versioned __msync13 from libc
The system linker shows warning when `msync` is linked instead of `__msync13`:

  "warning: reference to compatibility msync(); include <sys/mman.h> for correct reference"

closes #14422
2023-01-28 19:05:38 -05:00
Michael Dusan
c9f7b32fbd netbsd: add mcontext_t for aarch64
- test `lib/std/std.zig` passes
- stack traces work
2023-01-18 02:50:11 -05:00
Andrew Kelley
c9ef277fa7
Merge pull request #13980 from ziglang/std.net
networking: delete std.x; add std.crypto.tls and std.http.Client
2023-01-03 02:43:50 -05:00
Michael Dusan
e752606464
netbsd: getFdPath: F_GETPATH implementation 2023-01-02 19:18:33 -05:00
Michael Dusan
e872c72c55
std.fs: add NAME_MAX for openbsd and netbsd 2023-01-02 19:18:32 -05:00
Andrew Kelley
cd0d514643 remove the experimental std.x namespace
Playtime is over. I'm working on networking now.
2023-01-02 16:57:15 -07:00
Andrew Kelley
50eb7983cd remove most conditional compilation based on stage1
There are still a few occurrences of "stage1" in the standard library
and self-hosted compiler source, however, these instances need a bit
more careful inspection to ensure no breakage.
2022-12-06 20:38:54 -07:00
Veikka Tuominen
41b7e40d75
Merge pull request #13418 from ryanschneider/signal-alignment-13216
std.os: fix alignment of Sigaction.handler_fn
2022-11-09 17:36:40 +02:00
Ryan Schneider
7f1f2e653d std.os: fix alignment of Sigaction.handler_fn
Fixes #13216
2022-11-04 08:00:50 -07:00