aboutsummaryrefslogtreecommitdiff
path: root/src/lib/process
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/process')
-rw-r--r--src/lib/process/include.am6
-rw-r--r--src/lib/process/process_sys.c3
-rw-r--r--src/lib/process/restrict.c6
-rw-r--r--src/lib/process/waitpid.c4
-rw-r--r--src/lib/process/winprocess_sys.c66
-rw-r--r--src/lib/process/winprocess_sys.h14
6 files changed, 9 insertions, 90 deletions
diff --git a/src/lib/process/include.am b/src/lib/process/include.am
index af5f99617b..18876b3f54 100644
--- a/src/lib/process/include.am
+++ b/src/lib/process/include.am
@@ -16,8 +16,7 @@ src_lib_libtor_process_a_SOURCES = \
src/lib/process/process_win32.c \
src/lib/process/restrict.c \
src/lib/process/setuid.c \
- src/lib/process/waitpid.c \
- src/lib/process/winprocess_sys.c
+ src/lib/process/waitpid.c
src_lib_libtor_process_testing_a_SOURCES = \
$(src_lib_libtor_process_a_SOURCES)
@@ -35,5 +34,4 @@ noinst_HEADERS += \
src/lib/process/process_win32.h \
src/lib/process/restrict.h \
src/lib/process/setuid.h \
- src/lib/process/waitpid.h \
- src/lib/process/winprocess_sys.h
+ src/lib/process/waitpid.h
diff --git a/src/lib/process/process_sys.c b/src/lib/process/process_sys.c
index 283064cbfe..c8332ba91e 100644
--- a/src/lib/process/process_sys.c
+++ b/src/lib/process/process_sys.c
@@ -26,7 +26,8 @@ subsys_process_shutdown(void)
const subsys_fns_t sys_process = {
.name = "process",
- .level = -35,
+ SUBSYS_DECLARE_LOCATION(),
+ .level = -18,
.supported = true,
.initialize = subsys_process_initialize,
.shutdown = subsys_process_shutdown
diff --git a/src/lib/process/restrict.c b/src/lib/process/restrict.c
index a3ce52deaa..cd2a1c57b5 100644
--- a/src/lib/process/restrict.c
+++ b/src/lib/process/restrict.c
@@ -85,7 +85,7 @@ tor_set_max_memlock(void)
{
/* Future consideration for Windows is probably SetProcessWorkingSetSize
* This is similar to setting the memory rlimit of RLIMIT_MEMLOCK
- * http://msdn.microsoft.com/en-us/library/ms686234(VS.85).aspx
+ * https://msdn.microsoft.com/en-us/library/ms686234(VS.85).aspx
*/
struct rlimit limit;
@@ -128,7 +128,7 @@ tor_mlockall(void)
* Future consideration for Windows may be VirtualLock
* VirtualLock appears to implement mlock() but not mlockall()
*
- * http://msdn.microsoft.com/en-us/library/aa366895(VS.85).aspx
+ * https://msdn.microsoft.com/en-us/library/aa366895(VS.85).aspx
*/
#ifdef HAVE_UNIX_MLOCKALL
@@ -190,7 +190,7 @@ set_max_file_descriptors(rlim_t limit, int *max_out)
/* Define some maximum connections values for systems where we cannot
* automatically determine a limit. Re Cygwin, see
- * http://archives.seul.org/or/talk/Aug-2006/msg00210.html
+ * https://archives.seul.org/or/talk/Aug-2006/msg00210.html
* For an iPhone, 9999 should work. For Windows and all other unknown
* systems we use 15000 as the default. */
#ifndef HAVE_GETRLIMIT
diff --git a/src/lib/process/waitpid.c b/src/lib/process/waitpid.c
index 89ffe9fcfe..33798f65f0 100644
--- a/src/lib/process/waitpid.c
+++ b/src/lib/process/waitpid.c
@@ -58,9 +58,9 @@ process_map_entries_eq_(const waitpid_callback_t *a,
static HT_HEAD(process_map, waitpid_callback_t) process_map = HT_INITIALIZER();
HT_PROTOTYPE(process_map, waitpid_callback_t, node, process_map_entry_hash_,
- process_map_entries_eq_)
+ process_map_entries_eq_);
HT_GENERATE2(process_map, waitpid_callback_t, node, process_map_entry_hash_,
- process_map_entries_eq_, 0.6, tor_reallocarray_, tor_free_)
+ process_map_entries_eq_, 0.6, tor_reallocarray_, tor_free_);
/**
* Begin monitoring the child pid <b>pid</b> to see if we get a SIGCHLD for
diff --git a/src/lib/process/winprocess_sys.c b/src/lib/process/winprocess_sys.c
deleted file mode 100644
index e43a77e467..0000000000
--- a/src/lib/process/winprocess_sys.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Copyright (c) 2018-2020, The Tor Project, Inc. */
-/* See LICENSE for licensing information */
-
-/**
- * \file winprocess_sys.c
- * \brief Subsystem object for windows process setup.
- **/
-
-#include "orconfig.h"
-#include "lib/subsys/subsys.h"
-#include "lib/process/winprocess_sys.h"
-
-#include <stdbool.h>
-#include <stddef.h>
-
-#ifdef _WIN32
-#include <windows.h>
-
-#define WINPROCESS_SYS_ENABLED true
-
-static int
-subsys_winprocess_initialize(void)
-{
-#ifndef HeapEnableTerminationOnCorruption
-#define HeapEnableTerminationOnCorruption 1
-#endif
-
- /* On heap corruption, just give up; don't try to play along. */
- HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);
-
- /* SetProcessDEPPolicy is only supported on 32-bit Windows.
- * (On 64-bit Windows it always fails, and some compilers don't like the
- * PSETDEP cast.)
- * 32-bit Windows defines _WIN32.
- * 64-bit Windows defines _WIN32 and _WIN64. */
-#ifndef _WIN64
- /* Call SetProcessDEPPolicy to permanently enable DEP.
- The function will not resolve on earlier versions of Windows,
- and failure is not dangerous. */
- HMODULE hMod = GetModuleHandleA("Kernel32.dll");
- if (hMod) {
- typedef BOOL (WINAPI *PSETDEP)(DWORD);
- PSETDEP setdeppolicy = (PSETDEP)GetProcAddress(hMod,
- "SetProcessDEPPolicy");
- if (setdeppolicy) {
- /* PROCESS_DEP_ENABLE | PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION */
- setdeppolicy(3);
- }
- }
-#endif /* !defined(_WIN64) */
-
- return 0;
-}
-#else /* !defined(_WIN32) */
-#define WINPROCESS_SYS_ENABLED false
-#define subsys_winprocess_initialize NULL
-#endif /* defined(_WIN32) */
-
-const subsys_fns_t sys_winprocess = {
- .name = "winprocess",
- /* HeapEnableTerminationOnCorruption and setdeppolicy() are security
- * features, we want them to run first. */
- .level = -100,
- .supported = WINPROCESS_SYS_ENABLED,
- .initialize = subsys_winprocess_initialize,
-};
diff --git a/src/lib/process/winprocess_sys.h b/src/lib/process/winprocess_sys.h
deleted file mode 100644
index bece1b3da9..0000000000
--- a/src/lib/process/winprocess_sys.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/* Copyright (c) 2018-2020, The Tor Project, Inc. */
-/* See LICENSE for licensing information */
-
-/**
- * \file winprocess_sys.h
- * \brief Declare subsystem object for winprocess.c
- **/
-
-#ifndef TOR_WINPROCESS_SYS_H
-#define TOR_WINPROCESS_SYS_H
-
-extern const struct subsys_fns_t sys_winprocess;
-
-#endif /* !defined(TOR_WINPROCESS_SYS_H) */