From 21d918921a676fd14449e64a588123d7357f9ea9 Mon Sep 17 00:00:00 2001 From: Jarred SUmner Date: Mon, 4 Oct 2021 20:01:05 -0700 Subject: memfd experiment did not yield perf gains on Linux I suspect the reason why is because we were already using tmpfs. So it was already writing to an in-memory file. O_TMPFILE doesn't seem to do anything for us either here. --- src/fs.zig | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/fs.zig') diff --git a/src/fs.zig b/src/fs.zig index 75d01149d..0b28fa9b7 100644 --- a/src/fs.zig +++ b/src/fs.zig @@ -534,12 +534,11 @@ pub const FileSystem = struct { } pub fn create(this: *Tmpfile, rfs: *RealFS, name: [*:0]const u8) !void { - var tmpdir_ = if (Environment.isLinux) try rfs.openDir(rfs.parent_fs.top_level_dir) else try rfs.openTmpDir(); + var tmpdir_ = try rfs.openTmpDir(); - const default_flags = std.os.O_CREAT | std.os.O_RDWR | std.os.O_CLOEXEC; - const flags = if (Environment.isLinux) default_flags | std.os.O_TMPFILE else default_flags | std.os.O_EXCL; + const flags = std.os.O_CREAT | std.os.O_RDWR | std.os.O_CLOEXEC; this.dir_fd = tmpdir_.fd; - this.fd = try std.os.openatZ(tmpdir_.fd, name, flags, 0666); + this.fd = try std.os.openatZ(tmpdir_.fd, name, flags, std.os.S_IRWXO); } pub fn promote(this: *Tmpfile, from_name: [*:0]const u8, destination_fd: std.os.fd_t, name: [*:0]const u8) !void { -- cgit v1.2.3