Commit Graph

12853 Commits

Author SHA1 Message Date
christos ce58ffd338 remove lint hacks now that lint supports _Static_assert 2021-09-17 21:06:35 +00:00
christos 707cb24578 XXX: Teach lint about _Static_assert... 2021-09-17 14:49:03 +00:00
christos 76d4fad60d Use CPPFLAGS for -D and -I so that lint works. 2021-09-17 14:48:31 +00:00
andvar b58602814f fix typos in word "successful". 2021-09-16 22:19:10 +00:00
andvar 72e44f84cb fix typos in word "successfully", mainly s/succesfully/successfully/. 2021-09-16 21:29:41 +00:00
rillig eff0250e6d sysinst: fix lint error about empty compound literal
In C99, a compound literal must have at least one expression between the
braces.  Empty structs and compound literals are a GNU extension.

The first member of struct part_entry has type size_t, therefore 0 fits
well.

No functional change.
2021-09-14 21:45:20 +00:00
rillig 8e69325a35 bta2dpd: fix lint build 2021-09-14 20:45:19 +00:00
rillig cca06e9c53 autofs: fix lint errors
common.c(1034): error: void function parse_map cannot return value [213]
common.c(1053): error: void function parse_map cannot return value [213]
2021-09-14 20:40:55 +00:00
rillig f6412b224f usr.sbin: enable lint for all programs 2021-09-14 20:36:02 +00:00
rillig bbb9ad67ae acpidump: fix lint errors
When lint runs on the code, it defines the preprocessor macro 'lint' to
be 1.  Due to that, this name cannot be used as a regular identifier.

acpi.c(86): error: syntax error '1' [249]
acpi.c(1004): error: syntax error '1' [249]
acpi.c(2422): error: void function acpi_print_lpit cannot return value
    [213]

The FreeBSD code doesn't need this name change since lint is specific to
NetBSD.

No functional change.
2021-09-14 20:34:36 +00:00
andvar 80f2027016 sysinst/partitions.h: fix typos comments, also fix same typos in other files. 2021-09-11 21:30:46 +00:00
andvar 207defd036 Add missing double p and d for stopped and overriden accordingly.
Fix few more typos along the way, mainly in copy-pasted comments.
2021-09-11 20:28:03 +00:00
andvar 11850c9e27 s/existant/existent/ in comments and messages, plus few more similar fixes. 2021-09-03 22:33:17 +00:00
andvar f9faf20aef fix typos in comments, mainly s/extention/extension/ and s/sufficent/sufficient/ 2021-09-03 21:54:58 +00:00
rillig 11067b051b inetd: remove redundant tests before calling isspace 2021-09-03 21:02:04 +00:00
rillig 18ec0f1992 inetd: remove redundant null check before free
No functional change.
2021-09-03 20:41:19 +00:00
rillig adeed07f1b inetd: prepare for lint's strict bool mode
Lint's strict bool mode considers bool incompatible with the other
scalar types.  This makes the type of expressions more visible in the
code.  In particular, conditions of the form '!strcmp(...)' are no
longer allowed, they have to be written as 'strcmp(...) == 0'.

The operator '!' cannot be used with sep->se_wait since that has type
pid_t, not bool.

No change to the resulting binary.
2021-09-03 20:24:28 +00:00
rillig 9948f2b7a0 inetd: normalize indentation and alignment in comments 2021-09-03 19:33:51 +00:00
andvar 3b732a4cd9 s/optons/options/ 2021-09-01 13:44:02 +00:00
mlelstv 478946fb16 conditional build fix. 2021-09-01 06:10:06 +00:00
rillig 3ac7b8f346 inetd: fix Clang build
error: implicit conversion changes signedness: 'service_type' to 'int'
2021-08-31 19:34:42 +00:00
wiz 6ac4757e25 Use Dq. 2021-08-31 11:16:00 +00:00
rillig 5d133dbc57 inetd: raise WARNS from 5 to 6
The necessary fixes include:
* explicit integer conversions, to get rid of mixed signedness
* function prototypes for parameterless functions

