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:...@@ -2,3 +2,7 @@ MIT:
2= https://spdx.org/licenses/MIT2= https://spdx.org/licenses/MIT
3- This3- This
4- git https://github.com/nektro/zig-extras4- 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");...@@ -3,15 +3,16 @@ const tracer = @import("./mod.zig");
3const alloc = std.heap.c_allocator;3const alloc = std.heap.c_allocator;
4const log = std.log.scoped(.tracer);4const log = std.log.scoped(.tracer);
5const root = @import("root");5const root = @import("root");
6const linux = @import("sys-linux");
67
7var pid: std.os.linux.pid_t = undefined;8var pid: linux.pid_t = undefined;
8threadlocal var tid: std.os.linux.pid_t = undefined;9threadlocal var tid: linux.pid_t = undefined;
9threadlocal var path: []const u8 = undefined;10threadlocal var path: []const u8 = undefined;
10threadlocal var file: std.fs.File = undefined;11threadlocal var file: std.fs.File = undefined;
11threadlocal var buffered_writer: std.io.BufferedWriter(4096, std.fs.File.Writer) = undefined;12threadlocal var buffered_writer: std.io.BufferedWriter(4096, std.fs.File.Writer) = undefined;
1213
13pub fn init() !void {14pub fn init() !void {
14 pid = std.os.linux.getpid();15 pid = linux.getpid();
15}16}
1617
17pub fn deinit() void {18pub fn deinit() void {
...@@ -19,7 +20,7 @@ pub fn deinit() void {...@@ -19,7 +20,7 @@ pub fn deinit() void {
19}20}
2021
21pub fn init_thread(dir: std.fs.Dir) !void {22pub fn init_thread(dir: std.fs.Dir) !void {
22 tid = std.os.linux.gettid();23 tid = linux.gettid();
2324
24 path = try std.fmt.allocPrint(alloc, "trace.{d}.{d}.chrome.json", .{ pid, tid });25 path = try std.fmt.allocPrint(alloc, "trace.{d}.{d}.chrome.json", .{ pid, tid });
25 file = try dir.createFile(path, .{});26 file = try dir.createFile(path, .{});
src/spall.zig+5-4
...@@ -3,15 +3,16 @@ const tracer = @import("./mod.zig");...@@ -3,15 +3,16 @@ const tracer = @import("./mod.zig");
3const alloc = std.heap.c_allocator;3const alloc = std.heap.c_allocator;
4const log = std.log.scoped(.tracer);4const log = std.log.scoped(.tracer);
5const root = @import("root");5const root = @import("root");
6const linux = @import("sys-linux");
67
7var pid: std.os.linux.pid_t = undefined;8var pid: linux.pid_t = undefined;
8threadlocal var tid: std.os.linux.pid_t = undefined;9threadlocal var tid: linux.pid_t = undefined;
9threadlocal var path: []const u8 = undefined;10threadlocal var path: []const u8 = undefined;
10threadlocal var file: std.fs.File = undefined;11threadlocal var file: std.fs.File = undefined;
11threadlocal var buffered_writer: std.io.BufferedWriter(4096, std.fs.File.Writer) = undefined;12threadlocal var buffered_writer: std.io.BufferedWriter(4096, std.fs.File.Writer) = undefined;
1213
13pub fn init() !void {14pub fn init() !void {
14 pid = std.os.linux.getpid();15 pid = linux.getpid();
15}16}
1617
17pub fn deinit() void {18pub fn deinit() void {
...@@ -19,7 +20,7 @@ pub fn deinit() void {...@@ -19,7 +20,7 @@ pub fn deinit() void {
19}20}
2021
21pub fn init_thread(dir: std.fs.Dir) !void {22pub fn init_thread(dir: std.fs.Dir) !void {
22 tid = std.os.linux.gettid();23 tid = linux.gettid();
2324
24 path = try std.fmt.allocPrint(alloc, "{d}.{d}.spall", .{ pid, tid });25 path = try std.fmt.allocPrint(alloc, "{d}.{d}.spall", .{ pid, tid });
25 file = try dir.createFile(path, .{});26 file = try dir.createFile(path, .{});
zigmod.yml+1
...@@ -5,3 +5,4 @@ license: MIT...@@ -5,3 +5,4 @@ license: MIT
5description: Generic tracing library for Zig, supports multiple backends.5description: Generic tracing library for Zig, supports multiple backends.
6dependencies:6dependencies:
7 - src: git https://github.com/nektro/zig-extras7 - src: git https://github.com/nektro/zig-extras
8 - src: git https://github.com/nektro/zig-sys-linux