summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-07-01 15:02:01 -0400
committerNick Mathewson <nickm@torproject.org>2018-07-01 15:20:37 -0400
commit6c440da9260b6f8fffca7cb95ed6e51f55c71b14 (patch)
tree79b12be0db0beb3fa918b5a37ad4b777be5b75a2 /src/or
parent13116378b1a8118e277320e377a691064e54983a (diff)
downloadtor-6c440da9260b6f8fffca7cb95ed6e51f55c71b14.tar.gz
tor-6c440da9260b6f8fffca7cb95ed6e51f55c71b14.zip
Remove system headers from or.h
Diffstat (limited to 'src/or')
-rw-r--r--src/or/config.c9
-rw-r--r--src/or/connection.c7
-rw-r--r--src/or/control.c7
-rw-r--r--src/or/dns.c4
-rw-r--r--src/or/hibernate.c4
-rw-r--r--src/or/hs_service.c7
-rw-r--r--src/or/main.c4
-rw-r--r--src/or/microdesc.c4
-rw-r--r--src/or/networkstatus.c4
-rw-r--r--src/or/or.h43
-rw-r--r--src/or/rendservice.c10
-rw-r--r--src/or/rephist.c4
-rw-r--r--src/or/routerkeys.c4
-rw-r--r--src/or/routerlist.c4
-rw-r--r--src/or/routerparse.c3
-rw-r--r--src/or/scheduler_kist.c4
-rw-r--r--src/or/statefile.c4
17 files changed, 84 insertions, 42 deletions
diff --git a/src/or/config.c b/src/or/config.c
index 0507c43121..a29958c579 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -110,6 +110,15 @@
#ifdef _WIN32
#include <shlobj.h>
#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
#include "lib/meminfo/meminfo.h"
#include "lib/osinfo/uname.h"
diff --git a/src/or/connection.c b/src/or/connection.c
index e42288579b..66ccc51b5e 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -112,6 +112,13 @@
#include <pwd.h>
#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
#ifdef HAVE_SYS_UN_H
#include <sys/socket.h>
#include <sys/un.h>
diff --git a/src/or/control.c b/src/or/control.c
index 35e8cacd83..67d1a0c686 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -100,6 +100,13 @@
#include "or/routerlist_st.h"
#include "or/socks_request_st.h"
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
#ifndef _WIN32
#include <pwd.h>
#include <sys/resource.h>
diff --git a/src/or/dns.c b/src/or/dns.c
index 08a55170e5..45c4384eb1 100644
--- a/src/or/dns.c
+++ b/src/or/dns.c
@@ -69,6 +69,10 @@
#include "or/edge_connection_st.h"
#include "or/or_circuit_st.h"
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
#include <event2/event.h>
#include <event2/dns.h>
diff --git a/src/or/hibernate.c b/src/or/hibernate.c
index f98ada02d6..c44e974fc1 100644
--- a/src/or/hibernate.c
+++ b/src/or/hibernate.c
@@ -46,6 +46,10 @@ hibernating, phase 2:
#include "or/or_connection_st.h"
#include "or/or_state_st.h"
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
/** Are we currently awake, asleep, running out of bandwidth, or shutting
* down? */
static hibernate_state_t hibernate_state = HIBERNATE_STATE_INITIAL;
diff --git a/src/or/hs_service.c b/src/or/hs_service.c
index b651f1e27d..6cb01b57c9 100644
--- a/src/or/hs_service.c
+++ b/src/or/hs_service.c
@@ -56,6 +56,13 @@
#include "trunnel/hs/cell_common.h"
#include "trunnel/hs/cell_establish_intro.h"
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
/* Helper macro. Iterate over every service in the global map. The var is the
* name of the service pointer. */
#define FOR_EACH_SERVICE_BEGIN(var) \
diff --git a/src/or/main.c b/src/or/main.c
index 9851cdb57b..b48c0b813b 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -136,6 +136,10 @@
#include "or/routerinfo_st.h"
#include "or/socks_request_st.h"
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
#ifdef HAVE_SYSTEMD
# if defined(__COVERITY__) && !defined(__INCLUDE_LEVEL__)
/* Systemd's use of gcc's __INCLUDE_LEVEL__ extension macro appears to confuse
diff --git a/src/or/microdesc.c b/src/or/microdesc.c
index 838c966a20..a0ee4ba5f3 100644
--- a/src/or/microdesc.c
+++ b/src/or/microdesc.c
@@ -30,6 +30,10 @@
#include "or/node_st.h"
#include "or/routerstatus_st.h"
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
/** A data structure to hold a bunch of cached microdescriptors. There are
* two active files in the cache: a "cache file" that we mmap, and a "journal
* file" that we append to. Periodically, we rebuild the cache file to hold
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 133ab84b3b..f91e46cdd7 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -88,6 +88,10 @@
#include "or/vote_microdesc_hash_st.h"
#include "or/vote_routerstatus_st.h"
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
/** Most recently received and validated v3 "ns"-flavored consensus network
* status. */
STATIC networkstatus_t *current_ns_consensus = NULL;
diff --git a/src/or/or.h b/src/or/or.h
index 4ed774389d..b0340ed1a0 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -13,56 +13,15 @@
#define TOR_OR_H
#include "orconfig.h"
+#include "lib/cc/torint.h"
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h> /* FreeBSD needs this to know what version it is */
-#endif
-#include "lib/cc/torint.h"
-#ifdef HAVE_SYS_FCNTL_H
-#include <sys/fcntl.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#ifdef HAVE_SYS_IOCTL_H
-#include <sys/ioctl.h>
-#endif
-#ifdef HAVE_SYS_UN_H
-#include <sys/un.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#ifdef HAVE_ERRNO_H
-#include <errno.h>
-#endif
#ifdef HAVE_TIME_H
#include <time.h>
#endif
-#ifdef _WIN32
-#include <winsock2.h>
-#include <io.h>
-#include <process.h>
-#include <direct.h>
-#include <windows.h>
-#endif /* defined(_WIN32) */
-
#include "common/util.h"
#include "lib/container/map.h"
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index 6d08616477..8e094b593c 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -51,6 +51,16 @@
#include "or/rend_service_descriptor_st.h"
#include "or/routerstatus_st.h"
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
struct rend_service_t;
static origin_circuit_t *find_intro_circuit(rend_intro_point_t *intro,
const char *pk_digest);
diff --git a/src/or/rephist.c b/src/or/rephist.c
index 02dc864033..a74a952ce2 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -98,6 +98,10 @@
#include "lib/math/fp.h"
#include "lib/math/laplace.h"
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
static void bw_arrays_init(void);
static void predicted_ports_alloc(void);
diff --git a/src/or/routerkeys.c b/src/or/routerkeys.c
index b92ec76aac..bb04a8b220 100644
--- a/src/or/routerkeys.c
+++ b/src/or/routerkeys.c
@@ -29,6 +29,10 @@
#define ENC_KEY_HEADER "Boxed Ed25519 key"
#define ENC_KEY_TAG "master"
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
/* DOCDOC */
static ssize_t
do_getpass(const char *prompt, char *buf, size_t buflen,
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 189ea8acd4..164b0bf865 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -141,6 +141,10 @@
#include "lib/crypt_ops/digestset.h"
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
// #define DEBUG_ROUTERLIST
/****************************************************************************/
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index f07080a4d4..29eb483212 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -104,6 +104,9 @@
#undef log
#include <math.h>
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
/****************************************************************************/
diff --git a/src/or/scheduler_kist.c b/src/or/scheduler_kist.c
index 3059952b92..5a45ccab88 100644
--- a/src/or/scheduler_kist.c
+++ b/src/or/scheduler_kist.c
@@ -19,6 +19,10 @@
#define TLS_PER_CELL_OVERHEAD 29
+#ifdef HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+
#ifdef HAVE_KIST_SUPPORT
/* Kernel interface needed for KIST. */
#include <netinet/tcp.h>
diff --git a/src/or/statefile.c b/src/or/statefile.c
index 5631001c02..e9db1ff069 100644
--- a/src/or/statefile.c
+++ b/src/or/statefile.c
@@ -46,6 +46,10 @@
#include "or/or_state_st.h"
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
/** A list of state-file "abbreviations," for compatibility. */
static config_abbrev_t state_abbrevs_[] = {
{ "AccountingBytesReadInterval", "AccountingBytesReadInInterval", 0, 0 },