Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/librumphijack Fix dup2 mask so that dup2'ing a rump kern...
details: https://anonhg.NetBSD.org/src/rev/958bd97d1dd1
branches: trunk
changeset: 760996:958bd97d1dd1
user: pooka <pooka%NetBSD.org@localhost>
date: Tue Jan 18 11:04:10 2011 +0000
description:
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)
diffstat:
lib/librumphijack/hijack.c | 34 ++++++++++++++++++++++++----------
1 files changed, 24 insertions(+), 10 deletions(-)
diffs (78 lines):
diff -r cb29f90946c8 -r 958bd97d1dd1 lib/librumphijack/hijack.c
--- a/lib/librumphijack/hijack.c Tue Jan 18 09:28:42 2011 +0000
+++ b/lib/librumphijack/hijack.c Tue Jan 18 11:04:10 2011 +0000
@@ -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();
+}
Home |
Main Index |
Thread Index |
Old Index