Commit graph

191 commits

Author SHA1 Message Date
Olivier Certner 9b30b96c1f
Remove remnants of portsnap(8)
This was prompted by noticing that '/var/db/portsnap' still exists on
newly-installed machines.

With this change, all mentions of portsnap(8) in the tree are gone,
except for the historical note in the AUTHORS section of manpage
phttpget(8).

locate(1) will thus start indexing again '/var/db/portsnap' on machines
where this directory still exists, which may be a good way to push
administrators to delete it.

Reviewed by:            cperciva
Approved by:            emaste (mentor)
MFC after:              3 days
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D45023
2024-04-30 22:44:34 +09:00
Warner Losh 0b8224d1cc Remove copyright strings ifdef'd out
We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals. These copyright strings are present in the comments and
are largely from CSRG's attempt at adding their copyright to every
binary file (which modern interpretations of the license doesn't
require).

Sponsored by:		Netflix
2023-11-26 22:23:58 -07:00
Warner Losh bdcbfde31e usr.bin: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by:		Netflix
2023-11-26 22:23:30 -07:00
John Baldwin eba230afba Purge more stray embedded $FreeBSD$ strings
These do not use __FBSDID but instead use bare char arrays.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41957
2023-09-25 07:54:56 -07:00
Warner Losh b2c76c41be Remove $FreeBSD$: one-line nroff pattern
Remove /^\.\\"\s*\$FreeBSD\$$\n/
2023-08-16 11:55:15 -06:00
Warner Losh fa9896e082 Remove $FreeBSD$: two-line nroff pattern
Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
2023-08-16 11:55:10 -06:00
Warner Losh d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Warner Losh 42b388439b Remove $FreeBSD$: one-line .h pattern
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
2023-08-16 11:54:23 -06:00
Warner Losh b3e7694832 Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-08-16 11:54:16 -06:00
Warner Losh 4d846d260e spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with:		pfg
MFC After:		3 days
Sponsored by:		Netflix
2023-05-12 10:44:03 -06:00
Simon J. Gerraty d9a4274795 Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
John Baldwin c330a185b7 locate: Use C89 function definitions.
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D39526
2023-04-18 11:27:08 -07:00
Wolfram Schneider 047eec4966 improve c style
- BSD KNF: return is a native statement and we use
  a space before the parenthesis
- remove superfluous empty lines

Reported by:    jrtc27
2022-02-14 19:30:09 +00:00
Wolfram Schneider a9a43945d3 grammar
Reported by:	jrtc27
2022-02-14 18:16:43 +00:00
Wolfram Schneider 93885bb041 Better help message if locate database does not exists
PR:		211501
Reported by:	Oliver Peter
Reviewed by:	Pau Amma
Differential Revision:	https://reviews.freebsd.org/D34243
2022-02-13 17:00:22 +00:00
Wolfram Schneider a6c20ddd4a switch from short to int for lookup table
This simplifies the code, less casting is needed.
2022-02-05 08:44:35 +00:00
Wolfram Schneider d43255b50c remove dead code
A lookup array is faster than a function with linear search.
The old function was not used for years - spring cleaning.
2022-02-03 17:02:37 +00:00
Wolfram Schneider 39a30a8097 better printf(3) format usage
Reported by: jhb
2022-02-03 16:57:25 +00:00
Wolfram Schneider 792df7ced2 improve casting for pointer diffs 2022-02-01 17:26:20 +00:00
Wolfram Schneider 1536d37b20 fix casting issue in error message for 32bit CPUs (e.g. armv7) 2022-01-31 18:30:07 +00:00
Wolfram Schneider d7e8005bfa cleanup documentation 2022-01-31 18:11:14 +00:00
Wolfram Schneider 00ad40d70a throw an error if reading from stdin failed 2022-01-31 18:04:45 +00:00
Wolfram Schneider 834a8fa169 enable to configure the locate path length at compile time
The length has not changed and is 1024 chars (equals PATH_MAX).

PR: 201243
Submitted by: Willem Jan Withagen <wjw@digiware.nl>
2022-01-31 17:32:46 +00:00
Wolfram Schneider 8d35ca86c5 Fix statistics for empty databases
An empty database is a database which does not contain any filenames.
It should not occur in practice but maybe in the case of an error.

echo | /usr/libexec/locate.mklocatedb > empty.db; locate -d empty.db -S
2022-01-31 17:03:08 +00:00
Wolfram Schneider 69ae5b9667 remove register
There are no measurable performance differences if registers are used or not.
2022-01-31 10:59:07 +00:00
Wolfram Schneider 33ee87fa0a improve error handling for corrupt database 2022-01-30 18:04:52 +00:00
Wolfram Schneider 5260fbcebd fix check for integer
For historical reasons, the integer is stored with an offset of plus 14.
That means, for a given max path length of 1024 the valid values
are -1009 .. 1037 and not -1023 .. 1023

