Commit graph

131 commits

Author SHA1 Message Date
Alex Rønne Petersen
5a2f6acb44
std.Target: Remove kfreebsd OS specifier.
kFreeBSD is dead.

https://lists.debian.org/debian-devel/2023/07/msg00176.html
2024-07-20 05:08:14 +02:00
Andrew Kelley
e8c4e79499 std.c reorganization
It is now composed of these main sections:
* Declarations that are shared among all operating systems.
* Declarations that have the same name, but different type signatures
  depending on the operating system. Often multiple operating systems
  share the same type signatures however.
* Declarations that are specific to a single operating system.
  - These are imported one per line so you can see where they come from,
    protected by a comptime block to prevent accessing the wrong one.

Closes #19352 by changing the convention to making types `void` and
functions `{}`, so that it becomes possible to update `@hasDecl` sites
to use `@TypeOf(f) != void` or `T != void`. Happily, this ended up
removing some duplicate logic and update some bitrotted feature
detection checks.

A handful of types have been modified to gain namespacing and type
safety. This is a breaking change.

Oh, and the last usage of `usingnamespace` site is eliminated.
2024-07-19 00:30:32 -07:00
cryptocode
cb182432b0 [std.c] Add eventfd and dup3 functions to FreeBSD
The eventfd system call and dup3 library call have been available
since FreeBSD 13 and 10 respectively, and are thus available in
all [FreeBSD releases not deemed EOL](<https://endoflife.date/freebsd>)

The lack of these were discovered when porting a terminal emulator
to FreeBSD. It would be nice to have them included in Zig's stdlib.
2024-07-03 05:27:21 -04: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
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 7680c5330c mostly about pipe2() flags.

closes #18927
2024-02-14 19:26:12 -08: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
Andrew Kelley
235b9fc28a Revert "std: add FreeBSD's procctl api."
This reverts commit 2e2d37917d.
2023-07-31 11:24:21 -07:00
Andrew Kelley
99c70ec24f Revert "std: add kinfo_vmentry for FreeBSD"
This reverts commit 4a0508e56c.
2023-07-31 11:24:14 -07:00
Andrew Kelley
a18a116bda Revert "std: add shm_create_largepage for FreeBSD, completing MFD* constants."
This reverts commit 7b908e173f.
2023-07-31 11:24:04 -07:00
Andrew Kelley
c0ac1411db Revert "std: freebsd update proposal"
This reverts commit 2568da2f41.
2023-07-31 11:23:56 -07:00
Andrew Kelley
26777d98fe Revert "std: adding freebsd's elf_aux_info api"
This reverts commit 83970b6d91.
2023-07-31 11:23:49 -07:00
Andrew Kelley
b5df1bfcdb Revert "os: expand sched_getaffinity wrapper and update freebsd's cpuset api flags."
This reverts commit dbdafb6cc5.
2023-07-31 11:23:38 -07:00
Andrew Kelley
a2439e161b Revert "std: enriching malloc api on freebsd."
This reverts commit 9140249d29.
2023-07-31 11:21:50 -07:00
Andrew Kelley
aa5808c26c Revert "std: add accept_filter struct to make use of SO_ACCEPTFILTER socket option"
This reverts commit 1d322fe510.
2023-07-31 11:20:53 -07:00
Andrew Kelley
62deaaacd5 Revert "std: mcontext layout for x86 and fixing few x86_64 fields types for"
This reverts commit 9691cded95.
2023-07-31 11:20:49 -07:00
Andrew Kelley
963b2a2a4d Revert "std: adding FreeBSD's sched wrappers"
This reverts commit 9ef615104a.
2023-07-31 11:20:44 -07:00
Andrew Kelley
5f101b253e Revert "std: adding sigevent to supported platforms."
This reverts commit 23c4f55a61.
2023-07-31 11:20:39 -07:00
Andrew Kelley
ddd7b0ea9e Revert "std.c: adding mincore for freebsd"
This reverts commit 8d88dcdc61.
2023-07-31 11:18:07 -07:00
Andrew Kelley
70a7210e92 Revert "std.c: freebsd add procctl exclusive x86_64 flags"
This reverts commit 3fb93fc8f2.
2023-07-31 11:17:20 -07:00
Andrew Kelley
1d4e6e6c73 Revert "std.c: add essential freebsd's capsicum api subset."
This reverts commit 6ae19fa48d.
2023-07-31 11:17:11 -07:00
Andrew Kelley
f96f57930c Revert "std.c: adding freebsd's CPU_COUNT macro portage."
This reverts commit b9841750f9.
2023-07-31 11:14:03 -07:00
Andrew Kelley
afca695b64 Revert "std.c: adding freebsd's kinfo_proc type."
This reverts commit 3dd0afe787.
2023-07-31 11:10:56 -07:00
Andrew Kelley
8c7eb8c8da Revert "std.c: adding freebsd's domainset api"
This reverts commit e8f76b452b.
2023-07-31 11:09:34 -07:00
Andrew Kelley
a048ddaf91 Revert "std.c: adding freebsd's domainset_t bitset"
This reverts commit 10a7cf58c1.
2023-07-31 11:09:16 -07:00
Andrew Kelley
ac7be71d8e Revert "std.c: add freebsd's kinfo_vmobject"
This reverts commit 5260657230.
2023-07-31 11:05:38 -07:00
Andrew Kelley
6d7c6f4da7 Revert "std.c: adding freebsd's ioctl base operands."
This reverts commit cd7e2bf57a.
2023-07-31 11:05:21 -07:00
Andrew Kelley
86a5edca62 Revert "std.os: implementing sched_setaffinity wrapper for freebsd"
This reverts commit 05268bb967.
2023-07-31 10:58:03 -07:00
Andrew Kelley
e1fdd21f0e Revert "std.c: add rfork for freebsd"
This reverts commit 2952fb9758.
2023-07-31 10:57:35 -07:00
Andrew Kelley
b7e37f9ddc Revert "std.c: add ptrace for freebsd support."
This reverts commit b754068fbc.
2023-07-31 10:57:12 -07:00
Andrew Kelley
9d798ead63 Revert "std.c: fix freebsd's CPU_ISSET call"
This reverts commit 768965788e.
2023-07-31 10:54:45 -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 41502c6aa5.
2023-07-31 10:54:35 -07:00
Andrew Kelley
ba3b352891 Revert "std.os: fix uname usage."
This reverts commit 138f1253de.
2023-07-31 10:52:12 -07:00
Andrew Kelley
9f20d01cfb Revert "std.c: exposing timer api"
This reverts commit 54ea0bbcdd.
2023-07-31 10:51:44 -07:00
Andrew Kelley
643c986838 Revert "std.c: freebsd fix typo for PROC.PROCCTL_MD_MIN constant."
This reverts commit e9dd0a22f0.
2023-07-31 10:50:27 -07:00
Andrew Kelley
381704dd0e Revert "std.c: fix few capcisum api calls, following-up on 6ae19fa."
This reverts commit 72dd22f262.
2023-07-31 10:50:16 -07:00
Andrew Kelley
88b4ee172f Revert "std.c: few freebsd's kinfo api fixes."
This reverts commit d07149c56d.
2023-07-31 10:50:09 -07:00
Andrew Kelley
95e2605d30 Revert "std.c: msghdr* struct removing prefixes to match linux."
This reverts commit 8f14431bc8.
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
David CARLIER
d07149c56d std.c: few freebsd's kinfo api fixes.
following up on 4a0508e and 3dd0afe.

- kinfo_vmentry, removing kve_ prefix.
- kinfo_getproc, returns one entry at most.
2023-06-25 12:27:45 -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
72dd22f262 std.c: fix few capcisum api calls, following-up on 6ae19fa.
only variadic calls are prefixed with underscores.

ref: 59833b089e/sys/sys/capsicum.h (L326)
2023-06-24 13:05:45 -07:00
David CARLIER
e9dd0a22f0 std.c: freebsd fix typo for PROC.PROCCTL_MD_MIN constant.
follow-up on 2e2d379.
2023-06-24 12:59:18 -07: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
Michael Dusan
64ddba955a
freebsd: fix std.c.getdents
- fix getdents return type usize → isize
- usize ultimately forced errors to .SUCCESS in std.c.getError

New behavior in freebsd 13.2 is to return ENOENT if the directory being
iterated is deleted during iteration. We now detect this and treat it
consistent with iteration ending.
2023-06-15 14:48:19 -04:00