| 1 | # VCC Proofs of the Linux epoll event loop |
| 2 | |
| 3 | This directory gives the specification and annotated source-code implementation |
| 4 | of the Linux epoll event loop implementation of C-IO. See |
| 5 | `docs/epoll_event_loop_proof.md` for an overview of the properties proven, |
| 6 | assumptions and simplifications. |
| 7 | |
| 8 | ## Reading the proofs |
| 9 | |
| 10 | The majority of the specification is given in the header file `preamble.h`, |
| 11 | which specifies a contract (preconditions and postconditions) for each |
| 12 | implementation function. |
| 13 | |
| 14 | The proofs themselves are the source code of the Linux epoll event loop |
| 15 | implementation with VCC annotations embedded alongside to guide VCC. |
| 16 | We split the event loop functions over the following files: |
| 17 | |
| 18 | - `cancel_task.c` |
| 19 | - `is_on_callers_thread.c` |
| 20 | - `lifecycle.c` |
| 21 | - `main_loop.c` |
| 22 | - `new_destroy.c` |
| 23 | - `process_task_pre_queue.c` |
| 24 | - `schedule.c` |
| 25 | - `subscribe.c` |
| 26 | - `unsubscribe.c` |
| 27 | |
| 28 | Additionally, the file `client.c` shows some simple uses of the event loop API, |
| 29 | demonstrating that the specifications can be used together in a meaningful way. |
| 30 | |
| 31 | ## Running proof regression |
| 32 | |
| 33 | The following will check all proofs assuming VCC and make are on your path. |
| 34 | For obtaining VCC, see the next section on building VCC in a Windows docker |
| 35 | container. |
| 36 | |
| 37 | $ make |
| 38 | |
| 39 | ## VCC docker container |
| 40 | |
| 41 | I've tested the following on Windows 10 1809 with Docker Desktop 2.2.03. |
| 42 | |
| 43 | 1. Make sure that docker is running with Windows containers. Another good |
| 44 | sanity check is to ensure `docker run hello-world` works as expected. |
| 45 | |
| 46 | 2. Build the image (this takes about 30 minutes) |
| 47 | |
| 48 | docker build -t vcc docker-images/win10-vs2012/ |
| 49 | |
| 50 | 3. Run an interactive powershell in a container |
| 51 | |
| 52 | docker run -it vcc powershell |
| 53 | |
| 54 | 4. Inside the container check VCC works |
| 55 | |
| 56 | vcc "C:\vcc\vcc\Test\testsuite\examples3\ArrayList.c" |
| 57 | Verification of ArrayList#adm succeeded.[1.36] |
| 58 | Verification of Length succeeded. [0.01] |
| 59 | Verification of CreateArrayList succeeded. [0.05] |
| 60 | Verification of MakeEmpty succeeded. [0.03] |
| 61 | Verification of Select succeeded. [0.02] |
| 62 | Verification of Update succeeded. [0.05] |
| 63 | Verification of DisposeArrayList succeeded. [0.03] |
| 64 | Verification of Add succeeded. [0.44] |
| 65 | Verification of main_test succeeded. [0.67] |