forgot missing patches:

- fix thread startup in knode, including work-around for thread bugs up until
a week ago...
- replace IP detection code with home-made code so that kfrb/krdc works for us.
This commit is contained in:
espie 2003-01-28 12:23:17 +00:00
parent 0f9f4167dd
commit 82e586fb70
4 changed files with 120 additions and 0 deletions

View File

@ -0,0 +1,36 @@
$OpenBSD: patch-knode_knprotocolclient_cpp,v 1.1 2003/01/28 12:23:17 espie Exp $
--- knode/knprotocolclient.cpp.orig Sun Jan 19 17:41:02 2003
+++ knode/knprotocolclient.cpp Sun Jan 19 17:41:51 2003
@@ -51,8 +51,8 @@ KNProtocolClient::~KNProtocolClient()
void KNProtocolClient::run()
{
- if (0!=pthread_setcanceltype(PTHREAD_CANCEL_ENABLE,NULL))
- qWarning("pthread_setcanceltype failed!");
+ if (0!=pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,NULL))
+ qWarning("pthread_setcancelstate failed!");
if (0!= pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS,NULL))
qWarning("pthread_setcanceltype failed!");
@@ -85,7 +85,7 @@ void KNProtocolClient::updatePercentage(
void KNProtocolClient::waitForWork()
{
fd_set fdsR,fdsE;
- timeval tv;
+ timeval tv, tv2;
int selectRet;
while (true) {
@@ -114,9 +114,11 @@ void KNProtocolClient::waitForWork()
}
do {
+ tv2.tv_sec = 1;
+ tv2.tv_usec = 0;
FD_ZERO(&fdsR);
FD_SET(fdPipeIn, &fdsR);
- } while (select(FD_SETSIZE, &fdsR, NULL, NULL, NULL)<0); // don't get tricked by signals
+ } while (select(FD_SETSIZE, &fdsR, NULL, NULL, &tv2)<=0); // don't get tricked by signals
clearPipe(); // remove start signal

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-krfb_libvncserver_rfb_h,v 1.1 2003/01/28 12:23:17 espie Exp $
--- krfb/libvncserver/rfb.h.orig Thu Dec 5 21:49:32 2002
+++ krfb/libvncserver/rfb.h Mon Jan 13 22:34:37 2003
@@ -62,7 +62,7 @@ typedef unsigned long KeySym;
#ifdef __linux__
#include <endian.h>
-#elif defined(__APPLE__) || defined(__FreeBSD__)
+#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__)
#include <sys/types.h>
#include <machine/endian.h>
#ifndef _BYTE_ORDER

View File

@ -0,0 +1,13 @@
$OpenBSD: patch-krfb_srvloc_kinetaddr_h,v 1.1 2003/01/28 12:23:17 espie Exp $
--- krfb/srvloc/kinetaddr.h.orig Mon Dec 30 01:58:32 2002
+++ krfb/srvloc/kinetaddr.h Mon Dec 30 01:58:39 2002
@@ -29,9 +29,7 @@
#include <arpa/inet.h>
-#if defined(__FreeBSD__)
#include <sys/socket.h>
-#endif
#include <qobject.h>
#include <qcstring.h>

View File

@ -0,0 +1,59 @@
$OpenBSD: patch-krfb_srvloc_kinetaddr_ipfinder_cpp,v 1.1 2003/01/28 12:23:17 espie Exp $
--- krfb/srvloc/kinetaddr_ipfinder.cpp.orig Tue Jan 14 02:52:23 2003
+++ krfb/srvloc/kinetaddr_ipfinder.cpp Tue Jan 14 03:04:58 2003
@@ -109,17 +109,20 @@ char *getdefaultdev()
}
+#define MAX_IF2 50
static void findAddresses( void )
{
int sock, err, if_count, i, j = 0;
struct ifconf netconf;
- char buffer[32*MAX_IF];
+ struct ifreq *ifrp;
+ size_t siz;
+ char buffer[128*MAX_IF];
- char if_name[10][21];
- char if_addr[10][21];
+ char if_name[MAX_IF2][21];
+ char if_addr[MAX_IF2][21];
char *default_ifName;
- netconf.ifc_len = 32 * MAX_IF;
+ netconf.ifc_len = 128 * MAX_IF;
netconf.ifc_buf = buffer;
sock=socket( PF_INET, SOCK_DGRAM, 0 );
err=ioctl( sock, SIOCGIFCONF, &netconf );
@@ -127,13 +130,23 @@ static void findAddresses( void )
kdDebug() << "KInetAddress: Error in ioctl: "<<errno<<"." << endl;
close( sock );
- if_count = netconf.ifc_len / 32;
- for( i = 0; i < if_count; i++ ) {
- if( strcmp( netconf.ifc_req[i].ifr_name, "lo" ) != 0 ) {
- strncpy( if_name[j], netconf.ifc_req[i].ifr_name, 20 );
- strncpy( if_addr[j], inet_ntoa(((struct sockaddr_in*)(&netconf.ifc_req[i].ifr_addr))->sin_addr), 20 );
- j++;
- }
+ for (i = 0; i < netconf.ifc_len; ) {
+ ifrp = (struct ifreq *)((char *)netconf.ifc_req + i);
+ siz = ifrp->ifr_addr.sa_len;
+ if (siz < sizeof(ifrp->ifr_addr))
+ siz = sizeof(ifrp->ifr_addr);
+ siz += sizeof(ifrp->ifr_name);
+ i += siz;
+ if (ifrp->ifr_addr.sa_family == AF_LINK)
+ continue;
+ if (strcmp(ifrp->ifr_name, "lo0" ) == 0 ||
+ strcmp(ifrp->ifr_name, "lo1" ) == 0)
+ continue;
+ strncpy( if_name[j], ifrp->ifr_name, 20 );
+ strncpy( if_addr[j], inet_ntoa(((struct sockaddr_in*)(&ifrp->ifr_addr))->sin_addr), 20 );
+ j++;
+ if (j == MAX_IF2)
+ break;
}
if(j == 0) {