Commit Graph

18 Commits

Author SHA1 Message Date
Stefan Eßer
2919c53c63 Remove O_SYNC from the options passed to dbmopen().
The output file is created as a temporary file that is moved over the
existing file after completion. Thus there is no need to immediately
flush all created db records to the temporary file.

This speeds up creation of the termcap db by a factor of 40 on my
ZFS based /etc filesytem (from 25 seconds to 0.6 seconds).

I have compared multiple output files created with and without O_SYNC
and they came out identical each time.  Nonetheless it might be best
to MFC this change and the similar one for services_mkdb (r295465) at
the same time when the changes to hash.c in review D5186 are merged.

MFC:	 1 week
2016-02-19 08:42:13 +00:00
Renato Botelho
3aefe8928a Make cap_mkdb and services_mkdb file operations sync
Similar fix was done for passwd and group operations in r285050. When a
temporary file is created and then renamed to replace official file there
are no checks to make sure data was written to disk and if a power cycle
happens at this time, system can end up with a 0 length file

Approved by:	bapt
MFC after:	1 week
Sponsored by:	Netgate
Differential Revision:	https://reviews.freebsd.org/D2982
2016-01-07 10:39:13 +00:00
Ed Schouten
f3d61b0c62 Add missing static keywords to cap_mkdb(1) 2011-11-06 08:14:03 +00:00
Joel Dahl
da52b4caaf Remove the advertising clause from UCB copyrighted files in usr.bin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change

Also add $FreeBSD$ to a few files to keep svn happy.

Discussed with:	imp, rwatson
2010-12-11 08:32:16 +00:00
Ruslan Ermilov
6fe37d1365 Add endianness support to cap_mkdb(1), useful for cross builds. 2005-02-22 23:29:54 +00:00
Ruslan Ermilov
02172b19b8 Fixate the hash bucket size to 4K. We were using the default,
which is stat.st_blksize (i.e., PAGE_SIZE).

This change causes the .db files that were cross-compiled on
another platform to be identical to the natively built ones.

Tested on:	alpha->amd64 build
2005-02-19 23:59:49 +00:00
David Malone
77ae8ac713 ANSIify function definitions to avoid a warning. 2002-07-28 14:41:26 +00:00
Warner Losh
f1bb2cd2aa remove __P 2002-03-22 01:22:50 +00:00
David Malone
9f5b04e925 Style improvements recommended by Bruce as a follow up to some
of the recent WARNS commits. The idea is:

1) FreeBSD id tags should follow vendor tags.
2) Vendor tags should not be compiled (though copyrights probably should).
3) There should be no blank line between including cdefs and __FBSDIF.
2001-12-10 21:13:08 +00:00
Mark Murray
cbc4699c32 Use __FBSDID(). 2001-12-02 22:46:47 +00:00
Dima Dorfman
653636c21d Silence a warning on the Alpha.
Reviewed by:	md5(1)
2001-06-30 05:32:29 +00:00
Ruslan Ermilov
f66c1ecf8f Don't treat the pipe symbol in capabilities as an alternate
record name indicator; this causes a spurious warning:

$ cat x
record:\
	:capability=|value:
$ cap_mkdb x
cap_mkdb: ignored duplicate: record

Spotted by:	dcs
2001-06-01 14:45:00 +00:00
Philippe Charnier
93d6b9b66d Make better use of .Ar. Use DIAGNOSTICS instead of incorrect section name.
Add rcsid. Remove unused #includes. Cosmetic in error messages.
1999-11-21 16:16:30 +00:00
Archie Cobbs
fa146c5335 Tweaks to allow compiling -Wall (mostly adding "const" to char rcsid[]). 1998-12-06 22:58:23 +00:00
Bruce Evans
c513aafea1 Fixed printf format errors. 1998-08-02 15:18:45 +00:00
Bruce Evans
22694ebad5 Fixed printf format errors. 1998-07-06 21:01:54 +00:00
Warner Losh
1c8af87873 compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-29 04:34:07 +00:00
Rodney W. Grimes
9b50d90275 BSD 4.4 Lite Usr.bin Sources 1994-05-27 12:33:43 +00:00