While here:
* add space after comma
* add space after 'if'
* place the '{' of a function definition on a separate line
* rename variables 'bits' and 'temp' to 'hi' and 'lo'
* in parse_quote, prefer expressions over assignments
* make hex_to_bits static

No functional change.
2021-08-30 18:21:11 +00:00
rillig 9805323331 inetd: remove trailing whitespace 2021-08-30 17:32:23 +00:00
wiz 2c6f71cb3d Wording and formatting improvements.
New sentence, new line.
2021-08-30 16:10:34 +00:00
mlelstv 1223be2cd5 Fix reverted logic when parsing server program.
Compare pointer with NULL not 0.
2021-08-30 08:21:12 +00:00
tih d118c9fa9a Summary: char is unsigned on arm, so use int when -1 indicates error
hex_to_bits() returns -1 on error, so declare it int, and do the same
for the variables that hold intermediate values returned by it.
2021-08-30 06:27:49 +00:00
christos 6344409ebf remove -m32 accidentally committed 2021-08-29 11:43:48 +00:00
christos b74091d873 fix printf formats (intmax -> j) 2021-08-29 11:43:25 +00:00
christos 2557380693 Inetd enhancements by James Browning, Gabe Coffland, Alex Gavin, Solomon Ritzow
Described in:
    https://www.mail-archive.com/tech-userlevel@netbsd.org/msg03114.html
And developed in:
    https://github.com/ritzow/src/pull/1

From their notes:

All new functionality should be explained by the updated manpage.

The manpage has been refactored a bit: A new section "Directives"
has been added and the information about default hostnames and
IPsec directives has been moved there, and the new file include
directive information is also there.

getconfigent has the most major changes. A newline is no longer
read immediately, but is called only by a "goto more" (inside an
if(false) block). This allows multiple definitions or directives
to exist on a single line for anything that doesn't terminate using
a newline. This means a key-values service definition can be followed
by another key-values service definition, a positional definition,
or an ipsec, hostname, or .include directive on the same line.

memset is no longer used explicitly to clear the servtab structure,
a function init_servtab() is used instead, which uses a C struct
initializer.

The servtab se_group field is its own allocation now, and not just
a pointer into the user:group string.

Refactored some stuff out of getconfigent to separate functions
for use by parse_v2.c. These functions in inetd.c are named with
the form parse_*()

parse_v2.c only has code for parsing a key-values service definition
into a provided servtab. It should not have anything that affects
global state other than line and line_number.

Some function prototypes, structures, and #defines have been moved
from inetd.c to inetd.h.

The function config_root replaces config as the function called on
a config file load/reload. The code removed from the end of
config(void) is now called in config_root, so it is not run on each
recursive config call.

setconfig(void) was removed and its code added into config_root
because that is the only place it is called, and redundant checks
for non-null globals were removed because they are always freed by
endconfig. The fseek code was also removed because the config files
are always closed by endconfig.

Rate limiting code was updated to add a per-service per-IP rate
limiting form. Some of that code was refactored out of other places
into functions with names in the form rl_*()

We have not added any of the license or version information to the
new files parse_v2.c, parse_v2.h, and inetd.h and we have not
updated the license or version info for inetd.c.

Security related:

The behavior when reading invalid IPsec strings has changed. Inetd
no longer exits, it quits reading the current config file instead.
Could this impact program security?

