authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2025-12-17 18:20:13 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2025-12-17 18:20:13 -08:00
logc2ffce3206974adc0924992585359d28c1974d14
tree009a25ae32a6325fbafa9919116188d5315cef84
parentcc75b7f652c7cd51cbfa6e3c7e8155cd153bb68b

use nektro/zig-sys-linux instead of std.os


4 files changed, 15 insertions(+), 8 deletions(-)

licenses.txt+4
......@@ -2,3 +2,7 @@ MIT:
22= https://spdx.org/licenses/MIT
33- This
44- git https://github.com/nektro/zig-extras
5- git https://github.com/nektro/zig-sys-linux
6
7Unspecified:
8- system_lib c
src/chrome.zig+5-4
......@@ -3,15 +3,16 @@ const tracer = @import("./mod.zig");
33const alloc = std.heap.c_allocator;
44const log = std.log.scoped(.tracer);
55const root = @import("root");
6const linux = @import("sys-linux");
67
7var pid: std.os.linux.pid_t = undefined;
8threadlocal var tid: std.os.linux.pid_t = undefined;
8var pid: linux.pid_t = undefined;
9threadlocal var tid: linux.pid_t = undefined;
910threadlocal var path: []const u8 = undefined;
1011threadlocal var file: std.fs.File = undefined;
1112threadlocal var buffered_writer: std.io.BufferedWriter(4096, std.fs.File.Writer) = undefined;
1213
1314pub fn init() !void {
14 pid = std.os.linux.getpid();
15 pid = linux.getpid();
1516}
1617
1718pub fn deinit() void {
......@@ -19,7 +20,7 @@ pub fn deinit() void {
1920}
2021
2122pub fn init_thread(dir: std.fs.Dir) !void {
22 tid = std.os.linux.gettid();
23 tid = linux.gettid();
2324
2425 path = try std.fmt.allocPrint(alloc, "trace.{d}.{d}.chrome.json", .{ pid, tid });
2526 file = try dir.createFile(path, .{});
src/spall.zig+5-4
......@@ -3,15 +3,16 @@ const tracer = @import("./mod.zig");
33const alloc = std.heap.c_allocator;
44const log = std.log.scoped(.tracer);
55const root = @import("root");
6const linux = @import("sys-linux");
67
7var pid: std.os.linux.pid_t = undefined;
8threadlocal var tid: std.os.linux.pid_t = undefined;
8var pid: linux.pid_t = undefined;
9threadlocal var tid: linux.pid_t = undefined;
910threadlocal var path: []const u8 = undefined;
1011threadlocal var file: std.fs.File = undefined;
1112threadlocal var buffered_writer: std.io.BufferedWriter(4096, std.fs.File.Writer) = undefined;
1213
1314pub fn init() !void {
14 pid = std.os.linux.getpid();
15 pid = linux.getpid();
1516}
1617
1718pub fn deinit() void {
......@@ -19,7 +20,7 @@ pub fn deinit() void {
1920}
2021
2122pub fn init_thread(dir: std.fs.Dir) !void {
22 tid = std.os.linux.gettid();
23 tid = linux.gettid();
2324
2425 path = try std.fmt.allocPrint(alloc, "{d}.{d}.spall", .{ pid, tid });
2526 file = try dir.createFile(path, .{});
zigmod.yml+1
......@@ -5,3 +5,4 @@ license: MIT
55description: Generic tracing library for Zig, supports multiple backends.
66dependencies:
77 - src: git https://github.com/nektro/zig-extras
8 - src: git https://github.com/nektro/zig-sys-linux