From: Dennis Williamson <dennis@netstrata.com>
To: 59818@debbugs.gnu.org
Subject: bug#59818: incomplete type 'struct pollfd', etc., when compiling tail on MacOS (patch included)
Date: Sun, 4 Dec 2022 09:55:03 -0600 [thread overview]
Message-ID: <98bd19cf-35a5-fecd-5a8c-39cce62834f6@netstrata.com> (raw)
I received the errors for tail.c shown below when compiling coreutils on
MacOS (11.6). Adding __APPLE__ to the #if defined for poll.h fixes the
issue (see the diff at the bottom). Making this change matches that line
to the one within check_output_alive().
commit 324c188cfd8a1628c260e5003d309613a0c66e57 (August 29, 2022) made
the change to check_output_alive(), but missed the change reported here.
Dennis
(HEAD: aaa306ad76d48b27efd75101d57b6ec5bf90362c)
Error:
CC src/tail.o
src/tail.c:367:17: error: variable has incomplete type 'struct pollfd'
struct pollfd pfd;
^
src/tail.c:367:10: note: forward declaration of 'struct pollfd'
struct pollfd pfd;
^
src/tail.c:370:17: error: use of undeclared identifier 'POLLRDBAND'
pfd.events |= POLLRDBAND; /* Needed for illumos, macos. */
^
src/tail.c:372:7: error: implicit declaration of function 'poll' is
invalid in C99 [-Werror,-Wimplicit-function-declaration]
if (poll (&pfd, 1, 0) >= 0 && (pfd.revents & (POLLERR | POLLHUP)))
^
src/tail.c:372:49: error: use of undeclared identifier 'POLLERR'
if (poll (&pfd, 1, 0) >= 0 && (pfd.revents & (POLLERR | POLLHUP)))
^
src/tail.c:372:59: error: use of undeclared identifier 'POLLHUP'
if (poll (&pfd, 1, 0) >= 0 && (pfd.revents & (POLLERR | POLLHUP)))
^
5 errors generated.
make[2]: *** [src/tail.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Diff:
diff --git a/src/tail.c b/src/tail.c
index 6c7d59faf..14abf0871 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -55,7 +55,7 @@
# include <sys/inotify.h>
#endif
-#if defined _AIX || defined __sun || HAVE_INOTIFY
+#if defined _AIX || defined __sun || defined __APPLE__ || HAVE_INOTIFY
# include <poll.h>
#endif
next reply other threads:[~2022-12-04 16:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-04 15:55 Dennis Williamson [this message]
2022-12-05 14:40 ` bug#59818: incomplete type 'struct pollfd', etc., when compiling tail on MacOS (patch included) Pádraig Brady
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.gnu.org/mailman/listinfo/bug-coreutils
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=98bd19cf-35a5-fecd-5a8c-39cce62834f6@netstrata.com \
--to=dennis@netstrata.com \
--cc=59818@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).