Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2024-12

unixsockets

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Andrew Haines

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

Reply by email

Michael Van Canneyt
to Andrew Haines
Andrew Haines wrote
Hi, is unixsockets.pp in rtl-extra supposed to be included when fpc is built for linux? I ran

Yes. It was not built, I added it to fpmake.

I also applied the fix you mentioned for the size_t problem.

Michael.

Reply by email