summaryrefslogtreecommitdiff
path: root/emulators
diff options
context:
space:
mode:
authordbj <dbj@pkgsrc.org>2005-11-04 21:09:15 +0000
committerdbj <dbj@pkgsrc.org>2005-11-04 21:09:15 +0000
commitc89de0b862a7c5c26d87d6b45d222a767600e8b2 (patch)
treec6f345eba001bba6ab79889e92edf615c4e05468 /emulators
parent34d73e32f38dd3d5000910121686f1392305f26d (diff)
downloadpkgsrc-c89de0b862a7c5c26d87d6b45d222a767600e8b2.tar.gz
use fakepoll.h implementation of poll using select on apple, which has
a broken poll.
Diffstat (limited to 'emulators')
-rw-r--r--emulators/qemu/distinfo5
-rw-r--r--emulators/qemu/patches/patch-ac22
-rw-r--r--emulators/qemu/patches/patch-ax166
3 files changed, 186 insertions, 7 deletions
diff --git a/emulators/qemu/distinfo b/emulators/qemu/distinfo
index 07c7fb77712..e6fe1368eee 100644
--- a/emulators/qemu/distinfo
+++ b/emulators/qemu/distinfo
@@ -1,10 +1,10 @@
-$NetBSD: distinfo,v 1.12 2005/10/23 19:55:59 rillig Exp $
+$NetBSD: distinfo,v 1.13 2005/11/04 21:09:15 dbj Exp $
SHA1 (qemu-0.7.2.tar.gz) = 4daeccb57448eacc444152f30b5d84dfcca89dfe
RMD160 (qemu-0.7.2.tar.gz) = 1d2dcc8f43ff4b4b9aa045c64e38c9a10140b13e
Size (qemu-0.7.2.tar.gz) = 1341993 bytes
SHA1 (patch-aa) = 455575215bad8864da285e1979da9ff7d8476a24
-SHA1 (patch-ac) = a54824b658f4bbdbbdf74ad1a12bf25bce8f1164
+SHA1 (patch-ac) = fa190b38658ad487a6ddf6d78cc3cbb262c67702
SHA1 (patch-af) = 221d6d85aa898cb27462806faab58ee2a9871a1c
SHA1 (patch-ag) = 4bb7ae18fd0f0c5ecfa2ab2594d1de5b33660495
SHA1 (patch-ah) = 134f47583dbed94e83671ca6197106805b13f759
@@ -20,3 +20,4 @@ SHA1 (patch-as) = 0df64b325b758a88fe61590e129bab2b3f99ce63
SHA1 (patch-au) = aa2712c382a67beef9225e710e7735ba15995a41
SHA1 (patch-av) = bd88088f41b6b3c256eec933e5f267fc432e58fa
SHA1 (patch-aw) = 6299964fb3a747e8f5dfe4354e66722030ee9a75
+SHA1 (patch-ax) = b6eb66859e3ab318ec388d9f33201c27f34677ca
diff --git a/emulators/qemu/patches/patch-ac b/emulators/qemu/patches/patch-ac
index 42e2b6ed854..42b00b339a6 100644
--- a/emulators/qemu/patches/patch-ac
+++ b/emulators/qemu/patches/patch-ac
@@ -1,8 +1,20 @@
-$NetBSD: patch-ac,v 1.3 2005/05/25 18:04:57 dbj Exp $
+$NetBSD: patch-ac,v 1.4 2005/11/04 21:09:15 dbj Exp $
---- vl.c.orig Wed Apr 27 16:52:05 2005
-+++ vl.c Wed May 25 11:42:18 2005
-@@ -43,8 +43,10 @@
+--- vl.c.orig 2005-04-27 16:52:05.000000000 -0400
++++ vl.c
+@@ -34,7 +34,11 @@
+ #include <sys/times.h>
+ #include <sys/wait.h>
+ #include <termios.h>
++#ifdef __APPLE__
++#include "fakepoll.h"
++#else
+ #include <sys/poll.h>
++#endif
+ #include <sys/mman.h>
+ #include <sys/ioctl.h>
+ #include <sys/socket.h>
+@@ -43,8 +47,10 @@
#ifdef _BSD
#include <sys/stat.h>
#ifndef __APPLE__
@@ -13,7 +25,7 @@ $NetBSD: patch-ac,v 1.3 2005/05/25 18:04:57 dbj Exp $
#else
#include <linux/if.h>
#include <linux/if_tun.h>
-@@ -68,7 +70,7 @@
+@@ -68,7 +74,7 @@
#ifdef CONFIG_SDL
#ifdef __APPLE__
diff --git a/emulators/qemu/patches/patch-ax b/emulators/qemu/patches/patch-ax
new file mode 100644
index 00000000000..6e7c80c257f
--- /dev/null
+++ b/emulators/qemu/patches/patch-ax
@@ -0,0 +1,166 @@
+$NetBSD: patch-ax,v 1.1 2005/11/04 21:09:15 dbj Exp $
+
+--- /dev/null 2005-10-13 14:41:11.000000000 -0400
++++ fakepoll.h
+@@ -0,0 +1,161 @@
++// 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
++
++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