| author | |
| committer | |
| log | 6ca1c88e46352b006c26d4c99944ac0c70fe28e7 |
| tree | fa136a1969b073416d59fcbdc5977355640a5652 |
| parent | 6984992153f0656b04c39279f9684fd5a06e952d |
| parent | ac4c9b8fb29f30692b40d35db533e7c4e80300b4 |
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30609
Reviewed-by: Andrew Kelley <andrewrk@noreply.codeberg.org>3 files changed, 15 insertions(+), 6 deletions(-)
lib/std/Io/Threaded.zig+3-3| ... | ... | @@ -7209,7 +7209,7 @@ fn processExecutablePath(userdata: ?*anyopaque, out_buffer: []u8) std.process.Ex |
| 7209 | 7209 | .openbsd, .haiku => { |
| 7210 | 7210 | // The best we can do on these operating systems is check based on |
| 7211 | 7211 | // the first process argument. |
| 7212 | const argv0 = t.argv0.value orelse return error.OperationUnsupported; | |
| 7212 | const argv0 = std.mem.span(t.argv0.value orelse return error.OperationUnsupported); | |
| 7213 | 7213 | if (std.mem.findScalar(u8, argv0, '/') != null) { |
| 7214 | 7214 | // argv[0] is a path (relative or absolute): use realpath(3) directly |
| 7215 | 7215 | const current_thread = Thread.getCurrent(t); |
| ... | ... | @@ -12153,7 +12153,7 @@ fn scanEnviron(t: *Threaded) void { |
| 12153 | 12153 | |
| 12154 | 12154 | var end_i: usize = line_i; |
| 12155 | 12155 | while (line[end_i] != 0) : (end_i += 1) {} |
| 12156 | const value = line[line_i + 1 .. end_i]; | |
| 12156 | const value = line[line_i + 1 .. end_i :0]; | |
| 12157 | 12157 | |
| 12158 | 12158 | if (std.mem.eql(u8, key, "NO_COLOR")) { |
| 12159 | 12159 | t.environ.exist.NO_COLOR = true; |
| ... | ... | @@ -12171,7 +12171,7 @@ fn scanEnviron(t: *Threaded) void { |
| 12171 | 12171 | |
| 12172 | 12172 | var end_i: usize = line_i; |
| 12173 | 12173 | while (line[end_i] != 0) : (end_i += 1) {} |
| 12174 | const value = line[line_i + 1 .. end_i]; | |
| 12174 | const value = line[line_i + 1 .. end_i :0]; | |
| 12175 | 12175 | |
| 12176 | 12176 | if (std.mem.eql(u8, key, "NO_COLOR")) { |
| 12177 | 12177 | t.environ.exist.NO_COLOR = true; |
lib/std/c.zig+8-1| ... | ... | @@ -10651,7 +10651,12 @@ pub extern "c" fn unlink(path: [*:0]const u8) c_int; |
| 10651 | 10651 | pub extern "c" fn unlinkat(dirfd: fd_t, path: [*:0]const u8, flags: c_uint) c_int; |
| 10652 | 10652 | pub extern "c" fn getcwd(buf: [*]u8, size: usize) ?[*]u8; |
| 10653 | 10653 | pub extern "c" fn waitpid(pid: pid_t, status: ?*c_int, options: c_int) pid_t; |
| 10654 | pub extern "c" fn wait4(pid: pid_t, status: ?*c_int, options: c_int, ru: ?*rusage) pid_t; | |
| 10654 | ||
| 10655 | pub const wait4 = switch (native_os) { | |
| 10656 | .netbsd => private.__wait450, | |
| 10657 | else => private.wait4, | |
| 10658 | }; | |
| 10659 | ||
| 10655 | 10660 | pub const fork = switch (native_os) { |
| 10656 | 10661 | .dragonfly, |
| 10657 | 10662 | .freebsd, |
| ... | ... | @@ -11440,6 +11445,7 @@ const private = struct { |
| 11440 | 11445 | extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int; |
| 11441 | 11446 | extern "c" fn sysconf(sc: c_int) c_long; |
| 11442 | 11447 | extern "c" fn shm_open(name: [*:0]const u8, flag: c_int, mode: mode_t) c_int; |
| 11448 | extern "c" fn wait4(pid: pid_t, status: ?*c_int, options: c_int, ru: ?*rusage) pid_t; | |
| 11443 | 11449 | |
| 11444 | 11450 | extern "c" fn pthread_setname_np(thread: pthread_t, name: [*:0]const u8) c_int; |
| 11445 | 11451 | |
| ... | ... | @@ -11492,6 +11498,7 @@ const private = struct { |
| 11492 | 11498 | extern "c" fn __stat50(path: [*:0]const u8, buf: *Stat) c_int; |
| 11493 | 11499 | extern "c" fn __getdents30(fd: c_int, buf_ptr: [*]u8, nbytes: usize) c_int; |
| 11494 | 11500 | extern "c" fn __sigaltstack14(ss: ?*stack_t, old_ss: ?*stack_t) c_int; |
| 11501 | extern "c" fn __wait450(pid: pid_t, status: ?*c_int, options: c_int, ru: ?*rusage) pid_t; | |
| 11495 | 11502 | |
| 11496 | 11503 | extern "c" fn __libc_current_sigrtmin() c_int; |
| 11497 | 11504 | extern "c" fn __libc_current_sigrtmax() c_int; |
src/main.zig+4-2| ... | ... | @@ -198,7 +198,7 @@ pub fn main() anyerror!void { |
| 198 | 198 | return mainArgs(gpa, arena, args); |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | fn mainArgs(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { | |
| 201 | fn mainArgs(gpa: Allocator, arena: Allocator, args: []const [:0]const u8) !void { | |
| 202 | 202 | const tr = tracy.trace(@src()); |
| 203 | 203 | defer tr.end(); |
| 204 | 204 | |
| ... | ... | @@ -241,7 +241,9 @@ fn mainArgs(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { |
| 241 | 241 | } |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | var threaded: Io.Threaded = .init(gpa, .{}); | |
| 244 | var threaded: Io.Threaded = .init(gpa, .{ | |
| 245 | .argv0 = if (@hasField(Io.Threaded.Argv0, "value")) .{ .value = args[0] } else .{}, | |
| 246 | }); | |
| 245 | 247 | defer threaded.deinit(); |
| 246 | 248 | threaded_impl_ptr = &threaded; |
| 247 | 249 | threaded.stack_size = thread_stack_size; |