[fpc-pascal] unixsockets

Andrew Haines andrewd207 at aol.com
Sat Dec 28 16:31:33 CET 2024


Hi, is unixsockets.pp in rtl-extra supposed to be included when fpc is 
built for linux? I ran

'find /usr/lib/fpc/ | grep unixsockets' and it returns nothing, also not 
in /usr/local/lib/fpc.

I needed msghdr/cmsghdr which I found in 
packages/rtl-extra/src/linux/unixsocketsh.inc.

grep -r "unixsockets" ./fpc-gitlab

./utils/dotutils/known.txt:unixsockets=*UnixApi.Sockets
./packages/rtl-extra/src/unix/unixsockets.pp:unit unixsockets;
./packages/rtl-extra/src/unix/unixsockets.pp:{$unixsocketsh.inc}
./packages/rtl-extra/src/unix/unixsockets.pp:{$unixsockets.inc}
./packages/rtl-extra/namespaced/UnixApi.Sockets.pp:{$i unixsockets.pp}
./packages/rtl-extra/namespaces.lst:src/unix/unixsockets.pp=namespaced/UnixApi.Sockets.pp

so it's not in any Makefile or fpmake.pp file.

Also, at least on my system(linux/64) the msghdr and cmshdr records have 
used socklen_t in a couple places where it should be size_t. But perhaps 
it's matching other *nix's....

https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/bits/socket.h;h=ca27a3c5979c7535f33390d3fac3384710e0db9b;hb=HEAD#l265


I found this which seems to match the changes I made

https://lists.freepascal.org/fpc-pascal/2014-June/042244.html

diff --git a/packages/rtl-extra/src/linux/unixsocketsh.inc 
b/packages/rtl-extra/src/linux/unixsocketsh.inc
index 4b492654b5..27fd66449f 100644
--- a/packages/rtl-extra/src/linux/unixsocketsh.inc
+++ b/packages/rtl-extra/src/linux/unixsocketsh.inc
@@ -9,13 +9,13 @@   msghdr = record
       msg_iov : piovec;
       msg_iovlen : size_t;
       msg_control : pointer;
-     msg_controllen : socklen_t;
+     msg_controllen : size_t;
       msg_flags : cInt;
    end;

    Pcmsghdr = ^cmsghdr;
    cmsghdr = record
-    cmsg_len   : socklen_t;
+    cmsg_len   : size_t;
      cmsg_level : cInt;
      cmsg_type  : cInt;
    end;

Regards

Andrew Haines




More information about the fpc-pascal mailing list