Created
June 21, 2014 08:44
-
-
Save syuu1228/2b27ac03e0733c72516d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 6c41080d8a18d7d21efd9a913f0d15e04ec2628e Mon Sep 17 00:00:00 2001 | |
From: Takuya ASADA <syuu@cloudius-systems.com> | |
Date: Sat, 21 Jun 2014 17:43:51 +0900 | |
Subject: [PATCH] network: __resp stub | |
Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com> | |
--- | |
apps | 2 +- | |
bsd/porting/res.cc | 163 +++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
build.mk | 1 + | |
fs/vfs/main.cc | 1 + | |
4 files changed, 166 insertions(+), 1 deletion(-) | |
create mode 100644 bsd/porting/res.cc | |
diff --git a/apps b/apps | |
index e138453..3750751 160000 | |
--- a/apps | |
+++ b/apps | |
@@ -1 +1 @@ | |
-Subproject commit e138453f614f41ab940bfa6a4fcc40519ca9af0f | |
+Subproject commit 3750751ddb5064b6b3ff1d31454996523926245c | |
diff --git a/bsd/porting/res.cc b/bsd/porting/res.cc | |
new file mode 100644 | |
index 0000000..2fabcc1 | |
--- /dev/null | |
+++ b/bsd/porting/res.cc | |
@@ -0,0 +1,163 @@ | |
+/* | |
+ * Copyright (c) 1983, 1987, 1989 | |
+ * The Regents of the University of California. All rights reserved. | |
+ * | |
+ * Redistribution and use in source and binary forms, with or without | |
+ * modification, are permitted provided that the following conditions | |
+ * are met: | |
+ * 1. Redistributions of source code must retain the above copyright | |
+ * notice, this list of conditions and the following disclaimer. | |
+ * 2. Redistributions in binary form must reproduce the above copyright | |
+ * notice, this list of conditions and the following disclaimer in the | |
+ * documentation and/or other materials provided with the distribution. | |
+ * 4. Neither the name of the University nor the names of its contributors | |
+ * may be used to endorse or promote products derived from this software | |
+ * without specific prior written permission. | |
+ * | |
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
+ * SUCH DAMAGE. | |
+ */ | |
+ | |
+/* | |
+ * Portions Copyright (c) 1996-1999 by Internet Software Consortium. | |
+ * | |
+ * Permission to use, copy, modify, and distribute this software for any | |
+ * purpose with or without fee is hereby granted, provided that the above | |
+ * copyright notice and this permission notice appear in all copies. | |
+ * | |
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS | |
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES | |
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE | |
+ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL | |
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR | |
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS | |
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS | |
+ * SOFTWARE. | |
+ */ | |
+ | |
+/* | |
+ * @(#)resolv.h 8.1 (Berkeley) 6/2/93 | |
+ * $BINDId: resolv.h,v 8.31 2000/03/30 20:16:50 vixie Exp $ | |
+ */ | |
+ | |
+#include <sys/cdefs.h> | |
+ | |
+#include <osv/ioctl.h> | |
+ | |
+#include <bsd/porting/netport.h> | |
+ | |
+#include <bsd/sys/sys/param.h> | |
+#include <bsd/sys/sys/priv.h> | |
+#include <bsd/sys/sys/socket.h> | |
+ | |
+#include <bsd/sys/net/if.h> | |
+#include <bsd/sys/net/if_var.h> | |
+#include <bsd/sys/net/if_arp.h> | |
+#include <bsd/sys/net/if_dl.h> | |
+#include <bsd/sys/net/if_llatbl.h> | |
+#include <bsd/sys/net/if_types.h> | |
+#include <bsd/sys/net/route.h> | |
+#include <bsd/sys/net/vnet.h> | |
+ | |
+#include <bsd/sys/netinet/in.h> | |
+#include <bsd/sys/netinet/in_var.h> | |
+#include <bsd/sys/netinet/in_pcb.h> | |
+#include <bsd/sys/netinet/ip_var.h> | |
+#include <bsd/sys/netinet/igmp_var.h> | |
+ | |
+#include <bsd/sys/netinet/udp.h> | |
+#include <bsd/sys/netinet/udp_var.h> | |
+ | |
+#include <netinet6/in6.h> | |
+ | |
+ | |
+#if 0 | |
+typedef res_sendhookact (*res_send_qhook) (struct sockaddr_in * const *__ns, | |
+ const u_char **__query, | |
+ int *__querylen, | |
+ u_char *__ans, | |
+ int __anssiz, | |
+ int *__resplen); | |
+ | |
+typedef res_sendhookact (*res_send_rhook) (const struct sockaddr_in *__ns, | |
+ const u_char *__query, | |
+ int __querylen, | |
+ u_char *__ans, | |
+ int __anssiz, | |
+ int *__resplen); | |
+#endif | |
+ | |
+/* | |
+ * Global defines and variables for resolver stub. | |
+ */ | |
+# define MAXNS 3 /* max # name servers we'll track */ | |
+# define MAXDFLSRCH 3 /* # default domain levels to try */ | |
+# define MAXDNSRCH 6 /* max # domains in search path */ | |
+# define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */ | |
+ | |
+# define RES_TIMEOUT 5 /* min. seconds between retries */ | |
+# define MAXRESOLVSORT 10 /* number of net to sort on */ | |
+# define RES_MAXNDOTS 15 /* should reflect bit field size */ | |
+# define RES_MAXRETRANS 30 /* only for resolv.conf/RES_OPTIONS */ | |
+# define RES_MAXRETRY 5 /* only for resolv.conf/RES_OPTIONS */ | |
+# define RES_DFLRETRY 2 /* Default #/tries. */ | |
+# define RES_MAXTIME 65535 /* Infinity, in milliseconds. */ | |
+ | |
+struct __res_state { | |
+ int retrans; /* retransmition time interval */ | |
+ int retry; /* number of times to retransmit */ | |
+ u_long options; /* option flags - see below. */ | |
+ int nscount; /* number of name servers */ | |
+ struct bsd_sockaddr_in | |
+ nsaddr_list[MAXNS]; /* address of name server */ | |
+# define nsaddr nsaddr_list[0] /* for backward compatibility */ | |
+ u_short id; /* current message id */ | |
+ /* 2 byte hole here. */ | |
+ char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */ | |
+ char defdname[256]; /* default domain (deprecated) */ | |
+ u_long pfcode; /* RES_PRF_ flags - see below. */ | |
+ unsigned ndots:4; /* threshold for initial abs. query */ | |
+ unsigned nsort:4; /* number of elements in sort_list[] */ | |
+ unsigned ipv6_unavail:1; /* connecting to IPv6 server failed */ | |
+ unsigned unused:23; | |
+ struct { | |
+ struct in_addr addr; | |
+ u_int32_t mask; | |
+ } sort_list[MAXRESOLVSORT]; | |
+ /* 4 byte hole here on 64-bit architectures. */ | |
+ void *qhook; /* query hook */ | |
+ void *rhook; /* response hook */ | |
+ int res_h_errno; /* last one set for this context */ | |
+ int _vcsock; /* PRIVATE: for res_send VC i/o */ | |
+ u_int _flags; /* PRIVATE: see below */ | |
+ /* 4 byte hole here on 64-bit architectures. */ | |
+ union { | |
+ char pad[52]; /* On an i386 this means 512b total. */ | |
+ struct { | |
+ u_int16_t nscount; | |
+ u_int16_t nsmap[MAXNS]; | |
+ int nssocks[MAXNS]; | |
+ u_int16_t nscount6; | |
+ u_int16_t nsinit; | |
+ struct sockaddr_in6 *nsaddrs[MAXNS]; | |
+#ifdef _LIBC | |
+ unsigned long long int initstamp | |
+ __attribute__((packed)); | |
+#else | |
+ unsigned int _initstamp[2]; | |
+#endif | |
+ } _ext; | |
+ } _u; | |
+}; | |
+ | |
+struct __res_state _res __attribute__ ((nocommon)); | |
+struct __res_state *__resp = &_res; | |
diff --git a/build.mk b/build.mk | |
index 98411a4..d7086a8 100644 | |
--- a/build.mk | |
+++ b/build.mk | |
@@ -469,6 +469,7 @@ bsd += bsd/porting/mmu.o | |
bsd += bsd/porting/pcpu.o | |
bsd += bsd/porting/bus_dma.o | |
bsd += bsd/porting/kobj.o | |
+bsd += bsd/porting/res.o | |
bsd += bsd/sys/netinet/if_ether.o | |
bsd += bsd/sys/compat/linux/linux_socket.o | |
bsd += bsd/sys/compat/linux/linux_ioctl.o | |
diff --git a/fs/vfs/main.cc b/fs/vfs/main.cc | |
index 59926f5..7469b14 100644 | |
--- a/fs/vfs/main.cc | |
+++ b/fs/vfs/main.cc | |
@@ -1319,6 +1319,7 @@ int access(const char *pathname, int mode) | |
trace_vfs_access_err(error); | |
return -1; | |
} | |
+int eaccess(const char *pathname, int mode) { return access(pathname, mode); } | |
#if 0 | |
static int | |
-- | |
1.9.3 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment