|
@@ -1,108 +0,0 @@
|
|
|
-
|
|
|
- * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
|
|
|
- * Copyright (c) 2007-2018, The Tor Project, Inc. */
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- * \file compat.c
|
|
|
- * \brief Wrappers to make calls more portable. This code defines
|
|
|
- * functions such as tor_snprintf, get/set various data types,
|
|
|
- * renaming, setting socket options, switching user IDs. It is basically
|
|
|
- * where the non-portable items are conditionally included depending on
|
|
|
- * the platform.
|
|
|
- **/
|
|
|
-
|
|
|
-#define COMPAT_PRIVATE
|
|
|
-#include "common/compat.h"
|
|
|
-
|
|
|
-#ifdef _WIN32
|
|
|
-#include <winsock2.h>
|
|
|
-#include <windows.h>
|
|
|
-#include <sys/locking.h>
|
|
|
-#endif
|
|
|
-
|
|
|
-#ifdef HAVE_UNAME
|
|
|
-#include <sys/utsname.h>
|
|
|
-#endif
|
|
|
-#ifdef HAVE_SYS_TYPES_H
|
|
|
-#include <sys/types.h>
|
|
|
-#endif
|
|
|
-#ifdef HAVE_SYS_SYSCTL_H
|
|
|
-#include <sys/sysctl.h>
|
|
|
-#endif
|
|
|
-#ifdef HAVE_SYS_STAT_H
|
|
|
-#include <sys/stat.h>
|
|
|
-#endif
|
|
|
-#ifdef HAVE_UTIME_H
|
|
|
-#include <utime.h>
|
|
|
-#endif
|
|
|
-#ifdef HAVE_SYS_UTIME_H
|
|
|
-#include <sys/utime.h>
|
|
|
-#endif
|
|
|
-#ifdef HAVE_UNISTD_H
|
|
|
-#include <unistd.h>
|
|
|
-#endif
|
|
|
-#ifdef HAVE_SYS_FCNTL_H
|
|
|
-#include <sys/fcntl.h>
|
|
|
-#endif
|
|
|
-#ifdef HAVE_PWD_H
|
|
|
-#include <pwd.h>
|
|
|
-#endif
|
|
|
-#ifdef HAVE_GRP_H
|
|
|
-#include <grp.h>
|
|
|
-#endif
|
|
|
-#ifdef HAVE_FCNTL_H
|
|
|
-#include <fcntl.h>
|
|
|
-#endif
|
|
|
-#ifdef HAVE_ERRNO_H
|
|
|
-#include <errno.h>
|
|
|
-#endif
|
|
|
-#ifdef HAVE_ARPA_INET_H
|
|
|
-#include <arpa/inet.h>
|
|
|
-#endif
|
|
|
-#ifdef HAVE_SYS_STATVFS_H
|
|
|
-#include <sys/statvfs.h>
|
|
|
-#endif
|
|
|
-#ifdef HAVE_SYS_CAPABILITY_H
|
|
|
-#include <sys/capability.h>
|
|
|
-#endif
|
|
|
-
|
|
|
-
|
|
|
-#if defined(HAVE_SYS_PRCTL_H) && defined(__linux__)
|
|
|
-
|
|
|
-#include <sys/prctl.h>
|
|
|
-#elif defined(__APPLE__)
|
|
|
-#include <sys/ptrace.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 <stdio.h>
|
|
|
-#include <stdlib.h>
|
|
|
-#ifdef HAVE_SIGNAL_H
|
|
|
-#include <signal.h>
|
|
|
-#endif
|
|
|
-#ifdef HAVE_MMAP
|
|
|
-#include <sys/mman.h>
|
|
|
-#endif
|
|
|
-#ifdef HAVE_SYS_SYSLIMITS_H
|
|
|
-#include <sys/syslimits.h>
|
|
|
-#endif
|
|
|
-#ifdef HAVE_SYS_FILE_H
|
|
|
-#include <sys/file.h>
|
|
|
-#endif
|
|
|
-
|
|
|
-#include "lib/log/torlog.h"
|
|
|
-#include "common/util.h"
|
|
|
-#include "lib/container/smartlist.h"
|
|
|
-#include "lib/wallclock/tm_cvt.h"
|
|
|
-#include "lib/net/address.h"
|
|
|
-#include "lib/sandbox/sandbox.h"
|
|
|
-
|
|
|
-
|
|
|
- * Process control
|
|
|
- */
|