PermissionDenied, ProcessNotFound, .fromByteUnits

This commit is contained in:
pfg
2025-06-18 20:46:05 -07:00
parent da48da4ae3
commit 255c5a760f
4 changed files with 16 additions and 4 deletions

View File

@@ -4,7 +4,7 @@ const std = @import("std");
/// Single allocation only.
///
pub const MaxHeapAllocator = struct {
array_list: std.ArrayListAligned(u8, @alignOf(std.c.max_align_t)),
array_list: std.ArrayListAligned(u8, .fromByteUnits(@alignOf(std.c.max_align_t))),
fn alloc(ptr: *anyopaque, len: usize, alignment: std.mem.Alignment, _: usize) ?[*]u8 {
bun.assert(alignment.toByteUnits() <= @alignOf(std.c.max_align_t));

View File

@@ -6602,6 +6602,8 @@ pub fn zigDeleteTree(self: std.fs.Dir, sub_path: []const u8, kind_hint: std.fs.F
error.BadPathName,
error.NetworkNotFound,
error.DeviceBusy,
error.ProcessNotFound,
error.PermissionDenied,
=> |e| return e,
};
stack.appendAssumeCapacity(.{
@@ -6637,6 +6639,7 @@ pub fn zigDeleteTree(self: std.fs.Dir, sub_path: []const u8, kind_hint: std.fs.F
error.BadPathName,
error.NetworkNotFound,
error.Unexpected,
error.PermissionDenied,
=> |e| return e,
}
}
@@ -6694,6 +6697,8 @@ pub fn zigDeleteTree(self: std.fs.Dir, sub_path: []const u8, kind_hint: std.fs.F
error.BadPathName,
error.NetworkNotFound,
error.DeviceBusy,
error.PermissionDenied,
error.ProcessNotFound,
=> |e| return e,
};
} else {
@@ -6718,6 +6723,7 @@ pub fn zigDeleteTree(self: std.fs.Dir, sub_path: []const u8, kind_hint: std.fs.F
error.FileBusy,
error.BadPathName,
error.NetworkNotFound,
error.PermissionDenied,
error.Unexpected,
=> |e| return e,
}
@@ -6750,6 +6756,7 @@ fn zigDeleteTreeOpenInitialSubpath(self: std.fs.Dir, sub_path: []const u8, kind_
error.NotDir,
error.FileNotFound,
error.AccessDenied,
error.PermissionDenied,
error.SymLinkLoop,
error.ProcessFdQuotaExceeded,
error.NameTooLong,
@@ -6762,6 +6769,7 @@ fn zigDeleteTreeOpenInitialSubpath(self: std.fs.Dir, sub_path: []const u8, kind_
error.BadPathName,
error.DeviceBusy,
error.NetworkNotFound,
error.ProcessNotFound,
=> |e| return e,
};
} else {
@@ -6775,6 +6783,7 @@ fn zigDeleteTreeOpenInitialSubpath(self: std.fs.Dir, sub_path: []const u8, kind_
error.FileNotFound,
error.AccessDenied,
error.PermissionDenied,
error.InvalidUtf8,
error.InvalidWtf8,
error.SymLinkLoop,
@@ -6845,6 +6854,8 @@ fn zigDeleteTreeMinStackSizeWithKindHint(self: std.fs.Dir, sub_path: []const u8,
error.BadPathName,
error.NetworkNotFound,
error.DeviceBusy,
error.ProcessNotFound,
error.PermissionDenied,
=> |e| return e,
};
if (cleanup_dir_parent) |*d| d.close();
@@ -6877,6 +6888,7 @@ fn zigDeleteTreeMinStackSizeWithKindHint(self: std.fs.Dir, sub_path: []const u8,
error.FileBusy,
error.BadPathName,
error.NetworkNotFound,
error.PermissionDenied,
error.Unexpected,
=> |e| return e,
}

View File

@@ -439,7 +439,7 @@ pub const PathWatcherManager = struct {
return .{
.err = .{
.errno = @truncate(@intFromEnum(switch (err) {
error.AccessDenied => bun.sys.E.ACCES,
error.AccessDenied, error.PermissionDenied => bun.sys.E.ACCES,
error.SystemResources => bun.sys.E.NOMEM,
error.Unexpected,
error.InvalidUtf8,

View File

@@ -369,7 +369,7 @@ pub fn MultiArrayList(comptime T: type) type {
const other_bytes = gpa.alignedAlloc(
u8,
@alignOf(Elem),
.fromByteUnits(@alignOf(Elem)),
capacityInBytes(new_len),
) catch {
const self_slice = self.slice();
@@ -444,7 +444,7 @@ pub fn MultiArrayList(comptime T: type) type {
assert(new_capacity >= self.len);
const new_bytes = try gpa.alignedAlloc(
u8,
@alignOf(Elem),
.fromByteUnits(@alignOf(Elem)),
capacityInBytes(new_capacity),
);
if (self.len == 0) {