std.os: more reorganization efforts

* 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`
This commit is contained in:
Andrew Kelley
2021-08-25 00:00:39 -07:00
parent c09ba8796c
commit 7f03cfe161
43 changed files with 3092 additions and 3226 deletions

View File

@@ -877,8 +877,8 @@ const LinuxThreadImpl = struct {
const mapped = os.mmap(
null,
map_bytes,
os.PROT_NONE,
os.MAP_PRIVATE | os.MAP_ANONYMOUS,
os.PROT.NONE,
os.MAP.PRIVATE | os.MAP.ANONYMOUS,
-1,
0,
) catch |err| switch (err) {
@@ -893,7 +893,7 @@ const LinuxThreadImpl = struct {
// map everything but the guard page as read/write
os.mprotect(
mapped[guard_offset..],
os.PROT_READ | os.PROT_WRITE,
os.PROT.READ | os.PROT.WRITE,
) catch |err| switch (err) {
error.AccessDenied => unreachable,
else => |e| return e,
@@ -923,10 +923,10 @@ const LinuxThreadImpl = struct {
.thread = .{ .mapped = mapped },
};
const flags: u32 = os.CLONE_THREAD | os.CLONE_DETACHED |
os.CLONE_VM | os.CLONE_FS | os.CLONE_FILES |
os.CLONE_PARENT_SETTID | os.CLONE_CHILD_CLEARTID |
os.CLONE_SIGHAND | os.CLONE_SYSVSEM | os.CLONE_SETTLS;
const flags: u32 = linux.CLONE.THREAD | linux.CLONE.DETACHED |
linux.CLONE.VM | linux.CLONE.FS | linux.CLONE.FILES |
linux.CLONE.PARENT_SETTID | linux.CLONE.CHILD_CLEARTID |
linux.CLONE.SIGHAND | linux.CLONE.SYSVSEM | linux.CLONE.SETTLS;
switch (linux.getErrno(linux.clone(
Instance.entryFn,
@@ -978,7 +978,7 @@ const LinuxThreadImpl = struct {
switch (linux.getErrno(linux.futex_wait(
&self.thread.child_tid.value,
linux.FUTEX_WAIT,
linux.FUTEX.WAIT,
tid,
null,
))) {