We have not checked for memory leaks. Solomon tried to use dmalloc
without success. getconfigent seemed to have a memory leak at each
"goto more". It seems like inetd has never free'd allocated strings
when throwing away erroneous service definitions during parsing
(i.e. when "goto more" is called when parsing fields). OpenBSD's
version calls freeconfig on "goto more"
(c5eae130d6/usr.sbin/inetd/inetd.c (L1049))
but NetBSD only calls it when service definitions are no longer
needed. This has been fixed. freeconfig is called immediately before
any "goto more". There shouldn't be any time when a servtab is in
an invalid state where freeconfig would break.
2021-08-29 09:54:18 +00:00
andvar 626fac18a1 s/priviledge/privilege/ in comments/log messages and fix one typo in descriptor. 2021-08-22 20:18:39 +00:00
andvar c69f42d323 fix mainly same typos as in my previous commit but outside sys/dev/dm. 2021-08-21 23:00:30 +00:00
andvar 8324be4c9b fix some more typos in comments/log messages, improve wording as well. 2021-08-21 11:55:24 +00:00
andvar b53fb80371 s/accidentaly/accidentally/ 2021-08-21 10:06:33 +00:00
andvar 16e91b5f21 s/helt/held+s/eroneously/erroneously/+s/splitted/split/+s/recommented/recommended/ 2021-08-21 09:59:45 +00:00
andvar 2e0bf311b3 fix multiplei repetitive typos in comments, messages and documentation. mainly because copy paste code big amount of files are affected. 2021-08-17 22:00:26 +00:00
christos 1b6126848e Restore BSD BUGS section 2021-08-15 11:00:43 +00:00
ryo 567a3a02e7 Improved the performance of kernel profiling on MULTIPROCESSOR, and possible to get profiling data for each CPU.
In the current implementation, locks are acquired at the entrance of the mcount
internal function, so the higher the number of cores, the more lock conflict
occurs, making profiling performance in a MULTIPROCESSOR environment unusable
and slow. Profiling buffers has been changed to be reserved for each CPU,
improving profiling performance in MP by several to several dozen times.

- Eliminated cpu_simple_lock in mcount internal function, using per-CPU buffers.
- Add ci_gmon member to struct cpu_info of each MP arch.
- Add kern.profiling.percpu node in sysctl tree.
- Add new -c <cpuid> option to kgmon(8) to specify the cpuid, like openbsd.
  For compatibility, if the -c option is not specified, the entire system can be
  operated as before, and the -p option will get the total profiling data for
  all CPUs.
2021-08-14 17:51:18 +00:00
christos 077013d943 One more ldap change 2021-08-14 17:08:21 +00:00
andvar 6e3ee785e2 s/bacause/because/ 2021-08-13 20:19:13 +00:00
martin 38248942cf PR 56354: all actions to set up swap space are not guaranteed to gain
us enough virtual memory anyway, so drop return codes from set_swap*.
The state for cleanup (which swap dev to unuse) has been made global
some time ago anyway.

Previously use of the return values was inconsistent. Error reporting
will only confuse users and sometimes the situation is hard to fix or
even impossible (like in miniroots copide to swap space for booting).
2021-08-12 09:33:59 +00:00
andvar 6584ea569e fix various typos in compatibility, mainly in comments. 2021-08-09 20:49:08 +00:00
andvar 32a556f954 fix various typos in comments and messages. 2021-08-09 19:24:32 +00:00
andvar db383f4739 s/partion/partition/ s/arrray/array/ in comments. 2021-08-08 21:50:10 +00:00
nia f96b5061e9 perfused: use SOL_LOCAL 2021-08-08 20:56:54 +00:00
nia 213aa76def introduce a SOL_LOCAL for unix-domain socket level socket options
as an alias of the current 0 used for these options, as in FreeBSD.

reviewed by many.
2021-08-08 20:54:48 +00:00
andvar ba70c588fa fix various typos in comments. 2021-08-06 07:55:13 +00:00
andvar bfc9dbf5d0 s/pasword/password/ 2021-08-03 20:59:20 +00:00
martin fa635f7d57 Cleanup alarm(3) handling in the timezone selection menu for error
cases, pointed out by RVP.
2021-08-03 13:40:33 +00:00
martin 71830ed8c3 When reading output from a program we don't know how much it will
be - so scale the buffer (within reasonable limits).
Problem pointed out by RVP, triggered e.g. by disks with lots of GPT
partitions.
2021-08-03 13:34:04 +00:00