PR: 201243
2022-01-30 16:27:27 +00:00
Wolfram Schneider e7d6783f4a enable to set locate command 2022-01-30 16:24:49 +00:00
Wolfram Schneider 8e7c0a6d32 fix fgets error handling (from last commit) 2022-01-30 13:08:42 +00:00
Wolfram Schneider 72a0982cd5 improve error handling 2022-01-30 09:27:21 +00:00
Wolfram Schneider 9146546eae locate statistics: show number of longest path in database 2022-01-29 07:13:28 +00:00
Wolfram Schneider 21cc4bee69 sync improvements from concatdb.sh
- stop on first error
- improve awk script: print the last two characters for bigram -  not the second word
- remove unnecessary checks
- use mktemp
- refactor
2022-01-29 07:12:09 +00:00
Wolfram Schneider 5cf0049653 limit sort(1) memory usage to 20% of available main memory
By default BSD sort(1) uses 90% (or at least 50%?) of the available
main memory. That is good for performance for a single job, but not
for a shared OS. For a long running script the performance is less
important than the stability of the server.  Also, if a server
with 64GB RAM starts swapping, the performance goes south and
hurts other running applications.

Note: this change does not affect the weekly cron job to
rebuild the locate database. The FreeBSD locate.updatedb
use the -presort option (find -s)
2022-01-26 19:30:11 +00:00
Wolfram Schneider 0c178a2a64 support more than 2 billion file names for counting (-c) or limits (-l limit)
- this fix (harmless) integer overflows for very large partitions (>1PB)
- code cleanup
2022-01-26 16:15:23 +00:00
Wolfram Schneider e48156828f switch to 64 bit integers for counting bigrams
This fixes an integer overflow for very large partitions around 35 billion
filenames (>2PB). However, in an artificially worst case it may occurs
by only 17 mio filenames on a partition.
2022-01-26 16:11:51 +00:00
Wolfram Schneider ccf50c1df9 locate statistics: non zero exit on corrupt database 2022-01-25 16:55:58 +00:00
Wolfram Schneider b7a74bbc41 stop on error and display the statstics anyway
PR:		32686
2022-01-25 15:59:41 +00:00
Baptiste Daroussin 389844c058 locate: change from BSD-4-clause to BSD-3-clause
We have the authorization from the University of California to remove
the advertising clause for a while, wosch@ who also hold a copyright
on this code also approved the relicensing

Approved by:	wosch@
MFC after:	3 days
2022-01-25 09:20:17 +01:00
Wolfram Schneider 829afcb5d3 refactor script
- simpler usage of mktemp(1)
- remove unnecessary checks
- documentation
2022-01-24 18:28:30 +00:00
Wolfram Schneider 0a88bd81b7 awk: print the last two characters for bigram - not the second word
A bigram may contain a space character, and we always need two characters.
2022-01-24 18:27:43 +00:00
Wolfram Schneider 41c539bdd1 stop on first error 2022-01-24 18:27:34 +00:00
Wolfram Schneider e0282802a6 remove debug code for cpu usage
I guess nobody used this in the last decade, and you can get
similar results with the time(1) command.
2022-01-20 06:43:54 +00:00
Wolfram Schneider cfa3856452 Use 64-bit integers for database statistics
This fix (harmless) integer overflows for larger partitions (>2TB)

PR: 223023
2022-01-20 06:27:08 +00:00
Wolfram Schneider a97ce14abc correct type of mmap len parameter
Using locate -m on a database > 2GB should work now.

PR: 261277
2022-01-19 19:32:16 +00:00
Guangyuan Yang 92b959f120 Fix a grammar error on locate(1).
While here, also fix a useless .Tn reported by mandoc.

PR:		251746
MFC after:	1 week
Sumbitted by:	David Schlachter <fbsd-bugzilla@schlachter.ca>
2020-12-11 08:04:54 +00:00
Kyle Evans 8dddde9ebb locate: fix -fno-common build
Just a single variable declaration to extern and define elsewhere here,
myctype.

-fno-common will become a default in GCC10/LLVM11.

MFC after:	3 days
2020-03-29 19:16:14 +00:00
Brad Davis 1b491096a4 Move install of locate.rc to usr.bin/locate/locate/
This leverages CONFS to handle the install and purges an old comment.

Approved by:	re (blanket, pkgbase), bapt (mentor)
Differential Revision:	https://reviews.freebsd.org/D17215
2018-09-18 20:50:07 +00:00
Mariusz Zaborski 7672a0148f Convert cap_enter() < 0 && errno != ENOSYS to caph_enter() < 0.
No functional change intended.
2018-06-19 23:43:14 +00:00
Pedro F. Giffuni 1de7b4b805 various: general adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.
2017-11-27 15:37:16 +00:00
Pedro F. Giffuni df57947f08 spdx: initial adoption of licensing ID tags.
The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.

Initially, only tag files that use BSD 4-Clause "Original" license.

RelNotes:	yes
Differential Revision:	https://reviews.freebsd.org/D13133
2017-11-18 14:26:50 +00:00