Commit graph

478 commits

Author SHA1 Message Date
David CARLIER
1de64dba23 std: add the VM_MAKE_TAG macro for darwin. 2023-03-26 23:56:27 +02:00
Jakub Konka
6f15eedff1 darwin: put posix spawn constants in POSIX_SPAWN struct 2023-03-18 21:54:05 +01:00
Jakub Konka
37192bcdcb macos: HCS PoC working 2023-03-18 21:53:36 +01:00
Jakub Konka
266c81322e darwin: resurrect posix_spawn wrappers 2023-03-18 21:53:15 +01:00
Jakub Konka
e1e414e62a std: move os/darwin.zig and related to c/darwin.zig
Move to c/darwin.zig as they really are libSystem/libc imports/wrappers.

As an added bonus, get rid of the nasty `usingnamespace`s which are now
unneeded.

Finally, add `os.ptrace` but currently only implemented on darwin.
2023-03-16 11:42:30 +01: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
Stephen Gregoratto
7f635ae7bd FreeBSD: add mcontext_t for aarch64
What isn't disabled for test-std mostly passes, except for the copysign
and signbit tests for f16. Seemingly related to #14366.
2023-01-21 23:20:50 +02:00
mlugg
d3599ec73c std: implement os.mprotect on Windows 2023-01-20 03:33:35 +02: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
571b817abc
freebsd: add std.c.arc4random_buf 2023-01-02 19:18:33 -05:00
Michael Dusan
69553d60da
dragonfly: add std.c.arc4random_buf
This allows for a more optimal std.crypto.tlcsprng codepath.

Without it a an "incorrect alignment" panic is triggered from
crypto.tlcsprng which aligns a threadlocal but it's actually
not aligned, thus detected by the safety check.

It appears that LLVM-IR does attribute the storage with alignment
but it is ultimately not respected in the final binary for netbsd
and dragonfly.
2023-01-02 19:18:33 -05:00
Michael Dusan
e752606464
netbsd: getFdPath: F_GETPATH implementation 2023-01-02 19:18:33 -05:00
Michael Dusan
7da9348637
dragonfly: getFdPath: F_GETPATH implementation 2023-01-02 19:18:33 -05:00
Michael Dusan
537624734c
freebsd: getFdPath: < 13.1 fallback impl 2023-01-02 19:18:32 -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
Ganesan Rajagopal
06f70c030a Fix missing pthread_key_t definition on linux
* pthread_key_t should also be available for non-android platforms
* Also change the type to c_uint because Linux pthreadtypes.h typedefs it as "unsigned int"

