Hi ! I just tried this simple code with strace, and whatever Release I choose or even replacing print with write, it uses 2 syscalls for the write, pwritev and then writev because pwritev fails with Illegal Seek
const std = @import("std");
pub fn main() !void {
var buff: [512]u8 = undefined;
var stdout_writer = std.fs.File.stdout().writer(&buff);
try stdout_writer.file.lock(.exclusive);
defer stdout_writer.file.unlock();
const stdout = &stdout_writer.interface;
_ = try stdout.print("Hello, {s} !\n", .{"World"});
try stdout.flush();
}
execve("./new", ["./new"], 0x7fff9fb82030 /* 115 vars */) = 0
arch_prctl(ARCH_SET_FS, 0x1007008) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=16384*1024, rlim_max=RLIM64_INFINITY}) = 0
rt_sigaction(SIGPIPE, {sa_handler=0x100262f, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x1002912}, NULL, 8) = 0
flock(1, LOCK_EX) = 0
pwritev(1, [{iov_base="Hello, World !\n", iov_len=15}], 1, 0) = -1 ESPIPE (Illegal seek)
writev(1, [{iov_base="Hello, World !\n", iov_len=15}], 1Hello, World !
) = 15
flock(1, LOCK_UN) = 0
exit_group(0) = ?
+++ exited with 0 +++
Is this expected or is this something wrong in my code ?