Fd in os.linux.open do not align with os.linux.read

Those functions in std.os.linux are direct syscall wrappers (see, for example, the Source Code of std.os.linux.open for what I mean). Some relevant links:

The closest equivalent to what you’re looking for would be in std.posix, e.g. std.posix.open

Also worth noting that when working with the filesystem and writing cross-platform code, the APIs in std.fs are generally preferred over std.posix. That would look something like:

const file = try std.fs.cwd().openFile("some/path/file.txt", .{});
defer file.close();

// ...
2 Likes