summaryrefslogtreecommitdiff
path: root/src/lib/subsys
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-11-04 10:19:41 -0500
committerNick Mathewson <nickm@torproject.org>2019-11-04 10:21:10 -0500
commit51a98929148e9ca08b33735fb0542759380c57a9 (patch)
tree96951d1d564d4ac379e9feba4a28807c2855e875 /src/lib/subsys
parentb6b125709998a81d9c9c23d77c6a770ca7a927a7 (diff)
downloadtor-51a98929148e9ca08b33735fb0542759380c57a9.tar.gz
tor-51a98929148e9ca08b33735fb0542759380c57a9.zip
doxygen: Take "lib" descriptions from doc/HACKING/design.
This commit takes descriptions for src/lib and moves them into our doxygen hierarchy. I've covered everything from lib/cc through lib/sandbox here.
Diffstat (limited to 'src/lib/subsys')
-rw-r--r--src/lib/subsys/lib_subsys.dox32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/lib/subsys/lib_subsys.dox b/src/lib/subsys/lib_subsys.dox
index f9cd5eeb81..4d98ff577a 100644
--- a/src/lib/subsys/lib_subsys.dox
+++ b/src/lib/subsys/lib_subsys.dox
@@ -1,4 +1,34 @@
/**
@dir lib/subsys
-@brief lib/subsys
+@brief lib/subsys: Types for declaring a "subsystem".
+
+## Subsystems in Tor
+
+A subsystem is a module with support for initialization, shutdown,
+configuration, and so on.
+
+Many parts of Tor can be initialized, cleaned up, and configured somewhat
+independently through a table-driven mechanism. Each such part is called a
+"subsystem".
+
+To declare a subsystem, make a global `const` instance of the `subsys_fns_t`
+type, filling in the function pointer fields that you require with ones
+corresponding to your subsystem. Any function pointers left as "NULL" will
+be a no-op. Each system must have a name and a "level", which corresponds to
+the order in which it is initialized. (See `app/main/subsystem_list.c` for a
+list of current subsystems and their levels.)
+
+Then, insert your subsystem in the list in `app/main/subsystem_list.c`. It
+will need to occupy a position corresponding to its level.
+
+At this point, your subsystem will be handled like the others: it will get
+initialized at startup, torn down at exit, and so on.
+
+Historical note: Not all of Tor's code is currently handled as
+subsystems. As you work with older code, you may see some parts of the code
+that are initialized from `tor_init()` or `run_tor_main_loop()` or
+`tor_run_main()`; and torn down from `tor_cleanup()`. We aim to migrate
+these to subsystems over time; please don't add any new code that follows
+this pattern.
+
**/