Partially addresses #13950
2022-12-21 17:00:41 -05:00
Andrew Kelley
353121d9d5 std.c.fstatat64: add noalias attributes 2022-12-14 14:26:02 -07:00
Jakub Konka
ec2697b7ea darwin: add even more wrappers for Mach syscalls
Rename `ThreadId` to `MachThread`.
2022-12-14 00:10:26 +01:00
Jakub Konka
f505cb96f4 darwin: add thread_act_t wrapper and helpers 2022-12-13 12:53:10 +01:00
Jakub Konka
2efd0eb884 darwin: wrap task_threads mach syscall 2022-12-13 11:36:00 +01:00
Jakub Konka
6f5eb9927d darwin: add more defs and wrappers 2022-12-12 20:04:46 +01:00
Jakub Konka
612b9f4da1 darwin: add defs and funcs for Mach exception handling 2022-12-12 00:13:37 +01:00
Jakub Konka
402dfb5fd3 darwin: wrap mach_port_insert_right kernel call 2022-12-11 18:27:10 +01:00
Jakub Konka
2a65971eb0 darwin: wrap allocating and deallocating mach ports for a task 2022-12-11 14:40:27 +01: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
Stevie Hryciw
04f3067a79 run zig fmt on everything checked by CI 2022-11-18 19:22:42 +00: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
Ali Chraghi
aea617c60b std.os: take advantage of the freebsd's copy_file_range 2022-11-05 15:43:39 -04:00
Ryan Schneider
7f1f2e653d std.os: fix alignment of Sigaction.handler_fn
Fixes #13216
2022-11-04 08:00:50 -07:00
Ali Chraghi
f5f1f8c666 all: rename i386 to x86 2022-11-04 00:09:27 +03:30
Ryan Liptak
db80225a97 fs: Some NAME_MAX/MAX_NAME_BYTES improvements 2022-10-29 14:30:46 -07:00
Ryan Liptak
33fdc43714 std.fs: Add MAX_NAME_BYTES
Also add some NAME_MAX or equivalent definitions where necessary
2022-10-29 14:30:43 -07:00
Louis Pearson
8d4778b4f9
Support compiling for the android NDK (#13245) 2022-10-21 18:32:56 -04:00
Ali Chraghi
fb366f3cd4 std.c: fix incorrect return types
Closes #12964
2022-10-13 13:21:19 +02:00
ominitay
295451dfe5
std: Replace use of stage1 function pointers 2022-09-29 21:45:30 +03:00
Bill Nagel
eeeda53423 add missing darwin types 2022-09-23 12:25:40 +03:00
billzez
dfcadd22bb
fix android definition of pthread_rwlock_t (#12830) 2022-09-16 20:20:24 -05:00
Stephen Gregoratto
7ccb94fac8 Audit FreeBSD structs to match header files/ABI
The big outliers were `Stat` and `mcontext_t`. Also adds doc-comments
from the headers where possible.
2022-09-14 20:05:54 -04:00
Sébastien Marie
8bcb962ada openbsd: fix sigcontext struct and avoid defining fxsave64
`sc_fpstate` member of `struct sigcontext` is a `struct fxsave64 *`.
use *anyopaque to represent it.

avoid to defining `fxsave64` as it is a packed struct with some arrays.
2022-08-26 17:30:07 +02:00
zooster
4055e6055b
AstGen: disallow leading zeroes in int literals and int types
This makes `0123` and `u0123` etc. illegal.

I'm now confident that this is a good change because
I actually caught two C header translation mistakes in `haiku.zig` with this.
Clearly, `0123` being octal in C (TIL) can cause confusion, and we make this easier to read by
requiring `0o` as the prefix and now also disallowing leading zeroes in integers.

For consistency and because it looks weird, we disallow it for integer types too (e.g. `u0123`).

Fixes #11963
Fixes #12417
2022-08-18 19:54:51 +03:00
Isaac Freund
b78f3bf1f1
std: fix definition of SIG_IGN, SIG_DFL, etc.
POSIX specifies that the sa_handler field of the sigaction struct may
be set to SIG_IGN or SIG_DFL. However, the current constants in the
standard library use the function pointer signature corresponding to
the sa_sigaction field instead.

This may not cause issues in practice because the fields usually occupy
the same memory in a union, but this isn't required by POSIX and there
may be systems we do not yet support that do this differently.

Fixing this also makes the Zig interface less confusing to use after
reading the man page.
2022-08-11 12:09:34 +02:00
Kim SHrier
397e6547a9 add FreeBSD support to std.os.getFdPath
This implementation uses the F_KINFO fcntl command added in FreeBSD
13 release. FreeBSD 12 users get a compile error.

Co-authored-by: Stephen Gregoratto <dev@sgregoratto.me>
2022-07-15 10:16:31 +03:00
Veikka Tuominen
122c76a167 Sema: allow void as an extern union field & fix invalid extern unions 2022-07-11 20:30:16 +03:00
Andrew Kelley
9c5056788f std: update bsd bits to new fn ptr semantics 2022-07-04 13:02:30 -07:00
Jonathan Marler
523fae420b add const to msghdr_const iov and control pointers
alongside the typical msghdr struct, Zig has added a msghdr_const
type that can be used with sendmsg which allows const data to
be provided.  I believe that data pointed to by the iov and control
fields in msghdr are also left unmodified, in which case they can
be marked const as well.
2022-06-07 15:23:44 -04:00
Yuto Oguchi
43373e61fa
std.c: Fix incorrect dirent structure (#11602)
d_name is a null-terminated string, but it is not guaranteed that the
last byte of the array is null.
2022-05-26 20:15:51 -04:00
Andrew Kelley
e0a0df5a8a
Merge pull request #11598 from aiotter/master
Add functions from `dirent.h` to std.c
2022-05-26 20:11:54 -04:00
aiotter
552ef5f2e4 std.c: Implement dirent on std/c/linux.zig 2022-05-17 15:23:55 +09:00