]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Remove system headers from or.h
authorNick Mathewson <nickm@torproject.org>
Sun, 1 Jul 2018 19:02:01 +0000 (15:02 -0400)
committerNick Mathewson <nickm@torproject.org>
Sun, 1 Jul 2018 19:20:37 +0000 (15:20 -0400)
32 files changed:
src/or/config.c
src/or/connection.c
src/or/control.c
src/or/dns.c
src/or/hibernate.c
src/or/hs_service.c
src/or/main.c
src/or/microdesc.c
src/or/networkstatus.c
src/or/or.h
src/or/rendservice.c
src/or/rephist.c
src/or/routerkeys.c
src/or/routerlist.c
src/or/routerparse.c
src/or/scheduler_kist.c
src/or/statefile.c
src/test/test_addr.c
src/test/test_bt_cl.c
src/test/test_checkdir.c
src/test/test_config.c
src/test/test_crypto.c
src/test/test_dir.c
src/test/test_extorport.c
src/test/test_hs.c
src/test/test_logging.c
src/test/test_microdesc.c
src/test/test_routerkeys.c
src/test/test_shared_random.c
src/test/test_switch_id.c
src/test/test_util.c
src/test/testing_common.c

index 0507c43121e0f327d7a9c08ed157ee92c7d80a04..a29958c57900acc09ca060613c136c7818484de1 100644 (file)
 #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"
index e42288579b9ed777fdf62baad5577c97508d0f2d..66ccc51b5ef6b16126c19c893bf4730f3975146e 100644 (file)
 #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>
index 35e8cacd83ff41f4af9a392e4ce21b747f3ad133..67d1a0c686d10b829c7e3e05ed050e14314df3ef 100644 (file)
 #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>
index 08a55170e5edbd9e4464b2cde601a3e19c81ac5f..45c4384eb1eef7cfd68a5830e3fe26e46b45bbb4 100644 (file)
 #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>
 
index f98ada02d6c56a7621d9bb09f194a673700cfb6e..c44e974fc19bc7531699b4200347e5d5d9222840 100644 (file)
@@ -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;
index b651f1e27d9380d826cb58eb7d917bdefa60a0d6..6cb01b57c9bc8b59a37337be28deb254f4541fed 100644 (file)
 #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)                          \
index 9851cdb57b653edb457bf59628a9995f825ac851..b48c0b813b1a7ac18ba901b24ac2f370b62d2452 100644 (file)
 #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
index 838c966a20971a6e992c288c5ede0ef68def3dd7..a0ee4ba5f3fb40ff3808493e6b4bcadbb84e9188 100644 (file)
 #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
index 133ab84b3b556ba98123f7f0c4279ff6a1e47523..f91e46cdd7cdeff0ba60f0418b0e5ecfa956c8d0 100644 (file)
 #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;
index 4ed774389d82b214f8cecd8e06cc865074501a66..b0340ed1a0f4cf34a8d0e714320d5be50d8c2aae 100644 (file)
 #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"
index 6d08616477f51696cbd3a951bafef1e54257f9b9..8e094b593c5f48c1015df2e95a06368131da5b8f 100644 (file)
 #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);
index 02dc864033caecaeb9682b287bf1139b8e94bfe1..a74a952ce22bad263fba1e820ba091422b775dcc 100644 (file)
 #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);
 
index b92ec76aac672bfd73787c7a542b196b0f0cb695..bb04a8b220959e0b2a86e2777f59387d505a1a32 100644 (file)
 #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,
index 189ea8acd4a9ec5e1aede73b30bf6bac1ca303fd..164b0bf865bfd8e7c2f0aed9f7e75ee86bc20196 100644 (file)
 
 #include "lib/crypt_ops/digestset.h"
 
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
 // #define DEBUG_ROUTERLIST
 
 /****************************************************************************/
index f07080a4d4bfea71edc39bc74f0c03f7b0f055f0..29eb483212b9cf19281dd8c67d9d377e2fed2b1f 100644 (file)
 
 #undef log
 #include <math.h>
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
 
 /****************************************************************************/
 
index 3059952b92a2acfd95c068a4a2543d5f0138bf13..5a45ccab88884c4b320d90db5e83d1cd6c21fdd1 100644 (file)
 
 #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>
index 5631001c02fa93e77a5a4c8314323e247fb06efe..e9db1ff0695339bd26580cce5a870d0df971d53c 100644 (file)
 
 #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 },
index 0a3212adbcc4916b07f6e5478cd5976ccfa621a3..1069e25b43650536b4d691f0192bea5fae5af3df 100644 (file)
 #include "or/addressmap.h"
 #include "test/log_test_helpers.h"
 
+#ifdef HAVE_SYS_UN_H
+#include <sys/un.h>
+#endif
+
 /** Mocking replacement: only handles localhost. */
 static int
 mock_tor_addr_lookup(const char *name, uint16_t family, tor_addr_t *addr_out)
@@ -1257,4 +1261,3 @@ struct testcase_t addr_tests[] = {
   { "make_null", test_addr_make_null, 0, NULL, NULL },
   END_OF_TESTCASES
 };
