Hello, I got reports saying that pipe-filter-* modules don't compile with xlc on AIX. The error is:
"pipe-filter-aux.h", line 99.14: 1506-780 (S) Reference to "select" with internal linkage is not allowed within inline definition of "nonintr_select". It seems that 'select' is indeed defined as static on AIX and referring it from an inline function causes the error. Since the use of the redefined 'select' in pipe-filter-* is limited, how about moving the definition to the caller? I'm attaching a patch in that direction. I've also uploaded a test package at: http://du-a.org/~ueno/junk/test-pipe-filter-ii-aix.tar.gz Regards, -- Daiki Ueno
>From 17a0216558375b833ca11adeb39eedd42fbd42e3 Mon Sep 17 00:00:00 2001 From: Daiki Ueno <u...@gnu.org> Date: Tue, 18 Nov 2014 21:11:09 +0900 Subject: [PATCH] pipe-filter-gi, pipe-filter-ii: port to AIX On AIX 7.1, 'select' is defined as static and cannot be referred from inline function. * lib/pipe-filter-aux.h (nointr_select): Remove, manually expand the definition... * lib/pipe-filter-gi.c (filter_loop): ...here, and... * lib/pipe-filter-ii.c (pipe_filter_ii_execute): ...here. --- ChangeLog | 10 ++++++++++ lib/pipe-filter-aux.h | 19 ------------------- lib/pipe-filter-gi.c | 16 +++++++++++----- lib/pipe-filter-ii.c | 13 ++++++++++--- 4 files changed, 31 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index 16dc620..5d42c53 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2014-11-18 Daiki Ueno <u...@gnu.org> + + pipe-filter-gi, pipe-filter-ii: port to AIX + On AIX 7.1, 'select' is defined as static and cannot be referred + from inline function. + * lib/pipe-filter-aux.h (nointr_select): Remove, manually expand + the definition... + * lib/pipe-filter-gi.c (filter_loop): ...here, and... + * lib/pipe-filter-ii.c (pipe_filter_ii_execute): ...here. + 2014-11-14 Paul Eggert <egg...@cs.ucla.edu> extern-inline: update commentary about GCC bugs diff --git a/lib/pipe-filter-aux.h b/lib/pipe-filter-aux.h index c3f1be8..8f2a707 100644 --- a/lib/pipe-filter-aux.h +++ b/lib/pipe-filter-aux.h @@ -87,25 +87,6 @@ nonintr_write (int fd, const void *buf, size_t count) #undef write /* avoid warning on VMS */ #define write nonintr_write -# if HAVE_SELECT - -PIPE_FILTER_AUX_INLINE int -nonintr_select (int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, - struct timeval *timeout) -{ - int retval; - - do - retval = select (n, readfds, writefds, exceptfds, timeout); - while (retval < 0 && errno == EINTR); - - return retval; -} -# undef select /* avoid warning on VMS */ -# define select nonintr_select - -# endif - #endif /* Non-blocking I/O. */ diff --git a/lib/pipe-filter-gi.c b/lib/pipe-filter-gi.c index de7b257..cd3ead7 100644 --- a/lib/pipe-filter-gi.c +++ b/lib/pipe-filter-gi.c @@ -302,7 +302,7 @@ filter_loop (struct pipe_filter_gi *filter, const char *wbuf, size_t count) /* Here, if done_writing, filter->reader_terminated is false. When filter->reader_terminated becomes true, this loop is terminated. */ # if HAVE_SELECT - int n; + int n, retval; /* See whether reading or writing is possible. */ n = 1; @@ -317,10 +317,16 @@ filter_loop (struct pipe_filter_gi *filter, const char *wbuf, size_t count) if (n <= filter->fd[1]) n = filter->fd[1] + 1; } - n = select (n, - (!filter->reader_terminated ? &filter->readfds : NULL), - (!done_writing ? &filter->writefds : NULL), - NULL, NULL); + /* Do EINTR handling here instead of in pipe-filter-aux.h, + because select() cannot be referred from an inline function + on AIX 7.1. */ + do + retval = select (n, + (!filter->reader_terminated ? &filter->readfds : NULL), + (!done_writing ? &filter->writefds : NULL), + NULL, NULL); + while (retval < 0 && errno == EINTR); + n = retval; if (n < 0) { diff --git a/lib/pipe-filter-ii.c b/lib/pipe-filter-ii.c index 2072ea3..85c7af2 100644 --- a/lib/pipe-filter-ii.c +++ b/lib/pipe-filter-ii.c @@ -309,7 +309,7 @@ pipe_filter_ii_execute (const char *progname, for (;;) { # if HAVE_SELECT - int n; + int n, retval; FD_SET (fd[0], &readfds); n = fd[0] + 1; @@ -320,8 +320,15 @@ pipe_filter_ii_execute (const char *progname, n = fd[1] + 1; } - n = select (n, &readfds, (!done_writing ? &writefds : NULL), NULL, - NULL); + /* Do EINTR handling here instead of in pipe-filter-aux.h, + because select() cannot be referred from an inline function + on AIX 7.1. */ + do + retval = select (n, &readfds, (!done_writing ? &writefds : NULL), + NULL, NULL); + while (retval < 0 && errno == EINTR); + n = retval; + if (n < 0) { if (exit_on_error) -- 2.1.3