| author | |
| committer | |
| log | 41502c6aa53a3da31b276c23c4db74db7d04796b |
| tree | b1118c8e6c6042ff6fddeaf01dd97b2e236b52c2 |
| parent | 230ea411f72303607a8c5c5467258eee61bd6939 |
| signature |
12 files changed, 48 insertions(+), 1 deletions(-)
lib/std/Thread.zig+1-1| ... | @@ -690,7 +690,7 @@ const PosixThreadImpl = struct { | ... | @@ -690,7 +690,7 @@ const PosixThreadImpl = struct { |
| 690 | defer assert(c.pthread_attr_destroy(&attr) == .SUCCESS); | 690 | defer assert(c.pthread_attr_destroy(&attr) == .SUCCESS); |
| 691 | 691 | ||
| 692 | // Use the same set of parameters used by the libc-less impl. | 692 | // Use the same set of parameters used by the libc-less impl. |
| 693 | const stack_size = std.math.max(config.stack_size, 16 * 1024); | 693 | const stack_size = std.math.max(config.stack_size, c.PTHREAD_STACK_MIN); |
| 694 | assert(c.pthread_attr_setstacksize(&attr, stack_size) == .SUCCESS); | 694 | assert(c.pthread_attr_setstacksize(&attr, stack_size) == .SUCCESS); |
| 695 | assert(c.pthread_attr_setguardsize(&attr, std.mem.page_size) == .SUCCESS); | 695 | assert(c.pthread_attr_setguardsize(&attr, std.mem.page_size) == .SUCCESS); |
| 696 | 696 |
lib/std/c/darwin.zig+6| ... | @@ -4155,3 +4155,9 @@ pub const vm_extmod_statistics_t = *vm_extmod_statistics; | ... | @@ -4155,3 +4155,9 @@ pub const vm_extmod_statistics_t = *vm_extmod_statistics; |
| 4155 | pub const vm_extmod_statistics_data_t = vm_extmod_statistics; | 4155 | pub const vm_extmod_statistics_data_t = vm_extmod_statistics; |
| 4156 | 4156 | ||
| 4157 | pub extern "c" fn vm_stats(info: ?*anyopaque, count: *c_uint) kern_return_t; | 4157 | pub extern "c" fn vm_stats(info: ?*anyopaque, count: *c_uint) kern_return_t; |
| 4158 | |||
| 4159 | /// TODO refines if necessary | ||
| 4160 | pub const PTHREAD_STACK_MIN = switch (builtin.cpu.arch) { | ||
| 4161 | .arm, .aarch64 => 16 * 1024, | ||
| 4162 | else => 8 * 1024, | ||
| 4163 | }; |
lib/std/c/dragonfly.zig+2| ... | @@ -1160,3 +1160,5 @@ pub const sigevent = extern struct { | ... | @@ -1160,3 +1160,5 @@ pub const sigevent = extern struct { |
| 1160 | sigev_value: sigval, | 1160 | sigev_value: sigval, |
| 1161 | sigev_notify_function: ?*const fn (sigval) callconv(.C) void, | 1161 | sigev_notify_function: ?*const fn (sigval) callconv(.C) void, |
| 1162 | }; | 1162 | }; |
| 1163 | |||
| 1164 | pub const PTHREAD_STACK_MIN = 16 * 1024; |
lib/std/c/emscripten.zig+2| ... | @@ -9,3 +9,5 @@ pub const pthread_rwlock_t = extern struct { | ... | @@ -9,3 +9,5 @@ pub const pthread_rwlock_t = extern struct { |
| 9 | }; | 9 | }; |
| 10 | const __SIZEOF_PTHREAD_COND_T = 48; | 10 | const __SIZEOF_PTHREAD_COND_T = 48; |
| 11 | const __SIZEOF_PTHREAD_MUTEX_T = 28; | 11 | const __SIZEOF_PTHREAD_MUTEX_T = 28; |
| 12 | |||
| 13 | pub const PTHREAD_STACK_MIN = 2048; |
lib/std/c/freebsd.zig+6| ... | @@ -2818,3 +2818,9 @@ pub const ptrace_cs_remote = extern struct { | ... | @@ -2818,3 +2818,9 @@ pub const ptrace_cs_remote = extern struct { |
| 2818 | }; | 2818 | }; |
| 2819 | 2819 | ||
| 2820 | pub extern "c" fn ptrace(request: c_int, pid: pid_t, addr: [*:0]u8, data: c_int) c_int; | 2820 | pub extern "c" fn ptrace(request: c_int, pid: pid_t, addr: [*:0]u8, data: c_int) c_int; |
| 2821 | |||
| 2822 | /// TODO refines if necessary | ||
| 2823 | pub const PTHREAD_STACK_MIN = switch (builtin.cpu.arch) { | ||
| 2824 | .x86, .powerpc => 4 * 512, | ||
| 2825 | else => 4 * 1024, | ||
| 2826 | }; |
lib/std/c/haiku.zig+3| ... | @@ -1068,3 +1068,6 @@ pub const sigevent = extern struct { | ... | @@ -1068,3 +1068,6 @@ pub const sigevent = extern struct { |
| 1068 | sigev_notify_function: ?*const fn (sigval) callconv(.C) void, | 1068 | sigev_notify_function: ?*const fn (sigval) callconv(.C) void, |
| 1069 | sigev_notify_attributes: ?*pthread_attr_t, | 1069 | sigev_notify_attributes: ?*pthread_attr_t, |
| 1070 | }; | 1070 | }; |
| 1071 | |||
| 1072 | /// TODO refines if necessary | ||
| 1073 | pub const PTHREAD_STACK_MIN = 2 * 4096; |
lib/std/c/linux.zig+12| ... | @@ -350,6 +350,18 @@ const __SIZEOF_PTHREAD_MUTEX_T = switch (native_abi) { | ... | @@ -350,6 +350,18 @@ const __SIZEOF_PTHREAD_MUTEX_T = switch (native_abi) { |
| 350 | }; | 350 | }; |
| 351 | const __SIZEOF_SEM_T = 4 * @sizeOf(usize); | 351 | const __SIZEOF_SEM_T = 4 * @sizeOf(usize); |
| 352 | 352 | ||
| 353 | /// TODO refines if necessary | ||
| 354 | pub const PTHREAD_STACK_MIN = switch (native_abi) { | ||
| 355 | .musl, .musleabi, .musleabihf => 2048, | ||
| 356 | .gnu, .gnuabin32, .gnuabi64, .gnueabi, .gnueabihf, .gnux32 => switch (native_arch) { | ||
| 357 | .aarch64, .arm, .armeb, .powerpc, .powerpc64, .powerpc64le, .loongarch32, .loongarch64 => 131072, | ||
| 358 | .sparc64 => 24576, | ||
| 359 | else => 16 * 1024, | ||
| 360 | }, | ||
| 361 | .android => if (@sizeOf(usize) == 8) 16 * 1024 else 8 * 1024, | ||
| 362 | else => 16 * 1024, | ||
| 363 | }; | ||
| 364 | |||
| 353 | pub extern "c" fn pthread_setname_np(thread: std.c.pthread_t, name: [*:0]const u8) E; | 365 | pub extern "c" fn pthread_setname_np(thread: std.c.pthread_t, name: [*:0]const u8) E; |
| 354 | pub extern "c" fn pthread_getname_np(thread: std.c.pthread_t, name: [*:0]u8, len: usize) E; | 366 | pub extern "c" fn pthread_getname_np(thread: std.c.pthread_t, name: [*:0]u8, len: usize) E; |
| 355 | 367 |
lib/std/c/minix.zig+2| ... | @@ -16,3 +16,5 @@ const __SIZEOF_PTHREAD_MUTEX_T = switch (builtin.abi) { | ... | @@ -16,3 +16,5 @@ const __SIZEOF_PTHREAD_MUTEX_T = switch (builtin.abi) { |
| 16 | }, | 16 | }, |
| 17 | else => unreachable, | 17 | else => unreachable, |
| 18 | }; | 18 | }; |
| 19 | |||
| 20 | pub const PTHREAD_STACK_MIN = 16 * 1024; |
lib/std/c/netbsd.zig+3| ... | @@ -1720,3 +1720,6 @@ pub const PIOD = struct { | ... | @@ -1720,3 +1720,6 @@ pub const PIOD = struct { |
| 1720 | }; | 1720 | }; |
| 1721 | 1721 | ||
| 1722 | pub extern "c" fn ptrace(request: c_int, pid: pid_t, addr: ?*anyopaque, data: c_int) c_int; | 1722 | pub extern "c" fn ptrace(request: c_int, pid: pid_t, addr: ?*anyopaque, data: c_int) c_int; |
| 1723 | |||
| 1724 | /// TODO refines if necessary | ||
| 1725 | pub const PTHREAD_STACK_MIN = 16 * 1024; |
lib/std/c/openbsd.zig+7| ... | @@ -1631,3 +1631,10 @@ pub const HW_ALLOWPOWERDOWN = 22; | ... | @@ -1631,3 +1631,10 @@ pub const HW_ALLOWPOWERDOWN = 22; |
| 1631 | pub const HW_PERFPOLICY = 23; | 1631 | pub const HW_PERFPOLICY = 23; |
| 1632 | pub const HW_SMT = 24; | 1632 | pub const HW_SMT = 24; |
| 1633 | pub const HW_NCPUONLINE = 25; | 1633 | pub const HW_NCPUONLINE = 25; |
| 1634 | |||
| 1635 | /// TODO refines if necessary | ||
| 1636 | pub const PTHREAD_STACK_MIN = switch (builtin.cpu.arch) { | ||
| 1637 | .sparc64 => 1 << 13, | ||
| 1638 | .mips64 => 1 << 14, | ||
| 1639 | else => 1 << 12, | ||
| 1640 | }; |
lib/std/c/solaris.zig+2| ... | @@ -1946,3 +1946,5 @@ pub const sigevent = extern struct { | ... | @@ -1946,3 +1946,5 @@ pub const sigevent = extern struct { |
| 1946 | sigev_notify_function: ?*const fn (sigval) callconv(.C) void, | 1946 | sigev_notify_function: ?*const fn (sigval) callconv(.C) void, |
| 1947 | sigev_notify_attributes: ?*pthread_attr_t, | 1947 | sigev_notify_attributes: ?*pthread_attr_t, |
| 1948 | }; | 1948 | }; |
| 1949 | |||
| 1950 | pub const PTHREAD_STACK_MIN = if (@sizeOf(usize) == 8) 8 * 1024 else 4 * 1024; |
lib/std/c/wasi.zig+2| ... | @@ -119,3 +119,5 @@ pub const POLL = struct { | ... | @@ -119,3 +119,5 @@ pub const POLL = struct { |
| 119 | pub const HUP = 0x2000; | 119 | pub const HUP = 0x2000; |
| 120 | pub const NVAL = 0x4000; | 120 | pub const NVAL = 0x4000; |
| 121 | }; | 121 | }; |
| 122 | |||
| 123 | pub const PTHREAD_STACK_MIN = 16 * 1024; |