recno(3)
β¨ recno(3) β record number database access method β¨
okay bestie, gather round, we're talking about recno, the record number database access method. it's a real one from the old days and she is vintage π
π LIBRARY π
Standard C library (libc, -lc). yes, that libc. the moment is hers.
πΈ SYNOPSIS πΈ
#include <sys/types.h>
#include <db.h>
that's it. two includes. stunning. no notes π
π¦ DESCRIPTION π¦
β οΈ Note well, bestie: this page documents interfaces provided up until glibc 2.1. Since glibc 2.2, glibc no longer provides these interfaces. Probably, you are looking for the APIs provided by the libdb library instead. so likeβ¦ if you're here in the modern era, you're lowkey in the wrong place, but the lore is still iconic π«Ά
The routine dbopen(3) is the library interface to database files. One of the supported file formats is record number files. The general description of the database access methods lives in dbopen(3) β this manual page describes only the recno-specific information. so go read dbopen(3) for the big picture, and come back here for the recno tea β
The record number data structure is either variable or fixed-length records stored in a flat-file format, accessed by the logical record number. And here's the part that's giving main character energy: the existence of record number five implies the existence of records one through four π€ like, no skipping ahead. and the deletion of record number one causes record number five to be renumbered to record number four β plus the cursor, if positioned after record number one, shifts down one record. everything moves. the whole squad feels it. fr fr.
The recno access-method-specific data structure provided to dbopen(3) is defined in the <db.h> include file as follows:
typedef struct {
unsigned long flags;
unsigned int cachesize;
unsigned int psize;
int lorder;
size_t reclen;
unsigned char bval;
char *bfname;
} RECNOINFO;
and the elements of this structure are defined as follows, one by one, no skipping, we don't do that here π
flagsβ the flag value is specified by ORing any of the following values:R_FIXEDLENβ the records are fixed-length, not byte delimited. The structure elementreclenspecifies the length of the record, and the structure elementbvalis used as the pad character. Any records inserted into the database that are less thanreclenbytes long are automatically padded. (she pads. periodt.)R_NOKEYβ in the interface specified bydbopen(3), the sequential record retrieval fills in both the caller's key and data structures. If theR_NOKEYflag is specified, the cursor routines are not required to fill in the key structure. This permits applications to retrieve records at the end of files without reading all of the intervening records. skipping the queue? allowed. iconic behavior πβοΈR_SNAPSHOTβ this flag requires that a snapshot of the file be taken whendbopen(3)is called, instead of permitting any unmodified records to be read from the original file. πΈ
cachesizeβ a suggested maximum size, in bytes, of the memory cache. This value is only advisory, and the access method will allocate more memory rather than fail. Ifcachesizeis0(no size is specified), a default cache is used. she's flexible like that, we love a girl who doesn't gatekeep β¨psizeβ the recno access method stores the in-memory copies of its records in a btree. This value is the size (in bytes) of the pages used for nodes in that tree. Ifpsizeis0(no page size is specified), a page size is chosen based on the underlying filesystem I/O block size. Seebtree(3)for more information.lorderβ the byte order for integers in the stored database metadata. The number should represent the order as an integer; for example, big endian order would be the number4,321. Iflorderis0(no order is specified), the current host order is used.reclenβ the length of a fixed-length record.bvalβ the delimiting byte to be used to mark the end of a record for variable-length records, and the pad character for fixed-length records. If no value is specified, newlines ("\n") are used to mark the end of variable-length records and fixed-length records are padded with spaces. default behavior, she has it πbfnameβ the recno access method stores the in-memory copies of its records in a btree. Ifbfnameis non-NULL, it specifies the name of the btree file, as if specified as the filename for adbopen(3)of a btree file.
The data part of the key/data pair used by the recno access method is the same as other access methods. The key is different π The data field of the key should be a pointer to a memory location of type recno_t, as defined in the <db.h> include file. This type is normally the largest unsigned integral type available to the implementation. The size field of the key should be the size of that type.
Because there can be no metadata associated with the underlying recno access method files, any changes made to the default values (e.g., fixed record length or byte separator value) must be explicitly specified each time the file is opened. every single time. she does not remember. she will not remember. you must tell her again π
In the interface specified by dbopen(3), using the put interface to create a new record will cause the creation of multiple, empty records if the record number is more than one greater than the largest record currently in the database. so like, jump to record 100 when you only have 3? bestie, you just made 96 empty records. hope that was the plan π
π ERRORS π
The recno access method routines may fail and set errno for any of the errors specified for the library routine dbopen(3) or the following:
EINVALβ an attempt was made to add a record to a fixed-length database that was too large to fit. she said no. the record did not fit. and honestly? valid.
π BUGS π
Only big and little endian byte order is supported.
that's it. that's the whole bug section. no middling endianness allowed, it's binary or nothing π€
π SEE ALSO π
Document Processing in a Relational Database System, Michael Stonebraker, Heidi Stettner, Joseph Kalash, Antonin Guttman, Nadene Lynn, Memorandum No. UCB/ERL M82/32, May 1982. yes she's citing a 1982 memorandum and that's exactly the kind of academic slay we respect πβ¨
and that's the whole page, bestie!! this one's brought to you by the 4.4 Berkeley Distribution, dated 2025-09-21 β so like, old-school distribution energy with a fresh little date stamp. go forth and know ur record numbers ππΈπ¦
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: BSD-4-Clause-UC
- Copyright 1990-1993, The Regents of the University of California
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms