gforth
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issues with socket.fs on OpenBSD


From: nature
Subject: Re: Issues with socket.fs on OpenBSD
Date: Sun, 04 Sep 2022 11:33:10 +0200
User-agent: mu4e 1.8.9; emacs 28.1

Hi Tomas,

>> Then I tried something simpler like the echo server wrom
>> rosettacode: https://rosettacode.org/wiki/Echo_server#Forth and this
>> didn't work as well.
>>
>> I then tried to insert some ." at different places and I realized that
>> create-server and accept-socket works, it's read-socket that
>> fails/blocks indefinitely.  When going deeper and trying to figure out
>> where exactly in read-socket things were blocking, I found that it's the
>> recv call that blocks/fails.  I wasn't able to figure out more than
>> that...
>
> It seems that read-socket is trying to provide some kind of higher lever
> blocking API I do not understand.

So the logic is explained in the fcntl(2) man page:
https://man.openbsd.org/fcntl

I haven't gone through it and checked if what gforth does is correct.

> You can see the source code for read-socket with the following commands:
>
> • (eepitch-shell)
> • (eepitch-kill)
> • (eepitch-shell)
> gforth
> require unix/socket.fs
> view read-socket
> view (rs)

Thanks for the tip, I actually was manually going through the
/usr/local/share/gforth/<version>/unix/socket.fs file.

> Using read and write instead of read-socket and write-socket worked for
> me, see the attached forking echo server example.

Thanks, that proved to work for me as well.

So after making some tests with the http and echo servers it really
seems that only the read-socket word is buggy (on OpenBSD, I don't know
if it's the same on Linux), while all the other accept-socket,
write-socket etc... seem to work fine.

To work around this for now I am replacing the read-socket with:
rot fileno -rot read

Should this issue be mentionned in the bug tracker?

Best,
-- 
nature



reply via email to

[Prev in Thread] Current Thread [Next in Thread]