[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GNU poke 2.90.0 on Linux/ia64
From: |
Mohammad-Reza Nabipoor |
Subject: |
Re: GNU poke 2.90.0 on Linux/ia64 |
Date: |
Tue, 24 Jan 2023 09:34:13 +0100 |
Hello Bruno.
On Mon, Jan 23, 2023 at 01:43:10AM +0100, Bruno Haible wrote:
> Reading "man fcntl"
> https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html
> https://man7.org/linux/man-pages/man2/fcntl.2.html
> it is clear that
> - For changing the CLOEXEC bit of a file descriptor, one should use
> fcntl (fd, F_SETFD, 0 or FD_CLOEXEC);
> - fcntl (fd, F_SEFFL, O_CLOEXEC) is explicitly documented as unsupported:
> "On Linux, this command can change only the O_APPEND, O_ASYNC,
> O_DIRECT, O_NOATIME, and O_NONBLOCK flags."
>
> Find attached a patch that should correct this. I have not functionally
> tested it, but it does fix the compilation failure: then the build
> succeeds and all tests pass.
>
Thanks for the testing and for the fix!
I applied your patch.
> Btw, the sequence of pipe() + 2x F_SETFD FD_CLOEXEC is not atomic.
> To make this sequence atomic on platforms where this is possible,
> and if poked can use Gnulib, then use the 'pipe2' module from Gnulib.
>
The reason that I didn't use `pipe2' is I want only the read-end of the
pipe be `O_NONBLOCK'. I use that end with `poll' to get notification
(in `usock_serve' function) from the other thread (the user's thread).
User notifies us using `usock_notify' which only writes a single byte
to the write-end of the pipe. I want this blocking semantics on the
write-end for simplicity.
Do you have any suggestions/observations?
Regards,
Mohammad-Reza