poke-devel
[Top][All Lists]
Advanced

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

Re: GNU poke 2.90.0 on Linux/ia64


From: Bruno Haible
Subject: Re: GNU poke 2.90.0 on Linux/ia64
Date: Mon, 23 Jan 2023 01:43:10 +0100

On a Linux/ia64 machine, the compilation fails:

make[1]: Entering directory `/export/home/u/guest/bruno/poke-2.90.0/build/poked'
gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../../poked -I../poke  -I../../common 
-I../gl-poked -I../../gl-poked -I../../libpoke -I../libpoke 
-DPKGDATADIR=\"/u/guest/bruno/share/poke\" -I/u/guest/bruno/include -Wall -Wall 
-g -O2 -MT poked-usock.o -MD -MP -MF .deps/poked-usock.Tpo -c -o poked-usock.o 
`test -f 'usock.c' || echo '../../poked/'`usock.c
../../poked/usock.c: In function 'usock_new':
../../poked/usock.c:638: error: 'O_CLOEXEC' undeclared (first use in this 
function)
../../poked/usock.c:638: error: (Each undeclared identifier is reported only 
once
../../poked/usock.c:638: error: for each function it appears in.)
make[1]: *** [poked-usock.o] Error 1

This is because of invalid code in usock.c.

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.

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.

Bruno

Attachment: 0001-poked-Fix-invalid-use-of-fcntl-F_SETFL.patch
Description: Text Data


reply via email to

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