How to get current process id in zig?

howt to get current process id in zig?

There’s currently no cross-platform function for this, but:

On Linux:

std.os.linux.getpid()

On Windows:

std.os.windows.kernel32.GetCurrentProcessId()
4 Likes

In addition, you can check what platform you are on using builtin.os.tag

There are several examples in here: zig/lib/std/os.zig at master · ziglang/zig · GitHub

2 Likes