```{index} single: fd (DB_File) ``` ```{index} single: DB_File::fd ``` # fd The file descriptor of the database's file - for a `$DB_RECNO` array, its text file - or -1 for an in-memory database. ## Synopsis ```perl my $fd = $db->fd; ``` ## What you get back A descriptor number, or -1. ## Edge cases - To keep processes from working on a database at the same time, lock a separate lock file before `tie` and unlock it after `untie`, rather than locking this descriptor: only then is everything a process wrote in the file before the next one reads it. ## Differences from upstream Fully compatible with upstream. Covered by `t/81-xs-native/DB_File/010-phenotype.t`. ## See also - `sync` - writes the database to its file