diff options
author | 2021-10-04 20:01:05 -0700 | |
---|---|---|
committer | 2021-10-04 20:01:05 -0700 | |
commit | 21d918921a676fd14449e64a588123d7357f9ea9 (patch) | |
tree | 129924438055ac4a93119eb97215285546fd4cf3 /src/fs.zig | |
parent | 55095edee6a72fdbf6e40787981b096baa8c7884 (diff) | |
download | bun-21d918921a676fd14449e64a588123d7357f9ea9.tar.gz bun-21d918921a676fd14449e64a588123d7357f9ea9.tar.zst bun-21d918921a676fd14449e64a588123d7357f9ea9.zip |
memfd experiment did not yield perf gains on Linuxjarred/fix-bunbun-on-wsl
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.
Diffstat (limited to 'src/fs.zig')
-rw-r--r-- | src/fs.zig | 7 |
1 files changed, 3 insertions, 4 deletions
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 { |