-
index c64ca8e2b314216d48aeae0f869dc7205bddb752..8a8221f190d725e8c797489a0dea028a2f07ceff 100644 (file)
 #include "lib/err/backtrace.h"
 #include "lib/log/torlog.h"
 
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
 /* -1: no crash.
  *  0: crash with a segmentation fault.
  *  1x: crash with an assertion failure. */
@@ -118,4 +122,3 @@ main(int argc, char **argv)
 
   return 0;
 }
-
index d0c899a07e0cf74c0ac26f6cd9f50e8b9e200e6f..09688cf0a98a13dc6cbf0bc8ef610c51e4aa4c1d 100644 (file)
 #include "test/test.h"
 #include "common/util.h"
 
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
 #ifdef _WIN32
 #define mkdir(a,b) mkdir(a)
 #define tt_int_op_nowin(a,op,b) do { (void)(a); (void)(b); } while (0)
@@ -146,4 +150,3 @@ struct testcase_t checkdir_tests[] = {
   CHECKDIR(perms, TT_FORK),
   END_OF_TESTCASES
 };
-
index d84cac4e917f1e7cbf652ca26190c7885c40a7b6..25199454e4c3eddba84879df3c5248c8214c7954 100644 (file)
 #include "lib/net/gethostname.h"
 #include "lib/encoding/confline.h"
 
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
 static void
 test_config_addressmap(void *arg)
 {
index e342c933bcebc1a849fbb208d0616c112bfeeda0..194c54e8578ff0ec2639f79765f6ff1d4b0a74fc 100644 (file)
 #include "lib/crypt_ops/crypto_rand.h"
 #include "ed25519_vectors.inc"
 
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
 /** Run unit tests for Diffie-Hellman functionality. */
 static void
 test_crypto_dh(void *arg)
index a2b4ec68a862d1729f9ae8ef8ae07124c0dfa197..5adfb95706a851c95cb9ef0c1a506568ea210008 100644 (file)
 #include "or/vote_microdesc_hash_st.h"
 #include "or/vote_routerstatus_st.h"
 
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
 #define NS_MODULE dir
 
 static void
index 0032ef5b78effdbd5d6d1919c918b028b021d8b3..4ddef4e43b56c5299c00f8c13991737e5013f729 100644 (file)
 
 #include "test/test.h"
 
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
 /* Test connection_or_remove_from_ext_or_id_map and
  * connection_or_set_ext_or_identifier */
 static void
@@ -610,4 +614,3 @@ struct testcase_t extorport_tests[] = {
   { "handshake", test_ext_or_handshake, TT_FORK, NULL, NULL },
   END_OF_TESTCASES
 };
-
index 2a6cd28272ac5a33f15a99c1b3cd466f3068d526..b17e8cf21f8083d49c6723260ec0f5729c5f64ea 100644 (file)
 
 #include "test/test_helpers.h"
 
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
 /* mock ID digest and longname for node that's in nodelist */
 #define HSDIR_EXIST_ID "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA" \
                        "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
index d979411469d683e20345e48467f105887a6b878d..48cdf2e6bce1fecd1d9110cd5b39d7c51940b2f2 100644 (file)
 #include "test/test.h"
 #include "lib/process/subprocess.h"
 
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
 static void
 dummy_cb_fn(int severity, uint32_t domain, const char *msg)
 {
index 1b680c02c5b688e962a677d2618e76a550bdc5b1..2038f549845c15d9db3fa95407a6a7c1e042c3fb 100644 (file)
 
 #include "test/test.h"
 
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
 #ifdef _WIN32
 /* For mkdir() */
 #include <direct.h>
@@ -815,4 +819,3 @@ struct testcase_t microdesc_tests[] = {
   { "corrupt_desc", test_md_corrupt_desc, TT_FORK, NULL, NULL },
   END_OF_TESTCASES
 };
-
index 3fc381cd20f42260415fa9aaf2b70ce29a801e9b..8c2be30a8f6016c1ba533731d576cc6523d8e36d 100644 (file)
 #include <direct.h>
 #endif
 
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
 static void
 test_routerkeys_write_fingerprint(void *arg)
 {
index 293ed6cf33cd9bcd87291c41dde2cf5c148556e4..1b4fdc899240493386d947a537e1778faed9d77f 100644 (file)
 #include "or/networkstatus_st.h"
 #include "or/or_state_st.h"
 
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
 static authority_cert_t *mock_cert;
 
 static authority_cert_t *
index 11fe53b7c5d5e70fc4a81fa3ffbd32a5662679f1..95801822f9af78eaca7f5aea3bc0af1c551c7eb3 100644 (file)
@@ -7,6 +7,9 @@
 #ifdef HAVE_SYS_CAPABILITY_H
 #include <sys/capability.h>
 #endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 
 #define TEST_BUILT_WITH_CAPS         0
 #define TEST_HAVE_CAPS               1
index ab0573e560396ce01a63c9dd04ee5e762b3b4dc3..3c0b4f77fcfd729b1eeaf3effd431e49b0fa2265 100644 (file)
 #ifdef HAVE_UTIME_H
 #include <utime.h>
 #endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
 #ifdef _WIN32
 #include <tchar.h>
 #endif
index 0b7a3287a44d1b43cad0f7eeddfbb639e7a149e5..ace564d0fec5aeb2c4b134bc2bd6a3bb082c1ecd 100644 (file)
 #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
 
 #ifdef _WIN32
 /* For mkdir() */