NetBSD Problem Report #30129
From www@netbsd.org Wed May 4 01:53:01 2005
Return-Path: <www@netbsd.org>
Received: by narn.netbsd.org (Postfix, from userid 31301)
id D4E7B63B116; Wed, 4 May 2005 01:53:01 +0000 (UTC)
Message-Id: <20050504015301.D4E7B63B116@narn.netbsd.org>
Date: Wed, 4 May 2005 01:53:01 +0000 (UTC)
From: jdbaker@mylinuxisp.com
Reply-To: jdbaker@mylinuxisp.com
To: gnats-bugs@netbsd.org
Subject: audio/arts wants non-existent <sys/poll.h> on MacOS X 10.2.8
X-Send-Pr-Version: www-1.0
>Number: 30129
>Category: pkg
>Synopsis: audio/arts wants non-existent <sys/poll.h> on MacOS X 10.2.8
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: darwin-pkg-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed May 04 01:54:00 +0000 2005
>Closed-Date: Tue Oct 26 09:38:00 +0000 2010
>Last-Modified: Tue Oct 26 09:38:00 +0000 2010
>Originator: John D. Baker
>Release: MacOS X 10.2.8
>Organization:
>Environment:
Darwin pm8500.technoskunk.fur 6.8 Darwin Kernel Version 6.8: Wed Sep 10 15:20:55 PDT 2003; root:xnu/xnu-344.49.obj~2/RELEASE_PPC Power Macintosh powerpc
>Description:
Building audio/arts on Mac OS X 10.2.8 fails as follows:
[...]
if /bin/sh ../../libtool --silent --mode=compile --tag=CC gcc -pipe -DHAVE_CONFIG_H -I. -I. -I../.. -I../../mcop -I../../artsc -I../../flow -I../../flow -I../../mcop -I../../mcop -I../.. -I/usr/pkg/include -I/usr/pkg/qt3/include -I/usr/X11R6/include -I/usr/pkg/include -I/usr/X11R6/include -I../../libltdl -DQT_THREAD_SUPPORT -no-cpp-precomp -I/usr/pkg/include -I/usr/pkg/qt3/include -DGLX_GLXEXT_LEGACY -I/usr/pkg/include/freetype2 -I/usr/include -D_REENTRANT -I/usr/pkg/include/glib/glib-2.0 -I/usr/pkg/lib/glib-2.0/include -DNDEBUG -O2 -O2 -I/usr/pkg/include -I/usr/pkg/qt3/include -DGLX_GLXEXT_LEGACY -I/usr/pkg/include/freetype2 -I/usr/include -D_REENTRANT -I/usr/pkg/include/glib/glib-2.0 -I/usr/pkg/lib/glib-2.0/include -DNDEBUG -O2 -O2 -I/usr/pkg/include -I/usr/pkg/qt3/include -DGLX_GLXEXT_LEGACY -I/usr/pkg/include/freetype2 -I/usr/include -D_REENTRANT -I/usr/pkg/include/glib/glib-2.0 -I/usr/pkg/lib/glib-2.0/include -MT gslcommon.lo -MD -MP -MF ".deps/gslcommon.Tpo" -c -o gslcommon.lo gslcommon.c; \
then mv -f ".deps/gslcommon.Tpo" ".deps/gslcommon.Plo"; else rm -f ".deps/gslcommon.Tpo"; exit 1; fi
gslcommon.c:27:22: sys/poll.h: No such file or directory
gslcommon.c: In function `gsl_thread_sleep':
gslcommon.c:775: error: storage size of `pfd' isn't known
gnumake[3]: *** [gslcommon.lo] Error 1
gnumake[2]: *** [all-recursive] Error 1
gnumake[1]: *** [all-recursive] Error 1
gnumake: *** [all] Error 2
*** Error code 2
Stop.
bmake: stopped in /usr/pkgsrc/audio/arts
[...]
The file <sys/poll.h> does not exist on MacOS X 10.2.8.
It's not clear whether the expected 'poll.h' contents are to found in
some other header found in MacOS X.
>How-To-Repeat:
On MacOS X 10.2.8 with pkgsrc installed and bootstrapped.
Apply workaround in pkg/30127
bmake
>Fix:
>Release-Note:
>Audit-Trail:
From: "John D. Baker" <jdbaker@mylinuxisp.com>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: pkg/30129
Date: Thu, 5 May 2005 11:59:08 -0500 (CDT)
MacOS X (at least in 10.2.8) does not support the poll() API. Instead,
it uses select().
audio/arts appears to depend explicitly on poll() and provides no
option for select().
Apple Technical Note 2071:
http://developer.apple.com/technotes/tn2002/tn2071.html
discusses this and suggests using:
http://sealiesoftware.com/fakepoll.h
to satisfy such requirements.
Testing underway now...
--
John D. Baker, KN5UKS NetBSD Darwin/MacOS X
jdbaker(at)mylinuxisp(dot)com OpenBSD FreeBSD
BSD -- It just sits there and _works_!
From: "John D. Baker" <jdbaker@mylinuxisp.com>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: pkg/30129
Date: Thu, 5 May 2005 15:23:02 -0500 (CDT)
Trials with "http://sealiesoftware.com/fakepoll.h" are promising.
On my system, I put it in "/usr/local/include/sys/fakepoll.h" and
point affected source files to it explicitly. I.e.:
/* #include <sys/poll.h> */
#include "/usr/local/include/sys/fakepoll.h"
If 'errno.h' is also included, it must preceed the inclusion of
'fakepoll.h'.
The compiler seems to ignore the 'inline' directive, placing the
code in the general text segment of the object module. This causes
the linker to fail, complaining about multiple definitions of _poll.
I've split 'fakepoll.h' in two, with just the definitions in 'fakepoll.h'
proper, and the code for poll() in 'fakepoll_impl.h'. The idea is that
only one module need include 'fakepoll_impl.h' and the rest just include
'fakepoll.h'.
The initial examples are:
work/arts-1.4.0/flow/gsl/gslcommon.c (fakepoll_impl.h)
work/arts-1.4.0/flow/gsl/gslopmaster.c (fakepoll.h)
So far, this has worked, but I have hit what appears to be a compiler-
or assembler-related problem probably not related to the issue of this
PR.
-------------------------------------
// fakepoll.h
// poll using select
// Warning: a call to this poll() takes about 4K of stack space.
// Greg Parker gparker-web@sealiesoftware.com December 2000
// This code is in the public domain and may be copied or modified without
// permission.
// Updated May 2002:
// * fix crash when an fd is less than 0
// * set errno=EINVAL if an fd is greater or equal to FD_SETSIZE
// * don't set POLLIN or POLLOUT in revents if it wasn't requested
// in events (only happens when an fd is in the poll set twice)
#ifndef _FAKE_POLL_H
#define _FAKE_POLL_H
#include <limits.h>
#define FD_SETSIZE OPEN_MAX
#include <sys/types.h>
#include <sys/time.h>
#include <unistd.h>
#include <stdlib.h>
typedef struct pollfd {
int fd; /* file desc to poll */
short events; /* events of interest on fd */
short revents; /* events that occurred on fd */
} pollfd_t;
// poll flags
#define POLLIN 0x0001
#define POLLOUT 0x0004
#define POLLERR 0x0008
// synonyms
#define POLLNORM POLLIN
#define POLLPRI POLLIN
#define POLLRDNORM POLLIN
#define POLLRDBAND POLLIN
#define POLLWRNORM POLLOUT
#define POLLWRBAND POLLOUT
// ignored
#define POLLHUP 0x0010
#define POLLNVAL 0x0020
#endif
--------------------------------------------------------
// fakepoll_impl.h
// poll using select
// Warning: a call to this poll() takes about 4K of stack space.
// Greg Parker gparker-web@sealiesoftware.com December 2000
// This code is in the public domain and may be copied or modified without
// permission.
// Updated May 2002:
// * fix crash when an fd is less than 0
// * set errno=EINVAL if an fd is greater or equal to FD_SETSIZE
// * don't set POLLIN or POLLOUT in revents if it wasn't requested
// in events (only happens when an fd is in the poll set twice)
#ifndef _FAKE_POLL_IMPL_H
#define _FAKE_POLL_IMPL_H
#include "/usr/local/include/sys/fakepoll.h"
inline int poll(struct pollfd *pollSet, int pollCount, int pollTimeout)
{
struct timeval tv;
struct timeval *tvp;
fd_set readFDs, writeFDs, exceptFDs;
fd_set *readp, *writep, *exceptp;
struct pollfd *pollEnd, *p;
int selected;
int result;
int maxFD;
if (!pollSet) {
pollEnd = NULL;
readp = NULL;
writep = NULL;
exceptp = NULL;
maxFD = 0;
}
else {
pollEnd = pollSet + pollCount;
readp = &readFDs;
writep = &writeFDs;
exceptp = &exceptFDs;
FD_ZERO(readp);
FD_ZERO(writep);
FD_ZERO(exceptp);
// Find the biggest fd in the poll set
maxFD = 0;
for (p = pollSet; p < pollEnd; p++) {
if (p->fd > maxFD) maxFD = p->fd;
}
if (maxFD >= FD_SETSIZE) {
// At least one fd is too big
errno = EINVAL;
return -1;
}
// Transcribe flags from the poll set to the fd sets
for (p = pollSet; p < pollEnd; p++) {
if (p->fd < 0) {
// Negative fd checks nothing and always reports zero
} else {
if (p->events & POLLIN) FD_SET(p->fd, readp);
if (p->events & POLLOUT) FD_SET(p->fd, writep);
if (p->events != 0) FD_SET(p->fd, exceptp);
// POLLERR is never set coming in; poll() always reports errors
// But don't report if we're not listening to anything at all.
}
}
}
// poll timeout is in milliseconds. Convert to struct timeval.
// poll timeout == -1 : wait forever : select timeout of NULL
// poll timeout == 0 : return immediately : select timeout of zero
if (pollTimeout >= 0) {
tv.tv_sec = pollTimeout / 1000;
tv.tv_usec = (pollTimeout % 1000) * 1000;
tvp = &tv;
} else {
tvp = NULL;
}
selected = select(maxFD+1, readp, writep, exceptp, tvp);
if (selected < 0) {
// Error during select
result = -1;
}
else if (selected > 0) {
// Select found something
// Transcribe result from fd sets to poll set.
// Also count the number of selected fds. poll returns the
// number of ready fds; select returns the number of bits set.
int polled = 0;
for (p = pollSet; p < pollEnd; p++) {
p->revents = 0;
if (p->fd < 0) {
// Negative fd always reports zero
} else {
if ((p->events & POLLIN) && FD_ISSET(p->fd, readp)) {
p->revents |= POLLIN;
}
if ((p->events & POLLOUT) && FD_ISSET(p->fd, writep)) {
p->revents |= POLLOUT;
}
if ((p->events != 0) && FD_ISSET(p->fd, exceptp)) {
p->revents |= POLLERR;
}
if (p->revents) polled++;
}
}
result = polled;
}
else {
// selected == 0, select timed out before anything happened
// Clear all result bits and return zero.
for (p = pollSet; p < pollEnd; p++) {
p->revents = 0;
}
result = 0;
}
return result;
}
#endif
-----------------------------------
--
John D. Baker, KN5UKS NetBSD Darwin/MacOS X
jdbaker(at)mylinuxisp(dot)com OpenBSD FreeBSD
BSD -- It just sits there and _works_!
Responsible-Changed-From-To: pkg-manager->darwin-pkg-people
Responsible-Changed-By: cube@netbsd.org
Responsible-Changed-When: Thu, 05 May 2005 21:19:55 +0000
Responsible-Changed-Why:
darwin-specific issue.
State-Changed-From-To: open->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 25 Oct 2010 03:49:39 +0000
State-Changed-Why:
how does this look on a supported version of MacOS with recent pkgsrc?
From: "John D. Baker" <jdbaker@mylinuxisp.com>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: pkg/30129 (audio/arts wants non-existent <sys/poll.h> on MacOS
X 10.2.8)
Date: Mon, 25 Oct 2010 08:26:53 -0500 (CDT)
On Mon, 25 Oct 2010, dholland@NetBSD.org wrote:
> how does this look on a supported version of MacOS with recent pkgsrc?
Seems to build OK on MacOS X 10.4.11 (PPC) with pkgsrc-current. Don't
know if it works since the applications of interest that use it don't
build.
The machines that were limited to 10.2.x are no-longer readily usable and
when next they are will have a CPU upgrade installed that eliminates the
version limitation--if I bother with MacOS X on them at all...
So I guess this one can be closed.
--
|/"\ John D. Baker, KN5UKS NetBSD Darwin/MacOS X
|\ / jdbaker[snail]mylinuxisp[flyspeck]com OpenBSD FreeBSD
| X No HTML/proprietary data in email. BSD just sits there and works!
|/ \ GPGkeyID: D703 4A7E 479F 63F8 D3F4 BD99 9572 8F23 E4AD 1645
State-Changed-From-To: feedback->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Tue, 26 Oct 2010 09:38:00 +0000
State-Changed-Why:
Works on 10.4. 10.2 is too old to be interesting...
Thanks for checking.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.