Module Name: src
Committed By: pooka
Date: Tue Jan 18 11:04:10 UTC 2011
Modified Files:
src/lib/librumphijack: hijack.c
Log Message:
Fix dup2 mask so that dup2'ing a rump kernel fd to 1 does not cause
stderr to be treated as a rump kernel fd as well. Makes e.g.
bozohttpd work better with stderr logging.
Also, add aborty stubs for kqueue.
(implementing kqueue is even trickier than implementing select/poll
since we need to keep state for two kqueue fd's)
To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/librumphijack/hijack.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/librumphijack/hijack.c
diff -u src/lib/librumphijack/hijack.c:1.9 src/lib/librumphijack/hijack.c:1.10
--- src/lib/librumphijack/hijack.c:1.9 Mon Jan 17 16:30:09 2011
+++ src/lib/librumphijack/hijack.c Tue Jan 18 11:04:10 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: hijack.c,v 1.9 2011/01/17 16:30:09 pooka Exp $ */
+/* $NetBSD: hijack.c,v 1.10 2011/01/18 11:04:10 pooka Exp $ */
/*-
* Copyright (c) 2011 Antti Kantee. All Rights Reserved.
@@ -26,10 +26,11 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: hijack.c,v 1.9 2011/01/17 16:30:09 pooka Exp $");
+__RCSID("$NetBSD: hijack.c,v 1.10 2011/01/18 11:04:10 pooka Exp $");
#include <sys/param.h>
#include <sys/types.h>
+#include <sys/event.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/poll.h>
@@ -182,7 +183,7 @@
}
static unsigned dup2mask;
-#define ISDUP2D(fd) (((fd+1) & dup2mask) == ((fd)+1))
+#define ISDUP2D(fd) (1<<(fd) & dup2mask)
//#define DEBUGJACK
#ifdef DEBUGJACK
@@ -240,10 +241,6 @@
#define assertfd(_fd_) assert(ISDUP2D(_fd_) || (_fd_) >= HIJACK_ASSERT)
#undef HIJACK_FDOFF
-/*
- * Following wrappers always call the rump kernel.
- */
-
int __socket30(int, int, int);
int
__socket30(int domain, int type, int protocol)
@@ -492,11 +489,12 @@
oldd = fd_host2rump(oldd);
rv = rump_sys_dup2(oldd, newd);
if (rv != -1)
- dup2mask |= newd+1;
- return rv;
+ dup2mask |= 1<<newd;
} else {
- return host_dup2(oldd, newd);
+ rv = host_dup2(oldd, newd);
}
+
+ return rv;
}
/*
@@ -969,3 +967,19 @@
return pollts(fds, nfds, tsp, NULL);
}
+
+int
+kqueue(void)
+{
+
+ abort();
+}
+
+int
+kevent(int kq, const struct kevent *changelist, size_t nchanges,
+ struct kevent *eventlist, size_t nevents,
+ const struct timespec *timeout)
+{
+
+ abort();
+}