| ... | @@ -3440,7 +3440,10 @@ fn dirReadLinux(userdata: ?*anyopaque, dr: *Dir.Reader, buffer: []Dir.Entry) Dir | ... | @@ -3440,7 +3440,10 @@ fn dirReadLinux(userdata: ?*anyopaque, dr: *Dir.Reader, buffer: []Dir.Entry) Dir |
| 3440 | // by looking at only the 8 bytes before the next record. However since | 3440 | // by looking at only the 8 bytes before the next record. However since |
| 3441 | // file names are usually short it's better to keep the machine code | 3441 | // file names are usually short it's better to keep the machine code |
| 3442 | // simpler. | 3442 | // simpler. |
| 3443 | const linux_entry: *linux.dirent64 = @ptrCast(@alignCast(&dr.buffer[dr.index])); | 3443 | // |
| | 3444 | // Furthermore, I observed qemu user mode to not align this struct, so |
| | 3445 | // this code makes the conservative choice to not assume alignment. |
| | 3446 | const linux_entry: *align(1) linux.dirent64 = @ptrCast(&dr.buffer[dr.index]); |
| 3444 | const next_index = dr.index + linux_entry.reclen; | 3447 | const next_index = dr.index + linux_entry.reclen; |
| 3445 | dr.index = next_index; | 3448 | dr.index = next_index; |
| 3446 | const name_ptr: [*]u8 = &linux_entry.name; | 3449 | const name_ptr: [*]u8 = &linux_entry.name; |