| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: hijack.c,v 1.116 2015/03/05 00:26:17 pooka Exp $ */ | | 1 | /* $NetBSD: hijack.c,v 1.117 2015/04/11 12:54:41 riastradh Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2011 Antti Kantee. All Rights Reserved. | | 4 | * Copyright (c) 2011 Antti Kantee. All Rights Reserved. |
5 | * | | 5 | * |
6 | * Redistribution and use in source and binary forms, with or without | | 6 | * Redistribution and use in source and binary forms, with or without |
7 | * modification, are permitted provided that the following conditions | | 7 | * modification, are permitted provided that the following conditions |
8 | * are met: | | 8 | * are met: |
9 | * 1. Redistributions of source code must retain the above copyright | | 9 | * 1. Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | | 10 | * notice, this list of conditions and the following disclaimer. |
11 | * 2. Redistributions in binary form must reproduce the above copyright | | 11 | * 2. Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the | | 12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. | | 13 | * documentation and/or other materials provided with the distribution. |
14 | * | | 14 | * |
| @@ -24,27 +24,27 @@ | | | @@ -24,27 +24,27 @@ |
24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
25 | * SUCH DAMAGE. | | 25 | * SUCH DAMAGE. |
26 | */ | | 26 | */ |
27 | | | 27 | |
28 | /* | | 28 | /* |
29 | * XXX: rumphijack sort of works on glibc Linux. But it's not | | 29 | * XXX: rumphijack sort of works on glibc Linux. But it's not |
30 | * the same quality working as on NetBSD. | | 30 | * the same quality working as on NetBSD. |
31 | * autoconf HAVE_FOO vs. __NetBSD__ / __linux__ could be further | | 31 | * autoconf HAVE_FOO vs. __NetBSD__ / __linux__ could be further |
32 | * improved. | | 32 | * improved. |
33 | */ | | 33 | */ |
34 | #include <rump/rumpuser_port.h> | | 34 | #include <rump/rumpuser_port.h> |
35 | | | 35 | |
36 | #if !defined(lint) | | 36 | #if !defined(lint) |
37 | __RCSID("$NetBSD: hijack.c,v 1.116 2015/03/05 00:26:17 pooka Exp $"); | | 37 | __RCSID("$NetBSD: hijack.c,v 1.117 2015/04/11 12:54:41 riastradh Exp $"); |
38 | #endif | | 38 | #endif |
39 | | | 39 | |
40 | #include <sys/param.h> | | 40 | #include <sys/param.h> |
41 | #include <sys/types.h> | | 41 | #include <sys/types.h> |
42 | #include <sys/ioctl.h> | | 42 | #include <sys/ioctl.h> |
43 | #include <sys/mman.h> | | 43 | #include <sys/mman.h> |
44 | #include <sys/mount.h> | | 44 | #include <sys/mount.h> |
45 | #include <sys/socket.h> | | 45 | #include <sys/socket.h> |
46 | #include <sys/stat.h> | | 46 | #include <sys/stat.h> |
47 | #include <sys/time.h> | | 47 | #include <sys/time.h> |
48 | #include <sys/uio.h> | | 48 | #include <sys/uio.h> |
49 | | | 49 | |
50 | #ifdef __NetBSD__ | | 50 | #ifdef __NetBSD__ |
| @@ -1711,27 +1711,28 @@ pid_t | | | @@ -1711,27 +1711,28 @@ pid_t |
1711 | fork(void) | | 1711 | fork(void) |
1712 | { | | 1712 | { |
1713 | pid_t rv; | | 1713 | pid_t rv; |
1714 | | | 1714 | |
1715 | DPRINTF(("fork\n")); | | 1715 | DPRINTF(("fork\n")); |
1716 | | | 1716 | |
1717 | rv = rumpclient__dofork(host_fork); | | 1717 | rv = rumpclient__dofork(host_fork); |
1718 | | | 1718 | |
1719 | DPRINTF(("fork returns %d\n", rv)); | | 1719 | DPRINTF(("fork returns %d\n", rv)); |
1720 | return rv; | | 1720 | return rv; |
1721 | } | | 1721 | } |
1722 | #ifdef VFORK | | 1722 | #ifdef VFORK |
1723 | /* we do not have the luxury of not requiring a stackframe */ | | 1723 | /* we do not have the luxury of not requiring a stackframe */ |
1724 | __strong_alias(VFORK,fork); | | 1724 | #define __strong_alias_macro(m, f) __strong_alias(m, f) |
| | | 1725 | __strong_alias_macro(VFORK,fork); |
1725 | #endif | | 1726 | #endif |
1726 | | | 1727 | |
1727 | int | | 1728 | int |
1728 | daemon(int nochdir, int noclose) | | 1729 | daemon(int nochdir, int noclose) |
1729 | { | | 1730 | { |
1730 | struct rumpclient_fork *rf; | | 1731 | struct rumpclient_fork *rf; |
1731 | | | 1732 | |
1732 | if ((rf = rumpclient_prefork()) == NULL) | | 1733 | if ((rf = rumpclient_prefork()) == NULL) |
1733 | return -1; | | 1734 | return -1; |
1734 | | | 1735 | |
1735 | if (host_daemon(nochdir, noclose) == -1) | | 1736 | if (host_daemon(nochdir, noclose) == -1) |
1736 | return -1; | | 1737 | return -1; |
1737 | | | 1738 | |