On Thu, 07 Jun 2012, Joerg Sonnenberger wrote:
The last real consume of the db(3) API in libc is the lastlogx handling in utmpx. Basically, this logs a record in a file indexed by uid. I can think of three different approaches for dealing with this:(1) Just use a sparse file. This requires by far the least amount of code, just some verification logic for a file header and writing to "uid * size of entry". Writes should be short enough to ensure atomic writes even on NFS. Same for reads. No manual locking needed.
With 32-bit uid_t, the file size could appear to be multiple gigabytes, even though not that much space is actually used. This might confuse people and naive copy or backup processes.
(2) Implement a simple hierachical byte-level index, [...] (3) Implement on-disk PATRICA lookup. [...]
(4) Use sqlite. (0) continue to use db(3). --apb (Alan Barrett)