Changeset 4240c10c43e30e0222824fb249f84ba1066f6c44
- Timestamp:
- 12/17/11 18:33:53
(1 year ago)
- Author:
- Theo Schlossnagle <jesus@omniti.com>
- git-committer:
- Theo Schlossnagle <jesus@omniti.com> 1324146833 -0500
- git-parent:
[8da7f661e3730fd14d4f0f64bd0aebe21afac7e5]
- git-author:
- Theo Schlossnagle <jesus@omniti.com> 1324146833 -0500
- Message:
typo fixes
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r8da7f66 |
r4240c10 |
|
| 41 | 41 | * and the noit_hooks system is what satisfies this need.</para> |
|---|
| 42 | 42 | * <para>The design goals here are somewhat specific in that we |
|---|
| 43 | | * would like to allow for a large number of hook points at low cost |
|---|
| | 43 | * would like to allow for a large number of hook points at a low cost |
|---|
| 44 | 44 | * when not instrumented. As such, a hash lookup of registered hooks |
|---|
| 45 | | * would be considered to expensive. Additionally, we want to provide |
|---|
| 46 | | * strong, compile-time type safety as it can be all to easy to hook |
|---|
| 47 | | * something with a function with a slightly incorrect protoype that |
|---|
| 48 | | * could result in disasterous corruption or crashes (or perhaps worse |
|---|
| | 45 | * would be considered too expensive. Additionally, we want to provide |
|---|
| | 46 | * strong, compile-time type-safety as it can be all to easy to hook |
|---|
| | 47 | * something with a function with a incorrect protoype that |
|---|
| | 48 | * could result in disasterous corruption or crashes (or perhaps worse: |
|---|
| 49 | 49 | * daftly subtle bugs that are punishing to troubleshoot).</para> |
|---|
| 50 | 50 | * <para>The hooks system is simple a set of two macros; one allowing |
|---|
| … | … | |
| 60 | 60 | * the name of the hook (a term that composes a valid C function name), |
|---|
| 61 | 61 | * the arguments it expects, the type of closure (usually a void *), |
|---|
| 62 | | * and some variations on those themes that provide CPP enough info |
|---|
| | 62 | * and some variations on those themes that provide CPP enough information |
|---|
| 63 | 63 | * to construct an implementation with no programmer "programming." |
|---|
| 64 | 64 | * </para> |
|---|
| … | … | |
| 75 | 75 | * <example> |
|---|
| 76 | 76 | * <title>Implementing a foobarquux hook in source.</title> |
|---|
| 77 | | * <para>A foobarquux hok implementation that takes a struct timeval * argument.</para> |
|---|
| | 77 | * <para>A foobarquux hook implementation that takes a struct timeval * argument.</para> |
|---|
| 78 | 78 | * <programlisting> |
|---|
| 79 | 79 | * NOIT_HOOK_IMPL(foobarquux, (struct timeval *now), |
|---|
| … | … | |
| 100 | 100 | * struct timeval now; |
|---|
| 101 | 101 | * gettimeofday(&now, NULL); |
|---|
| 102 | | * if(NOIT_HOOK_CONTINUE == |
|---|
| 103 | | * foobarquux_hook_invoke(&now)) |
|---|
| | 102 | * if(NOIT_HOOK_CONTINUE == foobarquux_hook_invoke(&now)) |
|---|
| 104 | 103 | * foobarquux_work(); |
|---|
| 105 | 104 | * ]]></programlisting> |
|---|
| 106 | 105 | * </example> |
|---|
| 107 | 106 | * <para>If the hook should not conditionally cause or prevent code |
|---|
| 108 | | * to run, the invoke function's return value can be ignored.</para> |
|---|
| | 107 | * to run, the invoke function's return value should be ignored.</para> |
|---|
| 109 | 108 | * <para>In order to register a function that allows the above execution |
|---|
| 110 | 109 | * on every other subsequent execution one would provide the following: |
|---|