summaryrefslogtreecommitdiffstats
path: root/lib/libstand/lseek.c
Commit message (Collapse)AuthorAgeFilesLines
* Add __FBSDID()s to libstanddillon2001-09-301-1/+3
|
* Fix a bug in lseek which caused the loader to fail on some gzippedjdp2001-08-291-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | kernels. The error message was "elf_loadexec: cannot seek". Libstand maintains a read-ahead buffer for each open file, so that it can read in chunks of 512 bytes for greater efficiency. When the loader tries to lseek forward in a file by a small amount, it sometimes happens that the target file offset is already in the read-ahead buffer. But the lseek code simply discarded the contents of that buffer and performed a seek directly on the underlying file. This resulted in an attempt to seek backwards in the file, since some of the data has already been read into the read-ahead buffer. Gzipped data streams cannot seek backwards, so an error was returned. This commit adds code which checks to see if the desired file offset is already in the read-ahead buffer. If it is, the code simply adjusts the buffer pointer and length, thereby avoiding a reverse seek on the gzipped data stream. I incorporated a suggestion from Matt Dillon which saved a little bit of code in this fix. Reviewed by: dillon, gallatin, jhb
* Implement readahead buffering for non-raw files. This drastically improvesmsmith2000-09-051-27/+38
| | | | | | | | | the efficiency of byte-by-byte read operations on filesystems not already supported by the block cache (especially NFS). This should be a welcome change for users booting via PXE, as the loader now reads its startup files almost instantly, instead of taking tens of seconds.
* This is libstand; a support library for standalone executables (eg. bootstrapmsmith1998-08-201-0/+102
modules). Obtained from: NetBSD, with some architectural changes and many additions.
OpenPOWER on IntegriCloud