I have identified a critical ABI mismatch in the Free Pascal RTL for FreeBSD versions 13, 14 and 15.
When running applications on FreeBSD 14, directory listings (via FindFirst/FindNext or fpGetDirentries) return empty results because the RTL still uses the legacy 32-bit dirent structure.
In FreeBSD 13+, the dirent structure was updated for 64-bit inodes (ino64):d_fileno (inode) is now 64-bit.
An 8-byte d_off (directory offset) field was added.d_namlen is now 16-bit.
Because FPC uses its own record definitions rather than the system's dirent.h, the data returned by the kernel is misaligned in Pascal applications.
Request:Could the RTL be updated to detect the FreeBSD version and use the correct structure? Since there is no built-in FPC_FREEBSD_OSVERSION define, perhaps the RTL should be using a version check similar to how C headers use __FreeBSD_version.
I have verified that manually patching the record to the following layout fixes the issue in mselibc.pas of MSEgui:
type
dirent = record
d_fileno: cuint64;
d_off: clonglong;
d_reclen: cuint16;
d_type: cuint8;
d_pad0: cuint8;
d_namlen: cuint16;
d_pad1: cuint16;
d_name: array[0..255] of char;
end;