next up previous
Next: Design and implementation Up: VSys: A Privilege Allocation Previous: Script authors

Programmatic invocation of Vsys scripts

Invoking Vsys programmatically is more complex than invoking it at the command line. This is because of the blocking semantics of Vsys. While most programmers prefer interacting with files in blocking mode, Vsys requires that entries be opened in non-blocking mode. Once the entries have been opened, there are two ways to proceed. The first is to continue to use them in non-blocking mode and to use event-driven I/O to transfer data. If this method is too laborious to implement, then the second approach is to switch the entries back into blocking mode. The following example demonstrates how the latter is implemented:

FILE *fp = NULL, *fp_in = NULL;
FILE *out_fp = NULL, *diff_fp...
...= NULL) {

As you can see, the entries are opened first in NON-BLOCKING mode, and then switched over to BLOCKING mode so that data can be read and written conveniently.