Database files managed by Rhino are accessed either by user-space applications or by other in-kernel extensions. For ease of use and understanding, we use C nomenclature to present interfaces accessed by user-space applications.
Table 1
shows the system calls supported by Rhino. The system call
interface resembles those found in other systems [#!rvm!#,#!odi!#,#!texas!#].
Figure 4 shows a simple application
that writes ``z''s onto the region that extends from byte 256 to byte 384 in the
file ``/efs/test''. To
access a database file, the application first calls trans_open
to get a handle to the file. It then calls trans_mmap to map
the file onto a virtual address space region (that must be
MMU-page aligned). After setup of the transactional memory region,
the application need only demarcate transactions by using
trans_begin, trans_commit, and trans_abort.
Accesses to the transactional memory region are detected through page
faults.
main()
{
tid_t tid;
sid_t sid;
void *base = (void*)0x10000;
/* Open the file /efs/test. */
sid = trans_open("/efs/test");
/* Map the storage from 0x10000 .. 0x90000. */
trans_mmap(base, 0x80000, sid);
tid = trans_begin();
/* Fill the region with "z". */
memset(base + 256, 'z', 128);
if (something_wrong()) trans_abort(tid);
else trans_commit(tid);
}